This commit is contained in:
shmilylty
2019-08-07 15:16:55 +08:00
parent 85aa7d2ec4
commit f74c45a67d
4 changed files with 13 additions and 7 deletions
-1
View File
@@ -9,7 +9,6 @@ OneForAll多进程多协程异步子域爆破模块
"""
import asyncio
import os
import queue
import secrets
import signal
+3 -1
View File
@@ -85,7 +85,9 @@ async def bulk_query_a(datas):
if not data.get('ips'):
subdomain = data.get('subdomain')
task = asyncio.ensure_future(aiodns_query_a(subdomain, semaphore))
task.add_done_callback(functools.partial(resolve_callback, index=i, datas=datas)) # 回调
task.add_done_callback(functools.partial(resolve_callback,
index=i,
datas=datas)) # 回调
tasks.append(task)
if tasks: # 任务列表里有任务不空时才进行解析
await asyncio.wait(tasks) # 等待所有task完成
+6 -3
View File
@@ -28,10 +28,12 @@ class Search(Module):
:rtype: str
"""
statements_list = []
subdomains_temp = set(map(lambda x: x + '.' + domain, config.subdomains_common))
subdomains_temp = set(map(lambda x: x + '.' + domain,
config.subdomains_common))
subdomains_temp = list(subdomain.intersection(subdomains_temp))
for i in range(0, len(subdomains_temp), 2): # 同时排除2个子域
statements_list.append(''.join(set(map(lambda s: ' -site:' + s, subdomains_temp[i:i + 2]))))
statements_list.append(''.join(set(map(lambda s: ' -site:' + s,
subdomains_temp[i:i + 2]))))
return statements_list
def match_location(self, domain, url):
@@ -45,6 +47,7 @@ class Search(Module):
:return: 匹配的子域
:rtype set
"""
resp = requests.head(url, headers=self.header, proxies=self.proxy, timeout=self.timeout, allow_redirects=False)
resp = requests.head(url, headers=self.header, proxies=self.proxy,
timeout=self.timeout, allow_redirects=False)
location = resp.headers.get('location')
return set(utils.match_subdomain(domain, location))
+4 -2
View File
@@ -20,7 +20,8 @@ def match_subdomain(domain, text, distinct=True):
:return: 匹配结果
:rtype: set or list
"""
regexp = r'(?:[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?\.){0,}' + domain.replace('.', r'\.')
regexp = r'(?:[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?\.){0,}'\
+ domain.replace('.', r'\.')
result = re.findall(regexp, text, re.I)
if not result:
return set()
@@ -48,7 +49,8 @@ def gen_fake_header():
ua = UserAgent()
ip = gen_random_ip()
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept': 'text/html,application/xhtml+xml,'
'application/xml;q=0.9,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
'Cache-Control': 'max-age=0',