-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsmtpchecker.py
More file actions
28 lines (25 loc) · 762 Bytes
/
Copy pathsmtpchecker.py
File metadata and controls
28 lines (25 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import smtplib, sys, os
def check(host,port,log,pas,fl):
try:
s = smtplib.SMTP(host,port, timeout=10)
s.ehlo()
s.starttls()
s.ehlo()
s.login(log,pas)
fl.write("{0}:{1}:{2}:{3}\n".format(pas,log,host,port))
s.close()
except smtplib.SMTPAuthenticationError:
print(host,"Incorrect login/password")
except smtplib.SMTPServerDisconnected:
print(host,"Unable to connect")
# This is used to clean result file.
#os.remove("checked.txt")
fl = open("checked.txt", "a")
if len(sys.argv) < 2:
print ("Usage: smtpchecker.py smtps.txt")
else:
with open(sys.argv[1],'r') as smtps:
for line in smtps:
smtp = line.split(":")
check(smtp[2],int(smtp[3]),smtp[1],smtp[0],fl)
fl.close()