修改日志输出

This commit is contained in:
shmilylty
2019-08-03 22:34:59 +08:00
parent 3635f8f0a6
commit 2f1c1fed97
6 changed files with 14 additions and 28 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ class Module(object):
""" """
输出模块开始信息 输出模块开始信息
""" """
logger.log('DEBUG', f'开始执行{self.source}模块查询{self.domain}的子域') logger.log('DEBUG', f'开始执行{self.source}模块收集{self.domain}的子域')
def finish(self): def finish(self):
""" """
@@ -49,7 +49,7 @@ class Module(object):
""" """
self.end = time.time() self.end = time.time()
self.elapsed = round(self.end - self.start, 1) self.elapsed = round(self.end - self.start, 1)
logger.log('DEBUG', f'结束执行{self.source}模块查询{self.domain}的子域') logger.log('DEBUG', f'结束执行{self.source}模块收集{self.domain}的子域')
logger.log('INFOR', f'{self.source}模块耗时{self.elapsed}秒发现子域{len(self.subdomains)}') logger.log('INFOR', f'{self.source}模块耗时{self.elapsed}秒发现子域{len(self.subdomains)}')
logger.log('DEBUG', f'{self.source}模块发现{self.domain}的子域 {self.subdomains}') logger.log('DEBUG', f'{self.source}模块发现{self.domain}的子域 {self.subdomains}')
+3 -5
View File
@@ -69,15 +69,15 @@ class CheckAXFR(Module):
""" """
类执行入口 类执行入口
""" """
self.begin()
logger.log('DEBUG', f'开始执行{self.source}检查{self.domain}的域传送漏洞') logger.log('DEBUG', f'开始执行{self.source}检查{self.domain}的域传送漏洞')
self.check() self.check()
logger.log('DEBUG', f'结束执行{self.source}检查{self.domain}的域传送漏洞')
self.save_json() self.save_json()
self.gen_result() self.gen_result()
self.save_db() self.save_db()
rx_queue.put(self.results) rx_queue.put(self.results)
logger.log('DEBUG', f'结束执行{self.source}检查{self.domain}的域传送漏洞')
self.finish()
def do(domain, rx_queue): # 统一入口名字 方便多线程调用 def do(domain, rx_queue): # 统一入口名字 方便多线程调用
@@ -88,8 +88,6 @@ def do(domain, rx_queue): # 统一入口名字 方便多线程调用
""" """
check = CheckAXFR(domain) check = CheckAXFR(domain)
check.run(rx_queue) check.run(rx_queue)
logger.log('INFOR', f'{check.source}模块耗时{check.elapsed}秒发现子域{len(check.subdomains)}')
logger.log('DEBUG', f'{check.source}模块发现的子域 {check.subdomains}')
if __name__ == '__main__': if __name__ == '__main__':
+2 -4
View File
@@ -37,15 +37,15 @@ class CheckCDX(Module):
""" """
类执行入口 类执行入口
""" """
self.begin()
logger.log('DEBUG', f'开始执行{self.source}检查{self.domain}域的crossdomain.xml') logger.log('DEBUG', f'开始执行{self.source}检查{self.domain}域的crossdomain.xml')
self.check() self.check()
self.save_json() self.save_json()
self.gen_result() self.gen_result()
self.save_db() self.save_db()
rx_queue.put(self.results) rx_queue.put(self.results)
logger.log('DEBUG', f'结束执行{self.source}检查{self.domain}域的crossdomain.xml') logger.log('DEBUG', f'结束执行{self.source}检查{self.domain}域的crossdomain.xml')
self.finish()
def do(domain, rx_queue): # 统一入口名字 方便多线程调用 def do(domain, rx_queue): # 统一入口名字 方便多线程调用
@@ -56,8 +56,6 @@ def do(domain, rx_queue): # 统一入口名字 方便多线程调用
""" """
check = CheckCDX(domain) check = CheckCDX(domain)
check.run(rx_queue) check.run(rx_queue)
logger.log('INFOR', f'{check.source}模块耗时{check.elapsed}秒发现子域{len(check.subdomains)}')
logger.log('DEBUG', f'{check.source}模块发现的子域 {check.subdomains}')
if __name__ == '__main__': if __name__ == '__main__':
+2 -5
View File
@@ -41,14 +41,13 @@ class CheckCert(Module):
类执行入口 类执行入口
""" """
logger.log('DEBUG', f'开始执行{self.source}检查{self.domain}域的证书中的子域') logger.log('DEBUG', f'开始执行{self.source}检查{self.domain}域的证书中的子域')
self.check() self.check()
logger.log('DEBUG', f'结束执行{self.source}检查{self.domain}域的证书中的子域')
self.save_json() self.save_json()
self.gen_result() self.gen_result()
self.save_db() self.save_db()
rx_queue.put(self.results) rx_queue.put(self.results)
logger.log('DEBUG', f'结束执行{self.source}检查{self.domain}域的证书中的子域')
self.finish()
def do(domain, rx_queue): # 统一入口名字 方便多线程调用 def do(domain, rx_queue): # 统一入口名字 方便多线程调用
@@ -60,8 +59,6 @@ def do(domain, rx_queue): # 统一入口名字 方便多线程调用
""" """
check = CheckCert(domain) check = CheckCert(domain)
check.run(rx_queue) check.run(rx_queue)
logger.log('INFOR', f'{check.source}模块耗时{check.elapsed}秒发现子域{len(check.subdomains)}')
logger.log('DEBUG', f'{check.source}模块发现的子域 {check.subdomains}')
if __name__ == '__main__': if __name__ == '__main__':
+3 -8
View File
@@ -3,7 +3,7 @@
检查内容安全策略收集子域名收集子域名 检查内容安全策略收集子域名收集子域名
""" """
import queue import queue
import requests
from common import utils from common import utils
from common.module import Module from common.module import Module
from config import logger from config import logger
@@ -43,14 +43,13 @@ class CheckCSP(Module):
类执行入口 类执行入口
""" """
logger.log('DEBUG', f'开始执行{self.source}检查{self.domain}域响应头中的内容安全策略字段') logger.log('DEBUG', f'开始执行{self.source}检查{self.domain}域响应头中的内容安全策略字段')
self.check() self.check()
logger.log('DEBUG', f'结束执行{self.source}检查{self.domain}域响应头中的内容安全策略字段')
self.save_json() self.save_json()
self.gen_result() self.gen_result()
self.save_db() self.save_db()
rx_queue.put(self.results) rx_queue.put(self.results)
logger.log('DEBUG', f'结束执行{self.source}检查{self.domain}域响应头中的内容安全策略字段')
self.finish()
def do(domain, rx_queue, header=None): # 统一入口名字 方便多线程调用 def do(domain, rx_queue, header=None): # 统一入口名字 方便多线程调用
@@ -63,13 +62,9 @@ def do(domain, rx_queue, header=None): # 统一入口名字 方便多线程调
""" """
check = CheckCSP(domain, header) check = CheckCSP(domain, header)
check.run(rx_queue) check.run(rx_queue)
logger.log('INFOR', f'{check.source}模块耗时{check.elapsed}秒发现子域{len(check.subdomains)}')
logger.log('DEBUG', f'{check.source}模块发现的子域 {check.subdomains}')
if __name__ == '__main__': if __name__ == '__main__':
import requests
# resp = requests.get('https://content-security-policy.com/') # resp = requests.get('https://content-security-policy.com/')
result_queue = queue.Queue() result_queue = queue.Queue()
resp = requests.get('https://www.baidu.com/') resp = requests.get('https://www.baidu.com/')
+2 -4
View File
@@ -74,15 +74,15 @@ class BruteSRV(Module):
""" """
类执行入口 类执行入口
""" """
self.begin()
logger.log('DEBUG', f'开始枚举{self.domain}域的SRV记录') logger.log('DEBUG', f'开始枚举{self.domain}域的SRV记录')
self.brute() self.brute()
self.save_json() self.save_json()
self.gen_result() self.gen_result()
self.save_db() self.save_db()
rx_queue.put(self.results) rx_queue.put(self.results)
logger.log('DEBUG', f'结束枚举{self.domain}域的SRV记录') logger.log('DEBUG', f'结束枚举{self.domain}域的SRV记录')
self.finish()
def do(domain, rx_queue): # 统一入口名字 方便多线程调用 def do(domain, rx_queue): # 统一入口名字 方便多线程调用
@@ -93,8 +93,6 @@ def do(domain, rx_queue): # 统一入口名字 方便多线程调用
""" """
brute = BruteSRV(domain) brute = BruteSRV(domain)
brute.run(rx_queue) brute.run(rx_queue)
logger.log('INFOR', f'{brute.source}模块耗时{brute.elapsed}秒发现{brute.domain}的子域{len(brute.subdomains)}')
logger.log('DEBUG', f'{brute.source}模块发现{brute.domain}的子域 {brute.subdomains}')
if __name__ == '__main__': if __name__ == '__main__':