|
| 1 | +import requests |
| 2 | +import sys |
| 3 | +import warnings |
| 4 | +from colorama import init, Fore, Style |
| 5 | +import threading |
| 6 | + |
| 7 | +# Suppress InsecureRequestWarning |
| 8 | +warnings.filterwarnings("ignore", message="Unverified HTTPS request") |
| 9 | + |
| 10 | +# Initialize colorama |
| 11 | +init(autoreset=True) |
| 12 | + |
| 13 | +def check_subdomain(subdomain): |
| 14 | + headers = { |
| 15 | + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3' |
| 16 | + } |
| 17 | + try: |
| 18 | + response = requests.get(f"https://{subdomain}", timeout=10, headers=headers, verify=False) |
| 19 | + if response.status_code == 200: |
| 20 | + print(Fore.GREEN + "[200] - " + subdomain) |
| 21 | + elif response.status_code == 403: |
| 22 | + print(Fore.RED + "[403] - " + subdomain) |
| 23 | + elif response.status_code == 404: |
| 24 | + print(Fore.WHITE + "[404] - " + subdomain) |
| 25 | + else: |
| 26 | + print(Fore.WHITE + f"[{response.status_code}] - {subdomain}") |
| 27 | + except requests.exceptions.Timeout: |
| 28 | + print(Fore.BLUE + "[TIMEOUT] - " + subdomain) |
| 29 | + except requests.exceptions.ConnectionError: |
| 30 | + print(Fore.WHITE + "[CONNECTION ERROR] - " + subdomain) |
| 31 | + except Exception as e: |
| 32 | + print(Fore.WHITE + f"[ERROR] - {subdomain}: {str(e)}") |
| 33 | + |
| 34 | +def check_subdomains(subdomain_file): |
| 35 | + with open(subdomain_file, 'r') as f: |
| 36 | + subdomains = f.read().splitlines() |
| 37 | + |
| 38 | + threads = [] |
| 39 | + for subdomain in subdomains: |
| 40 | + thread = threading.Thread(target=check_subdomain, args=(subdomain,)) |
| 41 | + threads.append(thread) |
| 42 | + thread.start() |
| 43 | + |
| 44 | + for thread in threads: |
| 45 | + thread.join() |
| 46 | + |
| 47 | +if __name__ == "__main__": |
| 48 | + if len(sys.argv) != 3 or sys.argv[1] != '-l': |
| 49 | + print("Usage: python3 fast_check_http.py -l <subdomains_file>") |
| 50 | + sys.exit(1) |
| 51 | + check_subdomains(sys.argv[2]) |
0 commit comments