-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSMTP-Brute-Force.py
executable file
·45 lines (42 loc) · 1.57 KB
/
SMTP-Brute-Force.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
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/python
###########################################################################
#SMTP Brute Force #
# #
#Enumerates users in SMTP mail servers via brute force VRFY requests #
# #
# #
#Copyright (C) 2013 Joshua Wang | joshua[dot]wang[dot]90[at]gmail[dot]com #
#Twitter - http://twitter.com/conceptofproof #
#Blog - http://conceptofproof.wordpress.com #
###########################################################################
/*test*/
import socket
import os
import sys
import re
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if len(sys.argv)!=3:
print 'Usage: SMTP-Brute-Force.py {target specification} [username list]'
print 'example: ./SMTP-Brute-Force.py 192.168.11.215 users.txt'
else:
print "[*] Connecting to " + sys.argv[1]
f=open(sys.argv[2],"r")
print "[*] Enumerating users:\n"
count = 0
for line in f:
if count==8:
count = 0
s.close()
else:
if count==0:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((sys.argv[1],25))
s.send('VRFY'+line)
result = s.recv(2048)
if "@" in result:
delimlist = result.split(" ")
matchlist = filter(lambda x:re.search('@',x),delimlist)
print matchlist[0]
count+=1
print 'done!'
s.close()