-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (30 loc) · 909 Bytes
/
main.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
import dns.resolver
def get_subdomains(domain):
subdomains = []
try:
with open('subdomains.txt', 'r') as file:
subdomains = file.read().splitlines()
except FileNotFoundError:
print("subdomains.txt file not found!")
return []
discovered_subdomains = []
for subdomain in subdomains:
url = f"http://{subdomain}.{domain}"
try:
requests.get(url)
discovered_subdomains.append(url)
except requests.ConnectionError:
pass
return discovered_subdomains
def main():
domain = input("Enter the domain to enumerate subdomains for: ")
subdomains = get_subdomains(domain)
if subdomains:
print("Discovered subdomains:")
for sub in subdomains:
print(sub)
else:
print("No subdomains discovered.")
if __name__ == "__main__":
main()