forked from Repozo/Web-Vulnerability-Scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subdomain.py
33 lines (32 loc) · 987 Bytes
/
subdomain.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
import requests
import time
subdomainList=[]
def check200(url):
try:
# if this raises an ERROR, that means the subdomain does not exist
requests.get(url)
except requests.ConnectionError:
# if the subdomain does not exist, just pass, print nothing
pass
else:
subdomainList.append(url)
def subfinder(domain):
import threading
subdomainList.clear()
# read all subdomains
file = open("subs.txt")
# read all words in the file
wordlist = file.read()
# split by new lines
subdomains = wordlist.splitlines()
mythreads=[]
# t = threading.Thread(target=check200,kwargs={'url':'https://abc.domain'})
# t.start()
for subdomain in subdomains:
url = f"http://{subdomain}.{domain}"
t = threading.Thread(target=check200,kwargs={'url':url})
mythreads.append(t)
t.start()
for th in mythreads:
th.join()
return subdomainList