Python Forum

Full Version: Unknown syntax error (Im new to this)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
# im trying to make a password cracker but i have a syntax error. the problem is in line 15 im not sure how to fix it.
# i believe it's a problem with the speech marks. any help?? thx!!
import md5

counter = 1 

pass_in = raw_input("Enter MD5 Hash: ")
pwfile = raw_input("Please enter the dictionary attack file name: ")

try: 
	 pwfile = open(pwfile, "r")
except:
	print ("\nFile not found.")
	quit()
for password in pwfile:
	filemd5 = md5.new(password.strip()).hexidigest()
print "Trying password number %d: %s " % (counter, password.strip())	
	counter += 1
	if pass_in == filemd5:
		print "\nMatch found. \nPassword is: %s" % password
		break
else: print "\Failed. Password not found."
If you're actually getting a SyntaxError on line 15, you're trying to run python 2 code using python 3.
If you were running it using python 2, you'd get an IndentationError on line 16 instead.

So you'll need to either use python 2, or rewrite your code for python 3.
ok thank you very much Heart