SyntaxError: unexpected EOF while parsing. Traceback Line 6, in <module> & FIle "<string>", line 1

  hash, md5, python, syntax-error

md5 to receive CTF for classwork

import hashlib

flag = 0
counter = 0

pass_hash = input("Enter md5 hash: ")

wordlist = input("filename: ")

try:
pass_file = open(wordlist, "r")

except:
print("No file found")
quit()

for word in pass_file:

enc_wrd = word.encode('utf-8')
digest = hashlib.md5(enc_wrd).hexdigest()

if digest == pass_hash:
    print("Password has been found!")
    print("Password:" + word)
    flag = True
    break

if flag == 0:
print("The password is not in your file/list.")

Source: Python Questions

LEAVE A COMMENT