Python Forum
Unknown syntax error (Im new to this)
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unknown syntax error (Im new to this)
#1
# 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."
Reply
#2
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.
Reply
#3
ok thank you very much Heart
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Syntax error for "root = Tk()" dlwaddel 15 1,183 Jan-29-2024, 12:07 AM
Last Post: dlwaddel
Photo SYNTAX ERROR Yannko 3 388 Jan-19-2024, 01:20 PM
Last Post: rob101
  Syntax error while executing the Python code in Linux DivAsh 8 1,606 Jul-19-2023, 06:27 PM
Last Post: Lahearle
  Error UserWarning: Unknown option ssl_ca_certs warnings.warn(str(exc)) Vijayaraj 0 727 Jul-11-2023, 06:01 AM
Last Post: Vijayaraj
  Code is returning the incorrect values. syntax error 007sonic 6 1,231 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  syntax error question - string mgallotti 5 1,318 Feb-03-2023, 05:10 PM
Last Post: mgallotti
  Syntax error? I don't see it KenHorse 4 1,260 Jan-15-2023, 07:49 PM
Last Post: Gribouillis
  Syntax error tibbj001 2 894 Dec-05-2022, 06:38 PM
Last Post: deanhystad
  Python-for-Android:p4a: syntax error in main.py while compiling apk jttolleson 2 1,854 Sep-17-2022, 04:09 AM
Last Post: jttolleson
  Mysql Syntax error in pymysql ilknurg 4 2,364 May-18-2022, 06:50 AM
Last Post: ibreeden

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020