forked from shmilylty/OneForAll
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.py
More file actions
41 lines (36 loc) · 1.21 KB
/
check.py
File metadata and controls
41 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import requests
from config.log import logger
from common.module import Module
class Check(Module):
"""
Check base class
"""
def __init__(self):
Module.__init__(self)
self.request_status = 1
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}',
))
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)
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