-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBruteforce.py
More file actions
27 lines (19 loc) · 828 Bytes
/
Copy pathBruteforce.py
File metadata and controls
27 lines (19 loc) · 828 Bytes
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
from string import printable
from itertools import product
import time
start_time = time.time() # defines start time for program
found = False
for length in range(1, 6): # safe length for trying password
password = 'admin' # use a test password
attempted_password = product(printable, repeat=length)
for attempt in attempted_password:
attempt = ''.join(attempt) # It joins letters together
if attempt == password: #If password is found in the above attempt break
print("Your password is: " + attempt)
found = True
break
if found:
break
print("The program took --- %s seconds ---" % (time.time() - start_time)) # prints total time taken for program
#4 letter characters usually take 6 seconds
#5 letter characters can take more than 800 seconds