Jun-01-2020, 10:50 PM
Hi,
Im making a password cracker 'proof of concept' were the program accesses a text file and compares the entered password to a list of common passwords before trying random combinations of alphabetical letters.
The problem I'm having is sometimes the program does not recognize a password in the text file.
Any suggestions?
P.S.
pw_dictionary is the name of the text file
Im making a password cracker 'proof of concept' were the program accesses a text file and compares the entered password to a list of common passwords before trying random combinations of alphabetical letters.
The problem I'm having is sometimes the program does not recognize a password in the text file.
Any suggestions?
from random import * guess = "" # guesses = [] NH = input("1 for normal or 2 for advanced?:\n") password = input("password:\n") normal = ["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"] advanced = ["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", "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", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] dictionary = open("pw_dictionary", "r") print(1) for entry in dictionary: print(2) if entry == password: print(3) guess = entry dictionary.close() if NH == "1": while guess != password: guess = "" for letter in password: guessletters = normal[randint(0, 25)] guess = str(guessletters) + str(guess) print(guess) print("Password cracked") else: while guess != password: guess = "" for letter in password: guessletters = advanced[randint(0, 61)] guess = str(guessletters) + str(guess) print(guess) if guess == password: dictionary = open("pw_dictionary", "a") dictionary.write("\n" + str(guess)) dictionary.close() print("Password cracked")
P.S.
pw_dictionary is the name of the text file