Quello che segue è un codice Python per decifrare l'hash SHA1. Questo codice non sembra funzionare.
import hashlib
# plug in the hash that needs to be cracked
hash_to_crack = "7c4a8d09ca3762af61e59520943dc26494f8941b"
# open the dictionary file
dict_file = "dictionary.txt"
def main():
with open(dict_file) as fileobj:
for line in fileobj:
line = line.strip()
if hashlib.sha1(line).hexdigest() == hash_to_crack:
print ("Successfully cracked the hash %s: It is %s") % (hash_to_crack, line);
return ""
print ("Failed to crack the file.")
if __name__ == "__main__":
main()
L'output che ho ottenuto: -
RESTART: C:/Users/kiran/AppData/Local/Programs/Python/Python37/Codes/datest1.py
Traceback (most recent call last):
File "C:/Users/kiran/AppData/Local/Programs/Python/Python37/Codes/datest1.py", line 17, in <module>
main()
File "C:/Users/kiran/AppData/Local/Programs/Python/Python37/Codes/datest1.py", line 8, in main
with open(dict_file) as fileobj:
FileNotFoundError: [Errno 2] No such file or directory: 'dictionary.txt'
P.S Sono principiante quando si tratta di programmare. Per favore aiutami a correggere questo codice.