Python Forum
Unknown syntax error (Im new to this) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Unknown syntax error (Im new to this) (/thread-11777.html)



Unknown syntax error (Im new to this) - reasonablelevel - Jul-25-2018

# 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."



RE: Unknown syntax error (Im new to this) - stranac - Jul-25-2018

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.


RE: Unknown syntax error (Im new to this) - reasonablelevel - Jul-25-2018

ok thank you very much Heart