Python Forum
Brute Force Password Cracker - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: Code sharing (https://python-forum.io/forum-5.html)
+--- Thread: Brute Force Password Cracker (/thread-26591.html)



Brute Force Password Cracker - hendry1 - May-06-2020

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))



RE: Brute Force Password Cracker - CrazyMakes - May-12-2020

This is pretty cool and could be very useful for testing to see how easy it is for your password to be cracked