修复路径问题和解包错误问题

This commit is contained in:
Jing Ling
2020-02-10 21:59:47 +08:00
parent 38c4de6896
commit 135fce0993
4 changed files with 34 additions and 30 deletions
+6 -6
View File
@@ -169,7 +169,7 @@ class AIOBrute(Module):
参数valid可选值1,0,None,分别表示导出有效,无效,全部子域
参数format可选格式有'txt', 'rst', 'csv', 'tsv', 'json', 'yaml', 'html',
'jira', 'xls', 'xlsx', 'dbf', 'latex', 'ods'
参数pathNone会根据format参数和域名名称在项目结果目录生成相应文件
参数path默认None使用OneForAll结果目录生成路径
:param str target: 单个域名或者每行一个域名的文件路径
:param int process: 爆破的进程数(默认CPU核心数)
@@ -323,9 +323,9 @@ class AIOBrute(Module):
rx_queue))
# 队列不空就一直取数据存数据库
while not rx_queue.empty():
source, results = rx_queue.get()
results = rx_queue.get()
# 将结果存入数据库中
db.save_db(self.domain, results, source)
db.save_db(self.domain, results, self.source)
end = time.time()
self.elapsed = round(end - start, 1)
@@ -335,14 +335,14 @@ class AIOBrute(Module):
f'发现{self.domain}的域名{length}')
logger.log('DEBUG', f'{self.source}模块发现{self.domain}的域名:\n'
f'{self.subdomains}')
# 数据库导出
if self.export:
if not self.path:
name = f'{self.domain}_brute.{self.format}'
self.path = config.result_save_path.joinpath(name)
# 数据库导出
if self.export:
dbexport.export(self.domain,
valid=self.valid,
dpath=self.path,
path=self.path,
format=self.format,
show=self.show)
+17 -14
View File
@@ -147,29 +147,32 @@ def get_semaphore():
return 800
def check_dpath(dpath=None):
def check_path(path, table, format):
"""
检查结果输出目录路径
:param dpath: 传入的目录路径
:param path: 保存路径
:param table: 导出表名
:param format: 保存格式
:return: 目录路径
"""
if dpath is None:
return config.result_save_path
default_path = config.result_save_path.joinpath(f'{table}.{format}')
try:
path = Path(dpath)
path = Path(path)
except Exception as e:
logger.log('ERROR', e.args)
path = config.result_save_path
path = default_path
else:
if not path.is_dir():
logger.log('ERROR', f'{path}不是目录')
path = config.result_save_path
if not path.exists():
logger.log('ALERT', f'不存在{path}将会新建此目录')
path.mkdir(parents=True, exist_ok=True)
if path.resolve() == config.result_save_path:
logger.log('ALERT', f'使用默认结果输出目录{path}')
if path.exists():
logger.log('ALERT', f'存在{path}路径将会覆盖')
parent_path = path.parent
if not parent_path.exists():
logger.log('ALERT', f'不存在{parent_path}目录将会新建')
parent_path.mkdir(parents=True, exist_ok=True)
if not path:
path = default_path
if path.resolve() == default_path:
logger.log('DEBUG', f'使用路径{path}')
return path
+6 -4
View File
@@ -10,7 +10,8 @@ import urllib3
from loguru import logger
# 版本信息
oneforall_version = 'v0.0.8#dev' # OneForAll处于开发中,会进行版本快速迭代,请每次在使用前进行更新!
# OneForAll处于开发中,会进行版本快速迭代,请每次在使用前进行更新!
oneforall_version = 'v0.0.8#dev'
# 路径设置
oneforall_relpath = pathlib.Path(__file__).parent # oneforall代码相对路径
@@ -64,7 +65,8 @@ enable_fake_header = True # 启用伪造请求头
request_delay = 1 # 请求时延
request_timeout = 30 # 请求超时
request_verify = False # 请求SSL验证
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # 禁用安全警告信息
# 禁用安全警告信息
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# 搜索模块设置
enable_recursive_search = False # 递归搜索子域
@@ -112,10 +114,10 @@ get_redirects = True # 允许请求跳转
fake_header = True # 使用伪造请求头
# 限制同一时间打开的连接总数
limit_open_conn = 500 # 默认500
limit_open_conn = 30 # 默认30
# 限制同一时间在同一个端点((host, port, is_ssl) 3者都一样的情况)打开的连接数
limit_per_host = 50 # 0表示不限制
limit_per_host = 0 # 0表示不限制
subdomains_common = {'i', 'w', 'm', 'en', 'us', 'zh', 'w3', 'app', 'bbs',
'web', 'www', 'job', 'docs', 'news', 'blog', 'data',
+4 -5
View File
@@ -25,20 +25,20 @@ def export(table, db=None, valid=None, path=None, format='csv', show=False):
参数port可选值有'small', 'medium', 'large', 'xlarge',详见config.py配置
参数format可选格式有'txt', 'rst', 'csv', 'tsv', 'json', 'yaml', 'html',
'jira', 'xls', 'xlsx', 'dbf', 'latex', 'ods'
参数dpathNone默认使用OneForAll结果目录
参数path默认None使用OneForAll结果目录生成路径
:param str table: 要导出的表
:param str db: 要导出的数据库路径(默认为results/result.sqlite3)
:param int valid: 导出子域的有效性(默认None)
:param str format: 导出格式(默认csv)
:param str path: 导出目录(默认None)
:param str path: 导出路径(默认None)
:param bool show: 终端显示导出数据(默认False)
"""
dir_path = utils.check_dpath(path)
database = Database(db)
rows = database.export_data(table, valid)
format = utils.check_format(format, len(rows))
path = utils.check_path(path, table, format)
if show:
print(rows.dataset)
if format == 'txt':
@@ -46,8 +46,7 @@ def export(table, db=None, valid=None, path=None, format='csv', show=False):
else:
data = rows.export(format)
database.close()
file_path = dir_path.joinpath(f'{table}.{format}')
utils.save_data(file_path, data)
utils.save_data(path, data)
if __name__ == '__main__':