May-06-2020, 01:25 PM
This is a brute force password cracker. Input your (fake) password, and watch the computer go! Funnily enough, abc123 takes a very long time.
import itertools import time import string import sys import getpass # Please do not do all numbers. # pas = getpass.getpass(prompt='What is your password?(For security,(and added effect), the password is not shown) ') def guess_password(real): chars = string.ascii_lowercase + string.digits + string.ascii_uppercase 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 'password is {}. found in {} guesses.'.format(guess, attempts) print(guess, attempts) print(guess_password(pas))