-
Notifications
You must be signed in to change notification settings - Fork 3
/
subhunt.py
29 lines (25 loc) · 1007 Bytes
/
subhunt.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
import sys
import urllib.request
import urllib.parse
import re,os
os.system('clear')
print ("""
_____ _ _ _ _
/ ____| | | | | | | | |
| (___ _ _| |__ | |__| |_ _ _ __ | |_
\___ \| | | | '_ \| __ | | | | '_ \| __|
____) | |_| | |_) | | | | |_| | | | | |_
|_____/ \__,_|_.__/|_| |_|\__,_|_| |_|\__|
Tegal1337
python3 subhunt.py domain.com
""")
print ("Scanning Subdomain For", sys.argv[1])
for i, arg in enumerate(sys.argv, 1):
domains = set()
with urllib.request.urlopen('https://crt.sh/?q=' + urllib.parse.quote('%.' + arg)) as r:
code = r.read().decode('utf-8')
for cert, domain in re.findall('<tr>(?:\s|\S)*?href="\?id=([0-9]+?)"(?:\s|\S)*?<td>([*_a-zA-Z0-9.-]+?\.' + re.escape(arg) + ')</td>(?:\s|\S)*?</tr>', code, re.IGNORECASE):
domain = domain.split('@')[-1]
if not domain in domains:
domains.add(domain)
print(domain)