mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 04:47:48 +08:00
修复导出问题
This commit is contained in:
@@ -165,17 +165,17 @@ def check_dpath(dpath=None):
|
||||
return dpath
|
||||
|
||||
|
||||
def check_format(format, line):
|
||||
def check_format(format, count):
|
||||
"""
|
||||
检查导出格式
|
||||
|
||||
:param format: 传入的导出格式
|
||||
:param line: 行数
|
||||
:param count: 数量
|
||||
:return: 导出格式
|
||||
"""
|
||||
formats = ['txt', 'rst', 'csv', 'tsv', 'json', 'yaml', 'html',
|
||||
'jira', 'xls', 'xlsx', 'dbf', 'latex', 'ods']
|
||||
if format == 'xls' and line > 65000:
|
||||
if format == 'xls' and count > 65000:
|
||||
logger.log('ALERT', 'xls文件限制为最多65000行')
|
||||
logger.log('ALERT', '使用xlsx格式导出')
|
||||
return 'xlsx'
|
||||
@@ -258,8 +258,7 @@ def check_value(values):
|
||||
|
||||
|
||||
def export_all(format, datas):
|
||||
line = len(datas)
|
||||
format = check_format(format, line)
|
||||
format = check_format(format, len(datas))
|
||||
dpath = check_dpath()
|
||||
timestamp = get_timestamp()
|
||||
fpath = dpath.joinpath(f'all_subdomain_{timestamp}.{format}')
|
||||
|
||||
@@ -38,8 +38,7 @@ def export(table, db=None, valid=None, dpath=None, format='csv', show=False):
|
||||
dpath = utils.check_dpath(dpath)
|
||||
database = Database(db)
|
||||
rows = database.export_data(table, valid) # 意外情况导出全部子域
|
||||
line = len(rows)
|
||||
format = utils.check_format(format, line)
|
||||
format = utils.check_format(format, len(rows))
|
||||
if show:
|
||||
print(rows.dataset)
|
||||
if format == 'txt':
|
||||
|
||||
@@ -133,9 +133,9 @@ class Takeover(Module):
|
||||
def run(self):
|
||||
start = time.time()
|
||||
logger.log('INFOR', f'开始执行{self.source}模块')
|
||||
self.format = utils.check_format(self.format)
|
||||
self.dpath = utils.check_dpath(self.dpath)
|
||||
self.subdomains = utils.get_domains(self.target)
|
||||
self.format = utils.check_format(self.format, len(self.subdomains))
|
||||
self.dpath = utils.check_dpath(self.dpath)
|
||||
if self.subdomains:
|
||||
logger.log('INFOR', f'正在检查子域接管风险')
|
||||
self.fingerprints = get_fingerprint()
|
||||
|
||||
Reference in New Issue
Block a user