-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbruteforce.py
61 lines (52 loc) · 1.96 KB
/
bruteforce.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
import itertools
import string
import time
charset = string.ascii_letters + string.digits
capital_charset = string.ascii_uppercase
lowercase_charset = string.ascii_lowercase
digits = string.digits
def bruteforce(password):
start = time.time()
for char in charset:
for guess in itertools.product(charset, repeat=len(password) - 1):
guess = char + ''.join(guess)
if(guess == password):
print(f"done password found: {guess}")
end = time.time()
tim = f"time elapsed: {(end - start)} seconds"
print(tim)
return
def dir_bruteforce(password):
start = time.time()
with open('10-million-password-list-top-1000000.txt', 'r') as file:
for line in file:
word = line.strip()
if word == password:
print(f"password found in database: {word}")
end = time.time()
tim = f"time elapsed: {(int)(end - start)} seconds"
print(tim)
return
with open('xato-net-10-million-passwords.txt', 'r') as file:
for line in file:
word = line.strip()
if word == password:
print(f"password found in database: {word}")
end = time.time()
tim = f"time elapsed: {(int)(end - start)} seconds"
print(tim)
return
with open('list.txt', 'r') as file:
for line in file:
word = line.strip()
if word == password:
print(f"password found in database: {word}")
end = time.time()
tim = f"time elapsed: {(int)(end - start)} seconds"
print(tim)
return
print("Didn't find anything! Password is safe")
end = time.time()
tim = f"time elapsed: {(int)(end - start)} seconds"
print(tim)
return