mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 12:57:50 +08:00
优化cdx和csp模块,这两个模块默认使用代理。
This commit is contained in:
+2
-2
@@ -37,8 +37,8 @@ ips_appear_maximum = 10 # 同一IP集合出现次数超过10认为是泛解析
|
|||||||
# 代理设置
|
# 代理设置
|
||||||
enable_proxy = True # 是否使用代理 全局开关
|
enable_proxy = True # 是否使用代理 全局开关
|
||||||
proxy_all_module = False # 代理所有模块
|
proxy_all_module = False # 代理所有模块
|
||||||
proxy_partial_module = ['GoogleQuery', 'AskSearch', 'DuckDuckGoSearch', 'GoogleAPISearch',
|
proxy_partial_module = ['GoogleQuery', 'AskSearch', 'DuckDuckGoSearch', 'GoogleAPISearch', 'GoogleSearch',
|
||||||
'GoogleSearch', 'YahooSearch', 'YandexSearch'] # 代理自定义的模块
|
'YahooSearch', 'YandexSearch', 'CrossDomainXml', 'ContentSecurityPolicy'] # 代理自定义的模块
|
||||||
proxy_pool = [{'http': 'http://127.0.0.1:1080', 'https': 'https://127.0.0.1:1080'}] # 代理池
|
proxy_pool = [{'http': 'http://127.0.0.1:1080', 'https': 'https://127.0.0.1:1080'}] # 代理池
|
||||||
# proxy_pool = [{'http': 'socks5://127.0.0.1:10808', 'https': 'socks5://127.0.0.1:10808'}] # 代理池
|
# proxy_pool = [{'http': 'socks5://127.0.0.1:10808', 'https': 'socks5://127.0.0.1:10808'}] # 代理池
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,18 @@ class CheckCDX(Module):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
url = f'http://{self.domain}/crossdomain.xml'
|
url = f'http://{self.domain}/crossdomain.xml'
|
||||||
|
urls = [f'http://{self.domain}/crossdomain.xml', f'https://{self.domain}/crossdomain.xml',
|
||||||
|
f'http://www.{self.domain}/crossdomain.xml', f'https://www.{self.domain}/crossdomain.xml']
|
||||||
|
response = None
|
||||||
|
for url in urls:
|
||||||
self.header = self.get_header()
|
self.header = self.get_header()
|
||||||
self.proxy = self.get_proxy(self.source)
|
self.proxy = self.get_proxy(self.source)
|
||||||
resp = self.get(url)
|
response = self.get(url)
|
||||||
if not resp:
|
if response:
|
||||||
|
break
|
||||||
|
if not response:
|
||||||
return
|
return
|
||||||
self.subdomains = match_subdomain(self.domain, resp.text)
|
self.subdomains = match_subdomain(self.domain, response.text)
|
||||||
|
|
||||||
def run(self, rx_queue):
|
def run(self, rx_queue):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class CheckCSP(Module):
|
|||||||
Module.__init__(self)
|
Module.__init__(self)
|
||||||
self.domain = self.register(domain)
|
self.domain = self.register(domain)
|
||||||
self.module = 'Check'
|
self.module = 'Check'
|
||||||
self.source = 'Content-Security-Policy'
|
self.source = 'ContentSecurityPolicy'
|
||||||
self.header = header
|
self.header = header
|
||||||
|
|
||||||
def check(self):
|
def check(self):
|
||||||
@@ -26,11 +26,18 @@ class CheckCSP(Module):
|
|||||||
正则匹配响应头中的内容安全策略字段以发现子域名
|
正则匹配响应头中的内容安全策略字段以发现子域名
|
||||||
"""
|
"""
|
||||||
if not self.header:
|
if not self.header:
|
||||||
url = f'http://www.{self.domain}'
|
urls = [f'http://{self.domain}', f'https://{self.domain}',
|
||||||
resp = self.get(url)
|
f'http://www.{self.domain}', f'https://www.{self.domain}']
|
||||||
if not resp:
|
response = None
|
||||||
|
for url in urls:
|
||||||
|
self.header = self.get_header()
|
||||||
|
self.proxy = self.get_proxy(self.source)
|
||||||
|
response = self.get(url)
|
||||||
|
if response:
|
||||||
|
break
|
||||||
|
if not response:
|
||||||
return
|
return
|
||||||
self.header = resp.headers
|
self.header = response.headers
|
||||||
csp = self.header.get('Content-Security-Policy')
|
csp = self.header.get('Content-Security-Policy')
|
||||||
if not csp:
|
if not csp:
|
||||||
logger.log('DEBUG', f'{self.domain}域的响应头不存在内容安全策略字段')
|
logger.log('DEBUG', f'{self.domain}域的响应头不存在内容安全策略字段')
|
||||||
|
|||||||
Reference in New Issue
Block a user