This commit is contained in:
Jing Ling
2020-05-11 21:40:32 +08:00
parent 74d5354ead
commit fc7a5353d9
14 changed files with 47 additions and 48 deletions
+10 -10
View File
@@ -99,7 +99,7 @@ def get_domains(target):
:return list: domain list
"""
domains = list()
logger.log('DEBUG', f'Getting domains...')
logger.log('DEBUG', f'Getting domains')
if isinstance(target, (set, tuple)):
domains = list(target)
elif isinstance(target, list):
@@ -171,7 +171,7 @@ def check_path(path, name, format):
logger.log('ALERT', f'{parent_dir} does not exist, directory will be created')
parent_dir.mkdir(parents=True, exist_ok=True)
if path.exists():
logger.log('ALERT', f'{path} exists, file will be overwritten')
logger.log('ALERT', f'The {path} exists and will be overwritten')
return path
@@ -487,7 +487,7 @@ def delete_file(*paths):
@tenacity.retry(stop=tenacity.stop_after_attempt(3))
def check_net():
logger.log('INFOR', 'Checking Internet environment...')
logger.log('INFOR', 'Checking Internet environment')
urls = ['http://www.example.com', 'http://www.baidu.com',
'http://www.bing.com', 'http://www.taobao.com',
'http://www.linkedin.com', 'http://www.msn.com',
@@ -498,18 +498,18 @@ def check_net():
rsp = requests.get(url)
except Exception as e:
logger.log('ERROR', e.args)
logger.log('ALERT', 'Can not access Internet, retrying...')
logger.log('ALERT', 'Can not access Internet, retrying')
raise tenacity.TryAgain
if rsp.status_code != 200:
logger.log('ALERT', f'{rsp.request.method} {rsp.request.url} '
f'{rsp.status_code} {rsp.reason}')
logger.log('ALERT', 'Can not access Internet normally, retrying...')
logger.log('ALERT', 'Can not access Internet normally, retrying')
raise tenacity.TryAgain
logger.log('INFOR', 'Access to Internet OK')
def check_pre():
logger.log('INFOR', 'Checking dependent environment...')
logger.log('INFOR', 'Checking dependent environment')
system = platform.system()
implementation = platform.python_implementation()
version = platform.python_version()
@@ -531,7 +531,7 @@ def check_pre():
def check_env():
logger.log('INFOR', 'Checking the environment...')
logger.log('INFOR', 'Checking the environment')
try:
check_net()
except Exception as e:
@@ -548,7 +548,7 @@ def get_maindomain(domain):
def call_massdns(massdns_path, dict_path, ns_path, output_path, log_path,
query_type='A', process_num=1, concurrent_num=10000,
quiet_mode=False):
logger.log('INFOR', f'Start running massdns')
logger.log('DEBUG', f'Start running massdns')
quiet = ''
if quiet_mode:
quiet = '--quiet'
@@ -561,9 +561,9 @@ def call_massdns(massdns_path, dict_path, ns_path, output_path, log_path,
f'--resolve-count {resolve_num} --type {query_type} ' \
f'--flush --output J --outfile {output_path} ' \
f'--root --error-log {log_path} {dict_path}'
logger.log('INFOR', f'Run command {cmd}')
logger.log('DEBUG', f'Run command {cmd}')
subprocess.run(args=cmd, shell=True)
logger.log('INFOR', f'Finished massdns')
logger.log('DEBUG', f'Finished massdns')
def get_massdns_path(massdns_dir):