-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsubdom.py
More file actions
43 lines (40 loc) · 1.31 KB
/
subdom.py
File metadata and controls
43 lines (40 loc) · 1.31 KB
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
37
38
39
40
41
42
43
class SubDom():
__version__ = 1.0
import sys
import os
import requests
from bs4 import BeautifulSoup
def proxys():
try:
response = requests.get("https://sslproxies.org/")
soup = BeautifulSoup(response.content, 'html5lib')
proxy = {'https': choice(list(map(lambda x:x[0]+':'+x[1], list(zip(map(lambda x:x.text,
soup.findAll('td')[::8]), map(lambda x:x.text, soup.findAll('td')[1::8]))))))}
return proxy
except Exception as e:
pass
def scan():
headers = {"User-Agent": "SubDom {SubDom.__version__}"}
proxy = proxys()
x = requests.get(sys.argv[1], headers=headers, proxies=proxy)
if x.status_code == 504:
print("Connection timed out.")
elif x.status_code == 200:
with open(sys.argv[2], "r") as f:
for directory in f:
find = requests.post(sys.argv[1]+"/"+directory, headers=headers, proxies=proxy)
if find.status_code == 200:
print(f"Directory Found : {directory}")
elif find.status_code == 403:
print(f"Directory Forbidden : {directory}")
elif find.status_code == 404:
print(f"Directory Not Found : {directory}")
else:
print("Something went wrong!")
else:
sys.exit()
if len(sys.argv) < 2:
print("Usage: python3 "+sys.argv[0]+" <website> <wordlist>")
sys.exit()
else:
scan()