Password generator and cracker of these // Why does my code not work? someone help me please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Password generator and cracker of these // Why does my code not work? someone help me please

It is a code that I made in an idle console on my computer and it works perfectly but when I pass it to the console of sololearn it doesn't work, I don't know what to do because it took me a long time and I don't like it not working import itertools import string from random import * import time letters = string.ascii_letters digits = string.digits chars = letters + digits min_length = 8 max_length = 32 paswd = "".join(choice(chars) for x in range(randint(min_length, max_length))) print("Contraseña generada para crakearla ---->", paswd) time.sleep(5) def guess_password(real): chars = string.ascii_lowercase + string.digits attempts = 0 for password_length in range(1, 9): for guess in itertools.product(chars, repeat=password_length): attempts += 1 guess = ''.join(guess) if guess == real: return 'la contraseña es: {}. encontrada en {} intentos.'.format(guess, attempts) print(guess, attempts) print(guess_password(paswd))

22nd Aug 2019, 12:50 PM
Antonio Francisco Conesa
Antonio Francisco Conesa - avatar
2 Answers
22nd Aug 2019, 2:23 PM
Antonio Francisco Conesa
Antonio Francisco Conesa - avatar
+ 1
Please put it inside a python code environment and post it here.
22nd Aug 2019, 12:54 PM
Loeschzwerg