From f52768632aa0f42141cdd4ffd87fbbc09a9b0c7d Mon Sep 17 00:00:00 2001 From: shmilylty Date: Fri, 16 Aug 2019 19:13:19 +0800 Subject: [PATCH] pep8 --- oneforall/modules/certificates/censys_api.py | 14 +++++++------- oneforall/modules/certificates/certdb_api.py | 6 +++--- oneforall/modules/certificates/certspotter.py | 4 ++-- oneforall/modules/certificates/crtsh.py | 4 ++-- oneforall/modules/certificates/entrust.py | 4 ++-- oneforall/modules/certificates/google.py | 4 ++-- oneforall/modules/check/axfr.py | 12 ++++++------ oneforall/modules/check/cdx.py | 1 - oneforall/modules/check/cert.py | 4 ++-- oneforall/modules/check/csp.py | 6 ++++-- oneforall/modules/crawl/archivecrawl.py | 4 ++-- oneforall/modules/crawl/commoncrawl.py | 4 ++-- oneforall/modules/datasets/binaryedge_api.py | 4 ++-- oneforall/modules/datasets/bufferover.py | 4 ++-- oneforall/modules/datasets/chinaz.py | 4 ++-- oneforall/modules/datasets/chinaz_api.py | 4 ++-- oneforall/modules/datasets/circl_api.py | 4 ++-- oneforall/modules/datasets/dnsdb.py | 8 ++++---- oneforall/modules/datasets/dnsdb_api.py | 4 ++-- oneforall/modules/datasets/dnsdumpster.py | 6 +++--- oneforall/modules/datasets/hackertarget.py | 6 +++--- oneforall/modules/datasets/ipv4info.py | 10 +++++----- oneforall/modules/datasets/netcraft.py | 6 +++--- oneforall/modules/datasets/ptrarchive.py | 6 +++--- oneforall/modules/datasets/riddler.py | 4 ++-- oneforall/modules/datasets/robtex.py | 6 +++--- oneforall/modules/datasets/securitytrails_api.py | 6 +++--- oneforall/modules/datasets/sitedossier.py | 6 +++--- oneforall/modules/datasets/threatcrowd.py | 4 ++-- oneforall/modules/dnsquery/srv.py | 6 +++--- oneforall/modules/intelligence/riskiq_api.py | 8 +++----- oneforall/modules/intelligence/threatbook_api.py | 4 ++-- oneforall/modules/intelligence/threatminer.py | 4 ++-- oneforall/modules/intelligence/virustotal.py | 12 ++++++------ oneforall/modules/intelligence/virustotal_api.py | 6 +++--- oneforall/modules/search/ask.py | 8 ++++---- oneforall/modules/search/baidu.py | 10 +++++----- oneforall/modules/search/bing.py | 8 ++++---- oneforall/modules/search/bing_api.py | 8 ++++---- oneforall/modules/search/duckduckgo.py | 8 ++++---- oneforall/modules/search/exalead.py | 8 ++++---- oneforall/modules/search/fofa_api.py | 6 +++--- oneforall/modules/search/google.py | 8 ++++---- oneforall/modules/search/google_api.py | 8 ++++---- oneforall/modules/search/shodan_api.py | 8 ++++---- oneforall/modules/search/so.py | 8 ++++---- oneforall/modules/search/sogou.py | 8 ++++---- oneforall/modules/search/yahoo.py | 8 ++++---- oneforall/modules/search/yandex.py | 8 ++++---- oneforall/modules/search/zoomeye_api.py | 12 ++++++------ 50 files changed, 161 insertions(+), 162 deletions(-) diff --git a/oneforall/modules/certificates/censys_api.py b/oneforall/modules/certificates/censys_api.py index e2f645a..5fb1b3d 100644 --- a/oneforall/modules/certificates/censys_api.py +++ b/oneforall/modules/certificates/censys_api.py @@ -29,22 +29,22 @@ class CensysAPI(Query): resp = self.post(self.addr, json=data, auth=(self.id, self.secret)) if not resp: return - resp_json = resp.json() - status = resp_json.get('status') + data = resp.json() + status = data.get('status') if status != 'ok': logger.log('ALERT', status) return - subdomains_find = self.match(self.domain, str(resp_json)) - self.subdomains = self.subdomains.union(subdomains_find) - pages = resp_json.get('metadata').get('pages') + subdomains = self.match(self.domain, str(data)) + self.subdomains = self.subdomains.union(subdomains) + pages = data.get('metadata').get('pages') for page in range(2, pages + 1): time.sleep(self.delay) data['page'] = page resp = self.post(self.addr, json=data, auth=(self.id, self.secret)) if not resp: return - subdomains_find = self.match(self.domain, str(resp.json())) - self.subdomains = self.subdomains.union(subdomains_find) + subdomains = self.match(self.domain, str(resp.json())) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/certificates/certdb_api.py b/oneforall/modules/certificates/certdb_api.py index 37e822e..e7f176c 100644 --- a/oneforall/modules/certificates/certdb_api.py +++ b/oneforall/modules/certificates/certdb_api.py @@ -29,11 +29,11 @@ class CertDBAPI(Query): if not resp: return json = resp.json() - subdomains_find = utils.match_subdomain(self.domain, str(json)) - if not subdomains_find: # 搜索没有发现子域名则停止搜索 + subdomains = utils.match_subdomain(self.domain, str(json)) + if not subdomains: # 搜索没有发现子域名则停止搜索 break # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) page_num += 1 # 默认每次查询最多返回30条 当前条数小于30条说明已经查完 if json.get('count') < 30: diff --git a/oneforall/modules/certificates/certspotter.py b/oneforall/modules/certificates/certspotter.py index 9a408da..23f3462 100644 --- a/oneforall/modules/certificates/certspotter.py +++ b/oneforall/modules/certificates/certspotter.py @@ -23,9 +23,9 @@ class CertSpotter(Query): resp = self.get(self.addr, params) if not resp: return - subdomains_find = utils.match_subdomain(self.domain, str(resp.json())) + subdomains = utils.match_subdomain(self.domain, str(resp.json())) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/certificates/crtsh.py b/oneforall/modules/certificates/crtsh.py index 8f66b74..2f2943c 100644 --- a/oneforall/modules/certificates/crtsh.py +++ b/oneforall/modules/certificates/crtsh.py @@ -22,8 +22,8 @@ class Crtsh(Query): resp = self.get(self.addr, params) if not resp: return - subdomains_find = utils.match_subdomain(self.domain, str(resp.json())) - self.subdomains = self.subdomains.union(subdomains_find) + subdomains = utils.match_subdomain(self.domain, str(resp.json())) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/certificates/entrust.py b/oneforall/modules/certificates/entrust.py index 8ca8c51..01883ae 100644 --- a/oneforall/modules/certificates/entrust.py +++ b/oneforall/modules/certificates/entrust.py @@ -23,8 +23,8 @@ class Entrust(Query): resp = self.get(self.addr, params) if not resp: return - subdomains_find = utils.match_subdomain(self.domain, str(resp.json())) - self.subdomains = self.subdomains.union(subdomains_find) + subdomains = utils.match_subdomain(self.domain, str(resp.json())) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/certificates/google.py b/oneforall/modules/certificates/google.py index f3daae1..c83c3bc 100644 --- a/oneforall/modules/certificates/google.py +++ b/oneforall/modules/certificates/google.py @@ -24,9 +24,9 @@ class Google(Query): resp = self.get(self.addr, params) if not resp: return - subdomains_find = utils.match_subdomain(self.domain, resp.text) + subdomains = utils.match_subdomain(self.domain, resp.text) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/check/axfr.py b/oneforall/modules/check/axfr.py index 0c0c793..3f20bfb 100644 --- a/oneforall/modules/check/axfr.py +++ b/oneforall/modules/check/axfr.py @@ -1,11 +1,11 @@ """ -查询域名的NS记录(域名服务器记录,记录该域名由哪台域名服务器解析),检查查出的域名服务器是否开启 -DNS域传送,如果开启且没做访问控制和身份验证便加以利用获取域名的所有记录 +查询域名的NS记录(域名服务器记录,记录该域名由哪台域名服务器解析),检查查出的域名服务器是 +否开启DNS域传送,如果开启且没做访问控制和身份验证便加以利用获取域名的所有记录。 -DNS域传送(DNS zone transfer)指的是一台备用域名服务器使用来自主域名服务器的数据刷新自己的域 -数据库,目的是为了做冗余备份,防止主域名服务器出现故障时 dns 解析不可用。 -当主服务器开启DNS域传送同时又对来请求的备用服务器未作访问控制和身份验证便可以利用此漏洞获取某个 -域的所有记录。 +DNS域传送(DNS zone transfer)指的是一台备用域名服务器使用来自主域名服务器的数据刷新自己 +的域数据库,目的是为了做冗余备份,防止主域名服务器出现故障时 dns 解析不可用。 +当主服务器开启DNS域传送同时又对来请求的备用服务器未作访问控制和身份验证便可以利用此漏洞获 +取某个域的所有记录。 """ import dns.resolver import dns.zone diff --git a/oneforall/modules/check/cdx.py b/oneforall/modules/check/cdx.py index 518c27e..4bdecdd 100644 --- a/oneforall/modules/check/cdx.py +++ b/oneforall/modules/check/cdx.py @@ -10,7 +10,6 @@ class CheckCDX(Module): """ 检查crossdomain.xml文件收集子域名 """ - def __init__(self, domain: str): Module.__init__(self) self.domain = self.register(domain) diff --git a/oneforall/modules/check/cert.py b/oneforall/modules/check/cert.py index 5f80db4..3607a4a 100644 --- a/oneforall/modules/check/cert.py +++ b/oneforall/modules/check/cert.py @@ -31,8 +31,8 @@ class CheckCert(Module): except Exception as e: logger.log('ERROR', e) return - subdomains_find = utils.match_subdomain(self.domain, str(cert_dict)) - self.subdomains = self.subdomains.union(subdomains_find) + subdomains = utils.match_subdomain(self.domain, str(cert_dict)) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/check/csp.py b/oneforall/modules/check/csp.py index 6b8c181..e8b9073 100644 --- a/oneforall/modules/check/csp.py +++ b/oneforall/modules/check/csp.py @@ -25,8 +25,10 @@ class CheckCSP(Module): 正则匹配响应头中的内容安全策略字段以发现子域名 """ if not self.header: - urls = [f'http://{self.domain}', f'https://{self.domain}', - f'http://www.{self.domain}', f'https://www.{self.domain}'] + urls = [f'http://{self.domain}', + f'https://{self.domain}', + f'http://www.{self.domain}', + f'https://www.{self.domain}'] response = None for url in urls: self.header = self.get_header() diff --git a/oneforall/modules/crawl/archivecrawl.py b/oneforall/modules/crawl/archivecrawl.py index 9f6bd46..3bf2d7f 100644 --- a/oneforall/modules/crawl/archivecrawl.py +++ b/oneforall/modules/crawl/archivecrawl.py @@ -26,10 +26,10 @@ class ArchiveCrawl(Crawl): for resp in cdx.iter(url, limit=limit): if resp.data.get('status') not in ['301', '302']: url = resp.data.get('url') - subdomains_find = self.match(self.register(domain), + subdomains = self.match(self.register(domain), url + resp.text) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/crawl/commoncrawl.py b/oneforall/modules/crawl/commoncrawl.py index bd40161..4583fa6 100644 --- a/oneforall/modules/crawl/commoncrawl.py +++ b/oneforall/modules/crawl/commoncrawl.py @@ -27,9 +27,9 @@ class CommonCrawl(Crawl): for resp in tqdm(cdx.iter(url, limit=limit), total=limit): if resp.data.get('status') not in ['301', '302']: - subdomains_find = self.match(self.register(domain), resp.text) + subdomains = self.match(self.register(domain), resp.text) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/binaryedge_api.py b/oneforall/modules/datasets/binaryedge_api.py index 91ad41a..14ea737 100644 --- a/oneforall/modules/datasets/binaryedge_api.py +++ b/oneforall/modules/datasets/binaryedge_api.py @@ -24,8 +24,8 @@ class BinaryEdgeAPI(Query): resp = self.get(url) if not resp: return - subdomains_find = self.match(self.domain, str(resp.json())) - self.subdomains = self.subdomains.union(subdomains_find) + subdomains = self.match(self.domain, str(resp.json())) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/bufferover.py b/oneforall/modules/datasets/bufferover.py index 502063b..f5f65fe 100644 --- a/oneforall/modules/datasets/bufferover.py +++ b/oneforall/modules/datasets/bufferover.py @@ -21,9 +21,9 @@ class BufferOver(Query): resp = self.get(self.addr, params) if not resp: return - subdomains_find = self.match(self.domain, resp.text) + subdomains = self.match(self.domain, resp.text) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/chinaz.py b/oneforall/modules/datasets/chinaz.py index 52447fe..8de56be 100644 --- a/oneforall/modules/datasets/chinaz.py +++ b/oneforall/modules/datasets/chinaz.py @@ -21,9 +21,9 @@ class Chinaz(Query): resp = self.get(self.addr) if not resp: return - subdomains_find = self.match(self.domain, resp.text) + subdomains = self.match(self.domain, resp.text) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/chinaz_api.py b/oneforall/modules/datasets/chinaz_api.py index bad90ab..d26541c 100644 --- a/oneforall/modules/datasets/chinaz_api.py +++ b/oneforall/modules/datasets/chinaz_api.py @@ -23,9 +23,9 @@ class ChinazAPI(Query): resp = self.get(self.addr, params) if not resp: return - subdomains_find = self.match(self.domain, str(resp.json())) + subdomains = self.match(self.domain, str(resp.json())) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/circl_api.py b/oneforall/modules/datasets/circl_api.py index 6564ccc..54c413a 100644 --- a/oneforall/modules/datasets/circl_api.py +++ b/oneforall/modules/datasets/circl_api.py @@ -23,9 +23,9 @@ class CirclAPI(Query): resp = self.get(self.addr + self.domain, auth=(self.user, self.pwd)) if not resp: return - subdomains_find = self.match(self.domain, str(resp.json())) + subdomains = self.match(self.domain, str(resp.json())) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/dnsdb.py b/oneforall/modules/datasets/dnsdb.py index 60e275b..be79806 100644 --- a/oneforall/modules/datasets/dnsdb.py +++ b/oneforall/modules/datasets/dnsdb.py @@ -54,13 +54,13 @@ class DNSdb(Query): resp = self.get(url) if not resp: return - subdomains_find = self.match(self.domain, resp.text) + subdomains = self.match(self.domain, resp.text) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) else: - subdomains_find = self.match(self.domain, resp.text) + subdomains = self.match(self.domain, resp.text) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/dnsdb_api.py b/oneforall/modules/datasets/dnsdb_api.py index 60f9f46..d76db9b 100644 --- a/oneforall/modules/datasets/dnsdb_api.py +++ b/oneforall/modules/datasets/dnsdb_api.py @@ -26,9 +26,9 @@ class DNSdbAPI(Query): if not resp: return if resp.status_code == 200: - subdomains_find = utils.match_subdomain(self.domain, resp.text) + subdomains = utils.match_subdomain(self.domain, resp.text) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/dnsdumpster.py b/oneforall/modules/datasets/dnsdumpster.py index 3f3f1b5..0f91beb 100644 --- a/oneforall/modules/datasets/dnsdumpster.py +++ b/oneforall/modules/datasets/dnsdumpster.py @@ -28,10 +28,10 @@ class DNSdumpster(Query): resp = self.post(self.addr, data) if not resp: return - subdomains_find = utils.match_subdomain(self.domain, resp.text) - if subdomains_find: + subdomains = utils.match_subdomain(self.domain, resp.text) + if subdomains: # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/hackertarget.py b/oneforall/modules/datasets/hackertarget.py index 86a4867..e25e558 100644 --- a/oneforall/modules/datasets/hackertarget.py +++ b/oneforall/modules/datasets/hackertarget.py @@ -21,10 +21,10 @@ class HackerTarget(Query): if not resp: return if resp.status_code == 200: - subdomains_find = utils.match_subdomain(self.domain, resp.text) - if subdomains_find: + subdomains = utils.match_subdomain(self.domain, resp.text) + if subdomains: # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/ipv4info.py b/oneforall/modules/datasets/ipv4info.py index 4f371f6..6cbac25 100644 --- a/oneforall/modules/datasets/ipv4info.py +++ b/oneforall/modules/datasets/ipv4info.py @@ -26,14 +26,14 @@ class IPv4InfoAPI(Query): return if resp.status_code != 200: break # 请求不正常通常网络是有问题,不再继续请求下去 - resp_json = resp.json() - subdomains_find = self.match(self.domain, str(resp_json)) - if not subdomains_find: + data = resp.json() + subdomains = self.match(self.domain, str(data)) + if not subdomains: break # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) # 不直接使用subdomains是因为可能里面会出现不符合标准的子域名 - subdomains = resp_json.get('Subdomains') + subdomains = data.get('Subdomains') if subdomains: # ipv4info子域查询接口每次最多返回300个 用来判断是否还有下一页 if len(subdomains) < 300: diff --git a/oneforall/modules/datasets/netcraft.py b/oneforall/modules/datasets/netcraft.py index 11d7123..95fbfb6 100644 --- a/oneforall/modules/datasets/netcraft.py +++ b/oneforall/modules/datasets/netcraft.py @@ -46,11 +46,11 @@ class NetCraft(Query): resp = self.get(self.addr + last, params) if not resp: return - subdomains_find = self.match(self.domain, resp.text) - if not subdomains_find: # 搜索没有发现子域名则停止搜索 + subdomains = self.match(self.domain, resp.text) + if not subdomains: # 搜索没有发现子域名则停止搜索 break # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) if 'Next page' not in resp.text: # 搜索页面没有出现下一页时停止搜索 break last = re.search(r'&last=.*' + self.domain, resp.text).group(0) diff --git a/oneforall/modules/datasets/ptrarchive.py b/oneforall/modules/datasets/ptrarchive.py index 663f853..ae10c58 100644 --- a/oneforall/modules/datasets/ptrarchive.py +++ b/oneforall/modules/datasets/ptrarchive.py @@ -25,10 +25,10 @@ class PTRArchive(Query): if not resp: return if resp.status_code == 200: - subdomains_find = utils.match_subdomain(self.domain, resp.text) - if subdomains_find: + subdomains = utils.match_subdomain(self.domain, resp.text) + if subdomains: # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/riddler.py b/oneforall/modules/datasets/riddler.py index bc065ac..fff7e50 100644 --- a/oneforall/modules/datasets/riddler.py +++ b/oneforall/modules/datasets/riddler.py @@ -21,9 +21,9 @@ class Riddler(Query): resp = self.get(self.addr, params) if not resp: return - subdomains_find = self.match(self.domain, resp.text) + subdomains = self.match(self.domain, resp.text) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/robtex.py b/oneforall/modules/datasets/robtex.py index 2fb97ae..53ae605 100644 --- a/oneforall/modules/datasets/robtex.py +++ b/oneforall/modules/datasets/robtex.py @@ -32,10 +32,10 @@ class Robtex(Query): resp = self.get(url) if not resp: return - subdomains_find = self.match(self.domain, resp.text) - if subdomains_find: + subdomains = self.match(self.domain, resp.text) + if subdomains: # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/securitytrails_api.py b/oneforall/modules/datasets/securitytrails_api.py index 6e54e22..d1e1e7b 100644 --- a/oneforall/modules/datasets/securitytrails_api.py +++ b/oneforall/modules/datasets/securitytrails_api.py @@ -26,10 +26,10 @@ class SecurityTrailsAPI(Query): if not resp: return prefixs = resp.json()['subdomains'] - subdomains_find = [f'{prefix}.{self.domain}' for prefix in prefixs] - if subdomains_find: + subdomains = [f'{prefix}.{self.domain}' for prefix in prefixs] + if subdomains: # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/datasets/sitedossier.py b/oneforall/modules/datasets/sitedossier.py index e3bc53e..87d84f0 100644 --- a/oneforall/modules/datasets/sitedossier.py +++ b/oneforall/modules/datasets/sitedossier.py @@ -26,11 +26,11 @@ class SiteDossier(Query): resp = self.get(url) if not resp: return - subdomains_find = self.match(self.domain, resp.text) - if not subdomains_find: # 搜索没有发现子域名则停止搜索 + subdomains = self.match(self.domain, resp.text) + if not subdomains: # 搜索没有发现子域名则停止搜索 break # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) # 搜索页面没有出现下一页时停止搜索 if 'Show next 100 items' not in resp.text: break diff --git a/oneforall/modules/datasets/threatcrowd.py b/oneforall/modules/datasets/threatcrowd.py index 5787ddb..63628f1 100644 --- a/oneforall/modules/datasets/threatcrowd.py +++ b/oneforall/modules/datasets/threatcrowd.py @@ -25,9 +25,9 @@ class ThreatCrowd(Query): return if not resp: return - subdomains_find = self.match(self.domain, str(resp.json())) + subdomains = self.match(self.domain, str(resp.json())) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/dnsquery/srv.py b/oneforall/modules/dnsquery/srv.py index 778b330..212b512 100644 --- a/oneforall/modules/dnsquery/srv.py +++ b/oneforall/modules/dnsquery/srv.py @@ -60,9 +60,9 @@ class BruteSRV(Module): for result in results: if result: for answer in result: - subdomain = utils.match_subdomain(self.domain, answer.host) - if subdomain: - self.subdomains = self.subdomains.union(subdomain) + subdomains = utils.match_subdomain(self.domain, answer.host) + if subdomains: + self.subdomains = self.subdomains.union(subdomains) else: logger.log('DEBUG', f'{answer.host}不是{self.domain}的子域') if not len(self.subdomains): diff --git a/oneforall/modules/intelligence/riskiq_api.py b/oneforall/modules/intelligence/riskiq_api.py index ceff0fa..7588274 100644 --- a/oneforall/modules/intelligence/riskiq_api.py +++ b/oneforall/modules/intelligence/riskiq_api.py @@ -24,11 +24,9 @@ class RiskIQ(Query): auth=(self.user, self.key)) if not resp: return - resp_json = resp.json() - subnames = resp_json.get('subdomains') - if subnames: - self.subdomains = set(map(lambda sub: f'{sub}.{self.domain}', - subnames)) + data = resp.json() + names = data.get('subdomains') + self.subdomains = set(map(lambda sub: f'{sub}.{self.domain}', names)) def run(self): """ diff --git a/oneforall/modules/intelligence/threatbook_api.py b/oneforall/modules/intelligence/threatbook_api.py index 0732309..d03c686 100644 --- a/oneforall/modules/intelligence/threatbook_api.py +++ b/oneforall/modules/intelligence/threatbook_api.py @@ -23,8 +23,8 @@ class ThreatBookAPI(Query): resp = self.post(self.addr, params) if not resp: return - subdomain_find = self.match(self.domain, str(resp.json())) - self.subdomains = self.subdomains.union(subdomain_find) + subdomains = self.match(self.domain, str(resp.json())) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/intelligence/threatminer.py b/oneforall/modules/intelligence/threatminer.py index dd53383..b729d38 100644 --- a/oneforall/modules/intelligence/threatminer.py +++ b/oneforall/modules/intelligence/threatminer.py @@ -23,9 +23,9 @@ class ThreatMiner(Query): resp = self.get(self.addr, params) if not resp: return - subdomains_find = self.match(self.domain, resp.text) + subdomains = self.match(self.domain, resp.text) # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/intelligence/virustotal.py b/oneforall/modules/intelligence/virustotal.py index 290f28c..31b3c48 100644 --- a/oneforall/modules/intelligence/virustotal.py +++ b/oneforall/modules/intelligence/virustotal.py @@ -30,19 +30,19 @@ class VirusTotal(Query): resp = self.get(url=self.addr.format(self.domain), params=params) if not resp: return - resp_json = resp.json() - subdomain_find = set() - datas = resp_json.get('data') + data = resp.json() + subdomains = set() + datas = data.get('data') if datas: for data in datas: subdomain = data.get('id') if subdomain: - subdomain_find.add(subdomain) + subdomains.add(subdomain) else: break - self.subdomains = self.subdomains.union(subdomain_find) - meta = resp_json.get('meta') + self.subdomains = self.subdomains.union(subdomains) + meta = data.get('meta') if meta: next_cursor = meta.get('cursor') else: diff --git a/oneforall/modules/intelligence/virustotal_api.py b/oneforall/modules/intelligence/virustotal_api.py index 4bda889..a421f31 100644 --- a/oneforall/modules/intelligence/virustotal_api.py +++ b/oneforall/modules/intelligence/virustotal_api.py @@ -21,9 +21,9 @@ class VirusTotalAPI(Query): resp = self.get(self.addr, params) if not resp: return - resp_json = resp.json() - subdomain_find = set(resp_json.get('subdomains')) - self.subdomains = self.subdomains.union(subdomain_find) + data = resp.json() + subdomains = set(data.get('subdomains')) + self.subdomains = self.subdomains.union(subdomains) def run(self): """ diff --git a/oneforall/modules/search/ask.py b/oneforall/modules/search/ask.py index 25e6aa0..501b6e6 100644 --- a/oneforall/modules/search/ask.py +++ b/oneforall/modules/search/ask.py @@ -30,14 +30,14 @@ class Ask(Search): resp = self.get(self.addr, params) if not resp: return - subdomain_find = self.match(domain, resp.text) - if not subdomain_find: + subdomains = self.match(domain, resp.text) + if not subdomains: break if not full_search: # 搜索中发现搜索出的结果有完全重复的结果就停止搜索 - if subdomain_find.issubset(self.subdomains): + if subdomains.issubset(self.subdomains): break - self.subdomains = self.subdomains.union(subdomain_find) + self.subdomains = self.subdomains.union(subdomains) self.page_num += 1 if '>Next<' not in resp.text: break diff --git a/oneforall/modules/search/baidu.py b/oneforall/modules/search/baidu.py index 830baca..7daea44 100644 --- a/oneforall/modules/search/baidu.py +++ b/oneforall/modules/search/baidu.py @@ -50,17 +50,17 @@ class Baidu(Search): return if len(domain) > 12: # 解决百度搜索结果中域名过长会显示不全的问题 # 获取百度跳转URL响应头的Location字段获取直链 - subdomains_find = self.redirect_match(domain, resp.text) + subdomains = self.redirect_match(domain, resp.text) else: - subdomains_find = self.match(domain, resp.text) - if not subdomains_find: # 搜索没有发现子域名则停止搜索 + subdomains = self.match(domain, resp.text) + if not subdomains: # 搜索没有发现子域名则停止搜索 break if not full_search: # 搜索中发现搜索出的结果有完全重复的结果就停止搜索 - if subdomains_find.issubset(self.subdomains): + if subdomains.issubset(self.subdomains): break # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) self.page_num += self.per_page_num # 搜索页面没有出现下一页时停止搜索 if '&pn={next_pn}&'.format(next_pn=self.page_num) not in resp.text: diff --git a/oneforall/modules/search/bing.py b/oneforall/modules/search/bing.py index c6d0ca5..a66c1b5 100644 --- a/oneforall/modules/search/bing.py +++ b/oneforall/modules/search/bing.py @@ -36,15 +36,15 @@ class Bing(Search): resp = self.get(self.addr, params) if not resp: return - subdomains_find = self.match(domain, resp.text) - if not subdomains_find: # 搜索没有发现子域名则停止搜索 + subdomains = self.match(domain, resp.text) + if not subdomains: # 搜索没有发现子域名则停止搜索 break if not full_search: # 搜索中发现搜索出的结果有完全重复的结果就停止搜索 - if subdomains_find.issubset(self.subdomains): + if subdomains.issubset(self.subdomains): break # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) # 搜索页面没有出现下一页时停止搜索 if '
1999: break diff --git a/oneforall/modules/search/fofa_api.py b/oneforall/modules/search/fofa_api.py index 6af1d4c..d4a7e1e 100644 --- a/oneforall/modules/search/fofa_api.py +++ b/oneforall/modules/search/fofa_api.py @@ -32,10 +32,10 @@ class FoFa(Search): resp = self.get(self.addr, query) if not resp: return - subdomain_find = self.match(self.domain, resp.text) - if not subdomain_find: # 搜索没有发现子域名则停止搜索 + subdomains = self.match(self.domain, resp.text) + if not subdomains: # 搜索没有发现子域名则停止搜索 break - self.subdomains = self.subdomains.union(subdomain_find) + self.subdomains = self.subdomains.union(subdomains) self.page_num += 1 def run(self): diff --git a/oneforall/modules/search/google.py b/oneforall/modules/search/google.py index 78a3cd5..0f83319 100644 --- a/oneforall/modules/search/google.py +++ b/oneforall/modules/search/google.py @@ -40,13 +40,13 @@ class Google(Search): resp = self.get(url=self.addr, params=payload) if not resp: return - subdomain_find = self.match(domain, resp.text) - if not subdomain_find: + subdomains = self.match(domain, resp.text) + if not subdomains: break if not full_search: - if subdomain_find.issubset(self.subdomains): + if subdomains.issubset(self.subdomains): break - self.subdomains = self.subdomains.union(subdomain_find) + self.subdomains = self.subdomains.union(subdomains) page_num += per_page_num if 'start=' + str(page_num) not in resp.text: break diff --git a/oneforall/modules/search/google_api.py b/oneforall/modules/search/google_api.py index c7351e9..b343670 100644 --- a/oneforall/modules/search/google_api.py +++ b/oneforall/modules/search/google_api.py @@ -35,13 +35,13 @@ class GoogleAPI(Search): resp = self.get(self.addr, params) if not resp: return - subdomain_find = self.match(domain, str(resp.json())) - if not subdomain_find: + subdomains = self.match(domain, str(resp.json())) + if not subdomains: break if not full_search: - if subdomain_find.issubset(self.subdomains): + if subdomains.issubset(self.subdomains): break - self.subdomains = self.subdomains.union(subdomain_find) + self.subdomains = self.subdomains.union(subdomains) self.page_num += self.per_page_num if self.page_num > 100: # 免费的API只能查询前100条结果 break diff --git a/oneforall/modules/search/shodan_api.py b/oneforall/modules/search/shodan_api.py index a73d98b..8d1d718 100644 --- a/oneforall/modules/search/shodan_api.py +++ b/oneforall/modules/search/shodan_api.py @@ -25,11 +25,11 @@ class ShodanAPI(Search): resp = self.get(self.addr, params) if not resp: return - subdomain_find = self.match(self.domain, resp.text) - if not subdomain_find: # 搜索没有发现子域名则停止搜索 + subdomains = self.match(self.domain, resp.text) + if not subdomains: # 搜索没有发现子域名则停止搜索 break - if subdomain_find: - self.subdomains = self.subdomains.union(subdomain_find) + if subdomains: + self.subdomains = self.subdomains.union(subdomains) page += 1 def run(self): diff --git a/oneforall/modules/search/so.py b/oneforall/modules/search/so.py index 8fae772..90e83b6 100644 --- a/oneforall/modules/search/so.py +++ b/oneforall/modules/search/so.py @@ -31,14 +31,14 @@ class So(Search): resp = self.get(url=self.addr, params=payload) if not resp: return - subdomain_find = self.match(domain, resp.text) - if not subdomain_find: + subdomains = self.match(domain, resp.text) + if not subdomains: break if not full_search: # 搜索中发现搜索出的结果有完全重复的结果就停止搜索 - if subdomain_find.issubset(self.subdomains): + if subdomains.issubset(self.subdomains): break - self.subdomains = self.subdomains.union(subdomain_find) + self.subdomains = self.subdomains.union(subdomains) page_num += 1 # 搜索页面没有出现下一页时停止搜索 if 'Next' not in resp.text: # 搜索页面没有出现下一页时停止搜索 break self.page_num += self.per_page_num diff --git a/oneforall/modules/search/yandex.py b/oneforall/modules/search/yandex.py index 27c552a..b5ddd8d 100644 --- a/oneforall/modules/search/yandex.py +++ b/oneforall/modules/search/yandex.py @@ -36,15 +36,15 @@ class Yandex(Search): resp = self.get(self.addr, params) if not resp: return - subdomains_find = self.match(domain, resp.text) - if not subdomains_find: # 搜索没有发现子域名则停止搜索 + subdomains = self.match(domain, resp.text) + if not subdomains: # 搜索没有发现子域名则停止搜索 break if not full_search: # 搜索中发现搜索出的结果有完全重复的结果就停止搜索 - if subdomains_find.issubset(self.subdomains): + if subdomains.issubset(self.subdomains): break # 合并搜索子域名搜索结果 - self.subdomains = self.subdomains.union(subdomains_find) + self.subdomains = self.subdomains.union(subdomains) if '>next' not in resp.text: # 搜索页面没有出现下一页时停止搜索 break self.page_num += 1 diff --git a/oneforall/modules/search/zoomeye_api.py b/oneforall/modules/search/zoomeye_api.py index ea9aa1d..06eaf14 100644 --- a/oneforall/modules/search/zoomeye_api.py +++ b/oneforall/modules/search/zoomeye_api.py @@ -25,12 +25,12 @@ class ZoomEyeAPI(Search): if not resp: logger.log('FETAL', f'登录失败无法获取{self.source}的访问token') return - resp_json = resp.json() + data = resp.json() if resp.status_code == 200: logger.log('DEBUG', f'{self.source}模块登录成功') - return resp_json.get('access_token') + return data.get('access_token') else: - logger.log('ALERT', resp_json.get('message')) + logger.log('ALERT', data.get('message')) exit(1) def search(self): @@ -48,10 +48,10 @@ class ZoomEyeAPI(Search): resp = self.get(self.addr, params) if not resp: return - subdomain_find = self.match(self.domain, resp.text) - if not subdomain_find: # 搜索没有发现子域名则停止搜索 + subdomains = self.match(self.domain, resp.text) + if not subdomains: # 搜索没有发现子域名则停止搜索 break - self.subdomains = self.subdomains.union(subdomain_find) + self.subdomains = self.subdomains.union(subdomains) page_num += 1 if page_num > 500: break