-
Notifications
You must be signed in to change notification settings - Fork 13
/
crtsh.py
43 lines (35 loc) · 1.07 KB
/
crtsh.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
37
38
39
40
41
42
43
#!/usr/bin/env python
# coding:utf-8
# Build by LandGrey 2017-11-03
import re
import sys
import requests
def run(url, results=[]):
_ = requests.get(url, timeout=15)
text = _.text
result = re.findall('DNS:\*\.(.*?)<BR>', text)
for x in result:
if x not in results:
results.append(x)
print(x)
if __name__ == "__main__":
base, param = 'https://crt.sh/', '?q='
domain = 'example.com' if len(sys.argv) != 2 else sys.argv[1]
try:
r = requests.session()
req = r.get(base + param + domain)
matches = re.findall('<TD style="text-align:center"><A href="(.*?)">', req.text)
except Exception as e:
matches = "None"
exit(e.message)
print("[+] Searching domains about: [%s] by https://crt.sh" % domain)
domains = [base + p for p in matches]
for d in domains:
try:
run(d)
except:
try:
run(d)
except Exception as e:
print('[-] Request:[%s] error. Reason: %s' % (d, e.message))
print("[+] Finshed")