优化常规检查模块

This commit is contained in:
Jing Ling
2020-08-22 01:05:23 +08:00
parent 9847ca6ecc
commit b4ea31561f
8 changed files with 54 additions and 55 deletions
+5 -12
View File
@@ -1,15 +1,15 @@
"""
检查内容安全策略收集子域名收集子域名
"""
from common.module import Module
from common.check import Check
class CheckRobots(Module):
class CheckRobots(Check):
"""
检查robots.txt收集子域名
"""
def __init__(self, domain):
Module.__init__(self)
Check.__init__(self)
self.domain = domain
self.module = 'Check'
self.source = 'Robots'
@@ -18,15 +18,8 @@ class CheckRobots(Module):
"""
正则匹配域名的robots.txt文件中的子域
"""
urls = [f'http://{self.domain}/robots.txt',
f'https://{self.domain}/robots.txt',
f'http://www.{self.domain}/robots.txt',
f'https://www.{self.domain}/robots.txt']
for url in urls:
self.header = self.get_header()
self.proxy = self.get_proxy(self.source)
resp = self.get(url, check=False, allow_redirects=False)
self.subdomains = self.collect_subdomains(resp)
filenames = {'robots.txt'}
self.to_check(filenames)
def run(self):
"""