-
Notifications
You must be signed in to change notification settings - Fork 0
/
live-out.py
36 lines (31 loc) · 1.11 KB
/
live-out.py
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
import requests
# Function to check if a domain is active
def is_domain_active(domain):
try:
response = requests.get(f"http://{domain}", timeout=5)
# Check if the response status code indicates success (e.g., 200 OK)
if response.status_code <= 200:
return True
except requests.ConnectionError:
pass
except requests.Timeout:
pass
except Exception as e:
pass
return False
# Input file containing subdomains
input_file = "/home/karthithehacker/recon/dsci/domains.txt"
# Output file to store live URLs
output_file = "/home/karthithehacker/recon/dsci/live.txt"
try:
with open(input_file, 'r') as infile, open(output_file, 'w') as outfile:
for line in infile:
subdomain = line.strip()
if is_domain_active(subdomain):
live_url = f"http://{subdomain}"
print(f"Domain {live_url} is active.")
outfile.write(f"{live_url}\n")
except FileNotFoundError:
print(f"Input file '{input_file}' not found.")
except Exception as e:
print(f"An error occurred: {str(e)}")