El siguiente es un código Python para romper el hash SHA1. Este código no parece funcionar.
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()
La salida que obtuve: -
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 Soy principiante cuando se trata de codificación. Por favor, ayúdame a arreglar este código.