mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 12:57:50 +08:00
pep6
This commit is contained in:
@@ -9,7 +9,6 @@ OneForAll多进程多协程异步子域爆破模块
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import os
|
|
||||||
import queue
|
import queue
|
||||||
import secrets
|
import secrets
|
||||||
import signal
|
import signal
|
||||||
|
|||||||
@@ -85,7 +85,9 @@ async def bulk_query_a(datas):
|
|||||||
if not data.get('ips'):
|
if not data.get('ips'):
|
||||||
subdomain = data.get('subdomain')
|
subdomain = data.get('subdomain')
|
||||||
task = asyncio.ensure_future(aiodns_query_a(subdomain, semaphore))
|
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)
|
tasks.append(task)
|
||||||
if tasks: # 任务列表里有任务不空时才进行解析
|
if tasks: # 任务列表里有任务不空时才进行解析
|
||||||
await asyncio.wait(tasks) # 等待所有task完成
|
await asyncio.wait(tasks) # 等待所有task完成
|
||||||
|
|||||||
@@ -28,10 +28,12 @@ class Search(Module):
|
|||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
statements_list = []
|
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))
|
subdomains_temp = list(subdomain.intersection(subdomains_temp))
|
||||||
for i in range(0, len(subdomains_temp), 2): # 同时排除2个子域
|
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
|
return statements_list
|
||||||
|
|
||||||
def match_location(self, domain, url):
|
def match_location(self, domain, url):
|
||||||
@@ -45,6 +47,7 @@ class Search(Module):
|
|||||||
:return: 匹配的子域
|
:return: 匹配的子域
|
||||||
:rtype set
|
: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')
|
location = resp.headers.get('location')
|
||||||
return set(utils.match_subdomain(domain, location))
|
return set(utils.match_subdomain(domain, location))
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ def match_subdomain(domain, text, distinct=True):
|
|||||||
:return: 匹配结果
|
:return: 匹配结果
|
||||||
:rtype: set or list
|
: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)
|
result = re.findall(regexp, text, re.I)
|
||||||
if not result:
|
if not result:
|
||||||
return set()
|
return set()
|
||||||
@@ -48,7 +49,8 @@ def gen_fake_header():
|
|||||||
ua = UserAgent()
|
ua = UserAgent()
|
||||||
ip = gen_random_ip()
|
ip = gen_random_ip()
|
||||||
headers = {
|
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-Encoding': 'gzip, deflate, br',
|
||||||
'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
|
'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
|
||||||
'Cache-Control': 'max-age=0',
|
'Cache-Control': 'max-age=0',
|
||||||
|
|||||||
Reference in New Issue
Block a user