Reputation: 3
__author__ = 'Zane'
import hashlib
import sys
if (len(sys.argv)!=2 ) or (len(sys.argv[1])!= 32):
print("[---] md5cracker.py & hash")
sys.exit(1)
crackedmd5 = sys.argv[1]
# open a file and read its contents
f = open('file.txt')
lines = f.readline()
f.close()
for line in lines:
cleanline = line.rstrip()
hashobject = hashlib.md5(cleanline)
if (hashobject==crackedmd5):
print('Plain text password for ' + crackedmd5 + "is " + hashobject + '\n')
I get no error with exit code 1 and i do not know where i get it wrong
Upvotes: 0
Views: 931
Reputation: 446
Pythons code structure is based on indent of lines. For now your whole code is part of the if (len(sys.argv)!=2 ) or (len(sys.argv[1])!= 32):
condition.
You need to unindent all lines with one tab starting from crackedmd5 = sys.argv[1]
You also used lines = f.readline()
which will read only one line and so for line in lines
will iterate over every single char in that line and not over multiple lines. You need to use lines = f.readlines()
instead.
Upvotes: 0
Reputation: 12234
Your program exits with status code one because you told it so (roughly on line 8):
sys.exit(1)
Upvotes: 2