mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-25 20:37:48 +08:00
修复check模块下在解析出多个IP不通的情况下超时严重的问题
This commit is contained in:
+20
-5
@@ -1,3 +1,5 @@
|
||||
import requests
|
||||
from config.log import logger
|
||||
from common.module import Module
|
||||
|
||||
|
||||
@@ -12,15 +14,28 @@ class Check(Module):
|
||||
|
||||
def to_check(self, filenames):
|
||||
urls = set()
|
||||
urls_www = set()
|
||||
for filename in filenames:
|
||||
urls.update((f'http://{self.domain}/{filename}',
|
||||
f'https://{self.domain}/{filename}',
|
||||
f'http://www.{self.domain}/{filename}',
|
||||
f'https://www.{self.domain}/{filename}'))
|
||||
urls.update((
|
||||
f'http://{self.domain}/{filename}',
|
||||
f'https://{self.domain}/{filename}',
|
||||
))
|
||||
urls_www.update((
|
||||
f'http://www.{self.domain}/{filename}',
|
||||
f'https://www.{self.domain}/{filename}'
|
||||
))
|
||||
self.check_loop(urls)
|
||||
self.check_loop(urls_www)
|
||||
|
||||
def check_loop(self, urls):
|
||||
for url in urls:
|
||||
self.header = self.get_header()
|
||||
self.proxy = self.get_proxy(self.source)
|
||||
resp = self.get(url, check=False, ignore=True)
|
||||
try:
|
||||
resp = self.get(url, check=False, ignore=True, raise_error=True)
|
||||
except requests.exceptions.ConnectTimeout:
|
||||
logger.log('DEBUG', f'Connection to {url} timed out, so break check')
|
||||
break
|
||||
self.subdomains = self.collect_subdomains(resp)
|
||||
if self.subdomains:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user