+ 1
please any one can help me I get this to my science fair project and I have to change the code to work form url to file txt
from urllib.request import urlopen, hashlib sha1hash = input("Please input the hash to crack.\n>") LIST_OF_COMMON_PASSWORDS = str(urlopen('https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-10000.txt').read(), 'utf-8') for guess in LIST_OF_COMMON_PASSWORDS.split('\n'): hashedGuess = hashlib.sha1(bytes(guess, 'utf-8')).hexdigest() if hashedGuess == sha1hash: print("The password is ", str(guess)) quit() elif hashedGuess != sha1hash: print("Password guess ",str(guess)," does not match, trying next...") print("Password not in database, we'll get them next time.")
1 Answer
+ 2
Sorry, just to check...
Do you want to use a local file instead of one on the internet?
From the Python course "working with files"
myfile = open("")
The argument of the open function is the path to the file. If the file is in the current working directory of the program, you can specify only its name.