-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgetInfo.py
75 lines (67 loc) · 1.78 KB
/
getInfo.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/python
# -*- coding: utf-8 -*-
from queue import Queue
import threading
import requests
import sys
ThinkPHP = set()
q = Queue()
'''
从目标文件中读取指定条数的链接
'''
def load_file(fileName,start,nums):
#target = set()
with open(fileName,'r') as f:
a = f.readlines()
for i in range(start,nums):
#target.add(i.strip('\n'))
q.put(a[i].strip('\n'))
#return target
'''
从目标链接中选择PHP
'''
def get_php(target):
try:
res = requests.get(target,timeout=1)
origin = len(res.text)
except:
return
if 'X-Powered-By' in res.headers:
if 'PHP' in res.headers['X-Powered-By']:
print('[PHP]PHP Find... '+target)
if 'ThinkPHP' in res.headers['X-Powered-By']:
print('[PHP]ThinkPHP Find... '+target)
return 1
else:
try:
res = requests.get(target+'/index.php',timeout=1,allow_redirects=False)
now = len(res.text)
except:
return
if res.status_code == 200 and (now+100)>=origin:
print('[PHP]PHP Find... '+target)
'''
开始扫描
'''
def scan_thread():
while not q.empty():
target = q.get()
if get_php(target):
ThinkPHP.add(target)
#if get_php(target):
#info_scan(target)
'''
get infosec
def info_scan(target):
try:
res = requests.get(target+'/robots.txt',timeout=1)
except:
return
if res.status_code == 200 and 'User-agent' in res.text:
print('[INFO]robots find...,'+target+'robots.txt')
'''
if __name__ == '__main__':
target = load_file('butian.txt',450,500)
for i in range(20):
t1 = threading.Thread(target=scan_thread)
t1.start()