代码审计

CoreMail邮件企业通讯录导出脚本

CoreMail

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
46
47
#coding:utf-8
import requests
import re
import sys
'''
coremail邮件系统企业通讯录导出脚本
'
''
def login(domain,username,password):
data={'startReferer':'','uid':username,'password':password}
httptou={'User-Agent':'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36'}
s=requests.session()
httppost=s.post("http://"+domain+"/coremail/login.jsp",data=data,headers=httptou)
getemail=re.findall('\(this\);"\r\n href="(.*?)" hidefocus>',httppost.text,re.S)
tongxunlu= getemail[0]
mailpage="http://"+domain+"/coremail/XJS/"+tongxunlu
httpgetmailpage=s.get(mailpage)
bumens=re.findall(' href="\.\.(.*?)" hidefocus=',httpgetmailpage.text,re.S)
for bumen in bumens:
paa=bumen[51:]
file = open(paa[3:].replace('/','')+'.txt','a+')
getmail=s.get("http://"+domain+"/coremail/XJS"+bumen)
pages=re.findall(' selected>(.*?)',getmail.text,re.S)
allpage=pages[0]
yeshu= allpage[2:]
for i in range(1,int(yeshu)+1):
url="http://"+domain+"/coremail/XJS"+bumen+"&page_no="+str(i)
fanye=s.get(url)
zhengze='&'+paa+'&uid=(.*?)">'
maildizhis=re.findall(zhengze,fanye.text,re.S)
ids=list(set(maildizhis))
for res in ids:
print res
file.write(res+'\n')
file.close()
if __name__ == '__main__':
commands=sys.argv[1:2]
commandss=sys.argv[2:3]
commandsss=sys.argv[3:]
args="".join(commands)
argss="".join(commandss)
argsss="".join(commandsss)
if len(args) < 1:
print "*"*80
print " E.g:python coremail.py mail.baidu.com user pass"
print "*"*80
else:
login(args,argss,argsss)

使用方法:

python  coremail.py  mail.baidu.com  user pass

即可

(0)
Loading收藏(0)

本文由 老D博客 作者:老D 发表,转载请注明来源!

关键词:,
SS推荐

热评文章

发表评论

*