Skip to content

Commit 05cf03e

Browse files
authored
Update check_http.py
1 parent e421d6a commit 05cf03e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

check_http.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import requests
22
import sys
33
from colorama import Fore, Style, init
4+
import urllib3
5+
from requests.exceptions import Timeout, RequestException
46

57
# Initialize colorama for colorized output
68
init(autoreset=True)
79

10+
# Suppress SSL warnings
11+
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
12+
813
# Function to check the status code of each subdomain
914
def check_subdomains(file_path):
1015
try:
@@ -15,7 +20,7 @@ def check_subdomains(file_path):
1520
subdomain = subdomain.strip() # Removing newline characters
1621
if subdomain: # If the line is not empty
1722
try:
18-
response = requests.get(f"http://{subdomain}", timeout=5, verify=False)
23+
response = requests.get(f"http://{subdomain}", timeout=10, verify=False)
1924
status_code = response.status_code
2025

2126
if status_code == 200:
@@ -27,9 +32,9 @@ def check_subdomains(file_path):
2732
else:
2833
print(f"{Fore.WHITE}[{status_code}] - {subdomain}")
2934

30-
except requests.exceptions.Timeout:
35+
except Timeout:
3136
print(f"{Fore.WHITE}[TIMEOUT] - {subdomain}")
32-
except requests.exceptions.RequestException:
37+
except RequestException as e:
3338
print(f"{Fore.WHITE}[CONNECTION ERROR] - {subdomain}")
3439

3540
except FileNotFoundError:

0 commit comments

Comments
 (0)