From 51c42f29583d8b1c2b471feaf53ac50bf083eb9a Mon Sep 17 00:00:00 2001 From: shmilylty Date: Wed, 14 Aug 2019 03:22:00 +0800 Subject: [PATCH] pep8 --- oneforall/aiobrute.py | 14 +++++++------- oneforall/config.py | 2 +- oneforall/dbexport.py | 10 +++++----- oneforall/oneforall.py | 14 ++++++++------ 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/oneforall/aiobrute.py b/oneforall/aiobrute.py index 0b9a4c2..a1de0c9 100644 --- a/oneforall/aiobrute.py +++ b/oneforall/aiobrute.py @@ -132,9 +132,9 @@ class AIOBrute(Module): OneForAll多进程多协程异步子域爆破模块 Example: - python3 aiobrute.py --target example.com run + python3 aiobrute.py --target domain.com run python3 aiobrute.py --target ./domains.txt run - python3 aiobrute.py --target example.com --processes 4 --coroutine 64 + python3 aiobrute.py --target example.com --process 4 --coroutine 64 run python3 aiobrute.py --target example.com --wordlist subdomains.txt run python3 aiobrute.py --target example.com --recursive True --depth 2 run python3 aiobrute.py --target m.{fuzz}.a.bz --fuzz True --rule [a-z] run @@ -149,7 +149,7 @@ class AIOBrute(Module): 参数path为None会根据format参数和域名名称在项目结果目录生成相应文件 :param str target: 单个域名或者每行一个域名的文件路径 - :param int processes: 爆破的进程数(默认CPU核心数) + :param int process: 爆破的进程数(默认CPU核心数) :param int coroutine: 每个爆破进程下的协程数(默认64) :param str wordlist: 指定爆破所使用的字典路径(默认使用config.py配置) :param int segment: 爆破任务分割(默认500) @@ -165,7 +165,7 @@ class AIOBrute(Module): :param bool show: 终端显示导出数据(默认False) """ - def __init__(self, target, processes=None, coroutine=64, wordlist=None, + def __init__(self, target, process=None, coroutine=64, wordlist=None, segment=500, recursive=False, depth=2, namelist=None, fuzz=False, rule=None, export=True, valid=None, format='xlsx', path=None, show=False): @@ -175,7 +175,7 @@ class AIOBrute(Module): self.module = 'Brute' self.source = 'AIOBrute' self.target = target - self.processes = processes or config.brute_processes_num + self.process = process or config.brute_process_num self.coroutine = coroutine or config.brute_coroutine_num self.wordlist = wordlist or config.brute_wordlist_path self.segment = segment or config.brute_task_segment @@ -242,7 +242,7 @@ class AIOBrute(Module): logger.log('INFOR', f'正在爆破{domain}的域名') for task in tqdm.tqdm(tasks, desc='Progress', smoothing=1.0, ncols=True): - async with aiomp.Pool(processes=self.processes, + async with aiomp.Pool(processes=self.process, initializer=init_worker, childconcurrency=self.coroutine) as pool: try: @@ -269,7 +269,7 @@ class AIOBrute(Module): if not rx_queue: rx_queue = queue.Queue() logger.log('INFOR', f'开始执行{self.source}模块爆破域名{self.domain}') - logger.log('INFOR', f'使用{self.processes}进程乘{self.coroutine}协程') + logger.log('INFOR', f'使用{self.process}进程乘{self.coroutine}协程') # fuzz模式不使用递归爆破 if self.recursive_brute and not self.fuzz: logger.log('INFOR', f'开始递归爆破{self.domain}的第1层子域') diff --git a/oneforall/config.py b/oneforall/config.py index 0641f28..d5b6191 100644 --- a/oneforall/config.py +++ b/oneforall/config.py @@ -28,7 +28,7 @@ enable_brute_module = False # 使用爆破模块(默认禁用) enable_verify_subdomain = True # 验证子域有效性(默认True) enable_wildcard_check = True # 开启泛解析检测 会去掉泛解析的子域 # 爆破时使用的进程数(根据系统中CPU数量情况设置 不宜大于CPU数量 默认为系统中的CPU数量) -brute_processes_num = os.cpu_count() +brute_process_num = os.cpu_count() brute_coroutine_num = 128 # 爆破时每个进程下的协程数(不宜大于1000) # 爆破所使用的字典路径 默认data/subdomains.txt brute_wordlist_path = data_storage_path.joinpath('subdomains.txt') diff --git a/oneforall/dbexport.py b/oneforall/dbexport.py index 55a2709..8ba4414 100644 --- a/oneforall/dbexport.py +++ b/oneforall/dbexport.py @@ -18,13 +18,13 @@ def export(table, db=None, valid=None, path=None, format='xlsx', show=False): OneForAll数据库导出模块 Example: - python dbexport.py --table name --format csv --path= ./result.csv - python dbexport.py --db result.db --table name --show False + python3 dbexport.py --table name --format csv --path= ./result.csv + python3 dbexport.py --db result.db --table name --show False Note: - 参数valid可选值1,0,None,分别表示导出有效,无效,全部子域 - 参数format可选格式:'csv', 'tsv', 'json', 'yaml', 'html', 'jira', - 'xls', 'xlsx', 'dbf', 'latex', 'ods' + 参数port可选值有'small', 'medium', 'large', 'xlarge',详见config.py配置 + 参数format可选格式有'csv', 'tsv', 'json', 'yaml', 'html', 'xls', 'xlsx', + 'dbf', 'latex', 'ods' 参数path为None会根据format参数和域名名称在项目结果目录生成相应文件 :param str table: 要导出的表 diff --git a/oneforall/oneforall.py b/oneforall/oneforall.py index 0d7ec07..851b59f 100644 --- a/oneforall/oneforall.py +++ b/oneforall/oneforall.py @@ -45,12 +45,14 @@ class OneForAll(object): Project: https://git.io/fjHT1 Example: - python oneforall.py --target example.com run - python oneforall.py --target ./domains.txt run - python oneforall.py --target example.com --valid None run - python oneforall.py --target example.com --brute True --port medium run - python oneforall.py --target example.com --format csv --path result.csv - python oneforall.py --target example.com --verify False --show True run + python3 oneforall.py --target example.com run + python3 oneforall.py --target ./domains.txt run + python3 oneforall.py --target example.com --valid None run + python3 oneforall.py --target example.com --brute True run + python3 oneforall.py --target example.com --port medium run + python3 oneforall.py --target example.com --format csv run + python3 oneforall.py --target example.com --verify False run + python3 oneforall.py --target example.com --show True run Note: 参数valid可选值1,0,None分别表示导出有效,无效,全部子域