Merge branch 'master' of https://github.com/shmilylty/OneForAll into master

This commit is contained in:
JrD
2020-09-24 11:20:27 +08:00
4 changed files with 27 additions and 21 deletions
+5 -5
View File
@@ -87,7 +87,7 @@ class Module(object):
verify=self.verify, verify=self.verify,
**kwargs) **kwargs)
except Exception as e: except Exception as e:
logger.log('ERROR', e.args) logger.log('ERROR', e.args[0])
return None return None
if not check: if not check:
return resp return resp
@@ -124,9 +124,9 @@ class Module(object):
except Exception as e: except Exception as e:
if raise_error: if raise_error:
if isinstance(e, requests.exceptions.ConnectTimeout): if isinstance(e, requests.exceptions.ConnectTimeout):
logger.log(level, e.args) logger.log(level, e.args[0])
raise e raise e
logger.log(level, e.args) logger.log(level, e.args[0])
return None return None
if not check: if not check:
return resp return resp
@@ -156,7 +156,7 @@ class Module(object):
verify=self.verify, verify=self.verify,
**kwargs) **kwargs)
except Exception as e: except Exception as e:
logger.log('ERROR', e.args) logger.log('ERROR', e.args[0])
return None return None
if not check: if not check:
return resp return resp
@@ -184,7 +184,7 @@ class Module(object):
verify=self.verify, verify=self.verify,
**kwargs) **kwargs)
except Exception as e: except Exception as e:
logger.log('ERROR', e.args) logger.log('ERROR', e.args[0])
return None return None
if not check: if not check:
return resp return resp
+11 -1
View File
@@ -2,6 +2,8 @@
"xcs", "xcs",
"via", "via",
"x-via", "x-via",
"x-cdn",
"x-cdn-forward",
"x-ser", "x-ser",
"x-cf1", "x-cf1",
"cache", "cache",
@@ -11,6 +13,7 @@
"x-hit-cache", "x-hit-cache",
"x-cache-status", "x-cache-status",
"x-cache-hits", "x-cache-hits",
"x-cache-lookup",
"cc_cache", "cc_cache",
"webcache", "webcache",
"chinacache", "chinacache",
@@ -20,14 +23,20 @@
"x-github-request-id", "x-github-request-id",
"x-sucuri-id", "x-sucuri-id",
"x-amz-cf-id", "x-amz-cf-id",
"x-airee-node",
"x-cdn-provider", "x-cdn-provider",
"x-fastly", "x-fastly",
"x-iinfo",
"x-llid",
"sozu-id",
"x-cf-tsc",
"x-ws-request-id", "x-ws-request-id",
"fss-cache", "fss-cache",
"powered-by-chinacache", "powered-by-chinacache",
"verycdn", "verycdn",
"yunjiasu", "yunjiasu",
"skyparkcdn", "skyparkcdn",
"x-beluga-cache-status",
"x-content-type-options", "x-content-type-options",
"x-download-options", "x-download-options",
"x-proxy-node", "x-proxy-node",
@@ -36,5 +45,6 @@
"etag", "etag",
"expires", "expires",
"pragma", "pragma",
"cache-control" "cache-control",
"last-modified"
] ]
+2 -2
View File
@@ -25,8 +25,8 @@ class RiskIQ(Query):
if not resp: if not resp:
return return
data = resp.json() data = resp.json()
subnames = data.get('subdomains') names = data.get('subdomains')
subdomain_str = str(set(map(lambda subname: f'{subname}.{self.domain}', subnames))) subdomain_str = str(set(map(lambda name: f'{name}.{self.domain}', names)))
self.subdomains = self.collect_subdomains(subdomain_str) self.subdomains = self.collect_subdomains(subdomain_str)
def run(self): def run(self):
+9 -13
View File
@@ -8,7 +8,6 @@ class ShodanAPI(Search):
self.domain = domain self.domain = domain
self.module = 'Search' self.module = 'Search'
self.source = 'ShodanAPISearch' self.source = 'ShodanAPISearch'
self.addr = 'https://api.shodan.io/shodan/host/search'
self.key = settings.shodan_api_key self.key = settings.shodan_api_key
def search(self): def search(self):
@@ -17,17 +16,14 @@ class ShodanAPI(Search):
""" """
self.header = self.get_header() self.header = self.get_header()
self.proxy = self.get_proxy(self.source) self.proxy = self.get_proxy(self.source)
query = 'hostname:.' + self.domain url = f'https://api.shodan.io/dns/domain/{self.domain}?key={self.key}'
page = 1 resp = self.get(url)
while True: if not resp:
params = {'key': self.key, 'page': page, 'query': query, return
'minify': True, 'facets': {'hostnames'}} data = resp.json()
resp = self.get(self.addr, params) names = data.get('subdomains')
subdomains = self.match_subdomains(resp) subdomain_str = str(set(map(lambda name: f'{name}.{self.domain}', names)))
if not subdomains: # 搜索没有发现子域名则停止搜索 self.subdomains = self.collect_subdomains(subdomain_str)
break
self.subdomains.update(subdomains)
page += 1
def run(self): def run(self):
""" """
@@ -54,4 +50,4 @@ def run(domain):
if __name__ == '__main__': if __name__ == '__main__':
run('example.com') run('freebuf.com')