mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 04:47:48 +08:00
实现配置文件插拔式设计
This commit is contained in:
+6
-6
@@ -4,7 +4,7 @@ import importlib
|
||||
|
||||
import dbexport
|
||||
from config.log import logger
|
||||
from config import setting
|
||||
from config import settings
|
||||
from common import utils
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class Collect(object):
|
||||
"""
|
||||
Get modules
|
||||
"""
|
||||
if setting.enable_all_module:
|
||||
if settings.enable_all_module:
|
||||
# modules = ['brute', 'certificates', 'crawl',
|
||||
# 'datasets', 'intelligence', 'search']
|
||||
# The crawl module has some problems
|
||||
@@ -34,13 +34,13 @@ class Collect(object):
|
||||
'dnsquery', 'intelligence', 'search']
|
||||
# modules = ['certificates']
|
||||
for module in modules:
|
||||
module_path = setting.module_dir.joinpath(module)
|
||||
module_path = settings.module_dir.joinpath(module)
|
||||
for path in module_path.rglob('*.py'):
|
||||
# Classes to be imported
|
||||
import_module = ('modules.' + module, path.stem)
|
||||
self.modules.append(import_module)
|
||||
else:
|
||||
self.modules = setting.enable_partial_module
|
||||
self.modules = settings.enable_partial_module
|
||||
|
||||
def import_func(self):
|
||||
"""
|
||||
@@ -76,7 +76,7 @@ class Collect(object):
|
||||
for thread in threads:
|
||||
# 挨个线程判断超时 最坏情况主线程阻塞时间=线程数*module_thread_timeout
|
||||
# 超时线程将脱离主线程 由于创建线程时已添加守护属于 所有超时线程会随着主线程结束
|
||||
thread.join(setting.module_thread_timeout)
|
||||
thread.join(settings.module_thread_timeout)
|
||||
|
||||
for thread in threads:
|
||||
if thread.is_alive():
|
||||
@@ -86,7 +86,7 @@ class Collect(object):
|
||||
if self.export:
|
||||
if not self.path:
|
||||
name = f'{self.domain}.{self.format}'
|
||||
self.path = setting.result_save_dir.joinpath(name)
|
||||
self.path = settings.result_save_dir.joinpath(name)
|
||||
dbexport.export(self.domain, path=self.path, format=self.format)
|
||||
end = time.time()
|
||||
self.elapse = round(end - start, 1)
|
||||
|
||||
Reference in New Issue
Block a user