forked from m0chan/BugBounty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCrtSH.py
executable file
·45 lines (33 loc) · 1.06 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
44
45
#!/usr/bin/env python3
#@felamos for JSON Assistance :)
from crtsh import crtshAPI
import json
import sys
results = ""
def Main():
if len(sys.argv) < 2:
sys.exit(f"[*] {sys.argv[0]} domain")
domain = sys.argv[1]
print(f"[*] Enumerating {domain}")
def api(d):
results = json.dumps(crtshAPI().search(d))
return results
def save(d, r):
print(f"[*] Saved Raw JSON to File {d}.json")
with open(f"{d}.json", "w") as f:
f.write(r)
f.close()
def getname(r):
json_object = json.loads(r)
with open(domain + "_domains.subs", "w") as f:
for url in json_object[0]:
sub = url['name_value']
f.write(sub+"\n")
#print(sub)
linecount = sum(1 for line in open(domain + "_domains.subs"))
print("[*] Succesfully Found " + str(linecount) + " Domains")
print("[*] Saved SubDomains to " + domain + "_domains.subs")
save(domain, api(domain))
getname(api(domain))
if __name__ == "__main__":
Main()