优化网络检查

This commit is contained in:
Jing Ling
2020-04-30 10:58:33 +08:00
parent 8d3c39335d
commit 82073d4f84
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -485,11 +485,15 @@ def delete_file(*paths):
logger.log('ERROR', e.args)
@tenacity.retry(stop=tenacity.stop_after_attempt(2))
@tenacity.retry(stop=tenacity.stop_after_attempt(3))
def check_net():
logger.log('INFOR', '正在检查网络环境')
url = 'http://www.example.com/'
logger.log('INFOR', f'访问地址 {url}')
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',
'http://www.apple.com', 'http://microsoft.com']
url = random.choice(urls)
logger.log('INFOR', f'正在尝试访问 {url}')
try:
rsp = requests.get(url)
except Exception as e:
+1 -1
View File
@@ -223,8 +223,8 @@ class OneForAll(object):
:return: 总的子域结果
:rtype: list
"""
utils.check_env()
print(banner)
utils.check_env()
dt = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print(f'[*] Starting OneForAll @ {dt}\n')
logger.log('DEBUG', 'Python ' + utils.python_version())