How to fix this script is not showing any data:
Here is my code:
from hashlib import md5
counter = 1
pass_in = input('Enter the md5 hash: ')
pwfile = input('Please enter the passowrd file: ')
try:
pwfile = open(pwfile,'r')
except:
print('\nfile not found')
quit()
for password in pwfile:
filemd5 = md5()
filemd5.update(password.strip().encode('utf-8'))
filemd5.hexdigest()
print('Trying password number')
counter += 1
if pass_in == filemd5:
print('\n Match Found. \nPassword is: %s' + password)
break
else:
print('\n password not found!')
What did i forget?
what is the problem?
filemd5.hexdigest()
doesn't transform the hash object into a string, it returns a string. Change that line to filemd5 = filemd5.hexdigest()
.
Also in print('\n Match Found. \nPassword is: %s' + password)
change the +
to a %
.