-
Notifications
You must be signed in to change notification settings - Fork 2
/
结果检测.py
40 lines (34 loc) · 941 Bytes
/
结果检测.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
import os,urllib2,time
jieguo=[]
def saveListToFile(file,list):
"""
:return:
"""
s = '\n'.join(list)
with open(file,'a') as output:
output.write(s)
def zhengli():
fp=open("jieguo.txt", "r")
alllines=fp.readlines()
fp.close()
for eachline in alllines:
eachline=eachline.strip('\n')
eachline=eachline.strip(' ')
http_url=eachline
try:
req=urllib2.Request(http_url)
req.add_header('User-Agent','Mozilla/5.0')
resp = urllib2.urlopen(req, timeout=10)
qrcont=resp.read()
except Exception,e:
a = str(e)
if 'HTTP Error 500' in a:
print http_url
jieguo.append(http_url)
else:
print 'not shell'
def main():
zhengli()
saveListToFile('shell.txt',jieguo)
if __name__ == '__main__':
main()