Answer:
0
2
I need to make small programs for school to brute force crack different types of passwords; I'm looking to create a brute force python code that will run through every possible combination of alphabetical and alphanumerical passwords and give me the password and the amount of time it took to crack.
I did the same with purely numerical passwords and got this:
import datetime as dt
Password4 = 123456
def crack_password():
start = dt.datetime.now()
for n in range(1000000):
password_guess = '{0:04d}'.format(n)
if password_guess == str(Password4):
end = dt.datetime.now()
print("Password found: {} in {}".format(password_guess, end - start))
break
guesses = crack_password()
I then tried to do something somewhat similar for alphabet/alphanumerical passwords but did not work whatever I tried:
import random
letters = [str(i) for i in range('a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p')]
s = [''.join([a,b,c,d,e,f,g,h]) for a in letters for b in letters for c in letters for d in letters for e in letters for f in letters for g in letters for h in letters]
random.shuffle(s)
real_password = 'aaaaaaaa'
i = 0
Explanation: