import random
# Guessing password
pas = input("Enter the password to hack: ")
# Definition of possible characters (numbers + letters)
keys = ["1","2","3","4","5","6","7","8","9","0",
"a","b","c","d","e","f","g","h","i","j","k",
"l","m","n","o","p","q","r","s","t","u","v",
"w","x","y","z"]
# Variable Initialization
pwg = ""
attempts = 0 # Compteur d'essais
# Loop until you find the right password
while pwg != pas:
pwg = "" # Réinitialisation du mot de passe deviné
for i in range(len(not)): # Creating a password of the same length
guessPass = random. choice(keys) # Choosing a random character
pwg += guessPass # Adding in the right order
attempts += 1 # Incrémentation du compteur
print(f"Attempt {attempts}: {pwg}") # display password tested
print(f"\nPassword found after {attempts} attempts: {pwg}")