根据GitHub开源项目二改,原项目地址:https://github.com/sry309/ihoneyBakFileScan.git

二改后速度更快一些,出货率在百分之一点五左右,扫描一万条域名可出150条备份泄露,一晚上能扫描12万域名,具体代码如下:

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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import logging
import socket
import threading
from binascii import b2a_hex
from concurrent.futures import ThreadPoolExecutor, wait, ALL_COMPLETED, FIRST_COMPLETED
from urllib.parse import urlparse
from datetime import datetime

import requests as requests
import inspect
import ctypes
def _async_raise(tid, exctype):
"""raises the exception, performs cleanup if needed"""
tid = ctypes.c_long(tid)
if not inspect.isclass(exctype):
exctype = type(exctype)
res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype))
if res == 0:
raise ValueError("invalid thread id")
elif res != 1:
# """if it returns a number greater than one, you're in trouble,
# and you should call it again with exc=NULL to revert the effect"""
ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None)
raise SystemError("PyThreadState_SetAsyncExc failed")
def stop_thread(thread):
_async_raise(thread.ident, SystemExit)

requests.packages.urllib3.disable_warnings()


import requests
def getIP(domain):
myaddr = socket.getaddrinfo(domain, 'http')
return myaddr[0][4][0]

def vlun(urltarget, df,req):
mu=urltarget
try:
try:
r = req.head(url=mu, headers=headers, timeout=timeout, allow_redirects=False, stream=True, verify=False)
except Exception as e:
return 1
content = b2a_hex(r.raw.read(10)).decode()
print(r.status_code)
rarsize = int(r.headers.get('Content-Length'))
r.close()
if rarsize >= 1024000000:
unit = int(rarsize) // 1024
rarsize = str(unit) + 'G'
rarsize2 = unit
elif rarsize >= 1024000:
unit = int(rarsize) // 1024
rarsize = str(unit) + 'M'
rarsize2 = unit
else:
unit = int(rarsize) // 1024
rarsize = str(unit) + 'K'
rarsize2 = unit
if rarsize2 > 100:
logging.warning('[*] {} size:{}'.format(urltarget, rarsize))
with open(df, 'a') as f:
try:
if (rarsize2 > 5000):
f.write(str(mu) + '\n')
return "1"
except:
pass
else:
pass

except Exception as e:
pass




def list_of_groups(init_list, childern_list_len):
list_of_groups = zip(*(iter(init_list),) *childern_list_len)
end_list = [list(i) for i in list_of_groups]
count = len(init_list) % childern_list_len
end_list.append(init_list[-count:]) if count !=0 else end_list
return end_list
def urlcheck(target=None, ulist=None):
if target is not None and ulist is not None:
if target.startswith('http://') or target.startswith('https://'):
if target.endswith('/'):
ulist.append(target)
else:
ulist.append(target + '/')
else:
line = 'http://' + target
try:
f1 = requests.head(line, timeout=5)
if ('301' in str(f1.status_code)):
line = 'https://' + target
except Exception as e:
print(e)


if line.endswith('/'):
ulist.append(line)
else:
ulist.append(line + '/')
return ulist

def a(u):
# ucp = u.strip('https://').strip('http://')
if u.startswith('http://'):
ucp = u.lstrip('http://')
elif u.startswith('https://'):
ucp = u.lstrip('https://')

if '/' in ucp:
ucp = ucp.split('/')[0]
if ':' in ucp:
cport = ucp.split(':')[1]
ucp = ucp.split(':')[0]
www1 = ucp.split('.')
else:
www1 = ucp.split('.')
wwwlen = len(www1)
wwwhost = ''
for i in range(1, wwwlen):
wwwhost += www1[i]

current_info_dic = [] # deep copy
suffixFormat = ['rar', 'zip', 'gz', 'tar.gz']
domainDic = [ucp + '.', ucp.replace('.', '') + '.', 'wz.', 'sql.', 'wwwroot.', 'index.', 'old.', 'web.',
'database.', 'upload.', 'website.', 'wangzhan.',
'package.', 'test.', 'bin.', 'ftp.', 'output.', 'config.', '网站备份.', '网站.', '数据库.', '数据库备份.', 'sjk.',
'shujuku.',
'backup.', 'faisunzip.',
'1.',
'2.',
'3.',
'4.',
'5.',
'6.',
'7.',
'8.',
'9.',
'666.',
'777.',
'888.',
'999.',
'234.',
'555.',
'333.',
'444.',
'admin.', 'db.', 'test.', '123.', 'admin.', 'root.', 'data.', '666.',
'111.', 'beifen.',
'b.', 'template.', 'install.', 'core.', 'about.', 'cache.', 'download.',
'runtime.', 'a.', 'img.', 'include.',
'000.', '00.', '0.', '012.',
'application.', 'server', 'extend.', 'vendor.', 'app.', 'public.'
'bf.', wwwhost + '.',
ucp.split('.', 1)[-1] + '.', www1[0] + '.', www1[1] + '.']

for s in suffixFormat:
for d in domainDic:
current_info_dic.extend([d + s])
req = requests.session()
for info in current_info_dic:
url = str(u) + str(info)
print(url)
abn=vlun(url,datefile,req)
if(abn==1):
return

req.close()
return



datefile = datetime.now().strftime('%Y%m%d_%H-%M-%S.txt')
headers = {}
timeout = 5
urllist=[]
with open('url.txt',encoding='utf-8') as f:
hj=f.readlines()
for kkl2 in hj:
c=kkl2.strip()
if c.startswith("http"):
pass
else:
c = "http://" + c
urllist.append(c+"/")
print(len(urllist))
urllist = filter(None,urllist)
pool = ThreadPoolExecutor(max_workers=800)
all_task = [pool.submit(a, (u)) for u in urllist]
wait(all_task, return_when=ALL_COMPLETED)

使用方式: 在同目录把域名保存为 url.txt 运行即可。