-
Notifications
You must be signed in to change notification settings - Fork 529
/
smtprecon.py
executable file
·33 lines (27 loc) · 1.06 KB
/
smtprecon.py
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
29
30
31
32
#!/usr/bin/python
import socket
import sys
import subprocess
if len(sys.argv) != 2:
print "Usage: smtprecon.py <ip address>"
sys.exit(0)
#SMTPSCAN = "nmap -vv -sV -Pn -p 25,465,587 --script=smtp-vuln* %s" % (sys.argv[1])
#results = subprocess.check_output(SMTPSCAN, shell=True)
#f = open("results/smtpnmapresults.txt", "a")
#f.write(results)
#f.close
print "INFO: Trying SMTP Enum on " + sys.argv[1]
names = open('/usr/share/wfuzz/wordlist/fuzzdb/wordlists-user-passwd/names/namelist.txt', 'r')
for name in names:
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connect=s.connect((sys.argv[1],25))
banner=s.recv(1024)
s.send('HELO [email protected] \r\n')
result= s.recv(1024)
s.send('VRFY ' + name.strip() + '\r\n')
result=s.recv(1024)
if ("not implemented" in result) or ("disallowed" in result):
sys.exit("INFO: VRFY Command not implemented on " + sys.argv[1])
if (("250" in result) or ("252" in result) and ("Cannot VRFY" not in result)):
print "[*] SMTP VRFY Account found on " + sys.argv[1] + ": " + name.strip()
s.close()