mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 04:47:48 +08:00
去掉守护
This commit is contained in:
+3
-25
@@ -2,33 +2,22 @@ import time
|
|||||||
import threading
|
import threading
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
import dbexport
|
|
||||||
from config.log import logger
|
from config.log import logger
|
||||||
from config import settings
|
from config import settings
|
||||||
from common import utils
|
from common import utils
|
||||||
|
|
||||||
|
|
||||||
class Collect(object):
|
class Collect(object):
|
||||||
"""
|
def __init__(self, domain):
|
||||||
Collect subdomains
|
self.domain = domain
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, domain, export=True):
|
|
||||||
self.domain = utils.get_main_domain(domain)
|
|
||||||
self.elapse = 0.0
|
|
||||||
self.modules = []
|
self.modules = []
|
||||||
self.collect_funcs = []
|
self.collect_funcs = []
|
||||||
self.path = None
|
|
||||||
self.export = export
|
|
||||||
self.format = 'csv'
|
|
||||||
|
|
||||||
def get_mod(self):
|
def get_mod(self):
|
||||||
"""
|
"""
|
||||||
Get modules
|
Get modules
|
||||||
"""
|
"""
|
||||||
if settings.enable_all_module:
|
if settings.enable_all_module:
|
||||||
# modules = ['brute', 'certificates', 'crawl',
|
|
||||||
# 'datasets', 'intelligence', 'search']
|
|
||||||
# The crawl module has some problems
|
# The crawl module has some problems
|
||||||
modules = ['certificates', 'check', 'datasets',
|
modules = ['certificates', 'check', 'datasets',
|
||||||
'dnsquery', 'intelligence', 'search']
|
'dnsquery', 'intelligence', 'search']
|
||||||
@@ -55,7 +44,6 @@ class Collect(object):
|
|||||||
"""
|
"""
|
||||||
Class entrance
|
Class entrance
|
||||||
"""
|
"""
|
||||||
start = time.time()
|
|
||||||
logger.log('INFOR', f'Start collecting subdomains of {self.domain}')
|
logger.log('INFOR', f'Start collecting subdomains of {self.domain}')
|
||||||
self.get_mod()
|
self.get_mod()
|
||||||
self.import_func()
|
self.import_func()
|
||||||
@@ -66,8 +54,7 @@ class Collect(object):
|
|||||||
func_obj, func_name = collect_func
|
func_obj, func_name = collect_func
|
||||||
thread = threading.Thread(target=func_obj,
|
thread = threading.Thread(target=func_obj,
|
||||||
name=func_name,
|
name=func_name,
|
||||||
args=(self.domain,),
|
args=(self.domain,))
|
||||||
daemon=True)
|
|
||||||
threads.append(thread)
|
threads.append(thread)
|
||||||
# Start all threads
|
# Start all threads
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
@@ -82,15 +69,6 @@ class Collect(object):
|
|||||||
if thread.is_alive():
|
if thread.is_alive():
|
||||||
logger.log('ALERT', f'{thread.name} module thread timed out')
|
logger.log('ALERT', f'{thread.name} module thread timed out')
|
||||||
|
|
||||||
# Export
|
|
||||||
if self.export:
|
|
||||||
if not self.path:
|
|
||||||
name = f'{self.domain}.{self.format}'
|
|
||||||
self.path = settings.result_save_dir.joinpath(name)
|
|
||||||
dbexport.export(self.domain, type='table', path=self.path, format=self.format)
|
|
||||||
end = time.time()
|
|
||||||
self.elapse = round(end - start, 1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
collect = Collect('example.com')
|
collect = Collect('example.com')
|
||||||
|
|||||||
Reference in New Issue
Block a user