-
Notifications
You must be signed in to change notification settings - Fork 211
/
launcher.py
90 lines (79 loc) · 2 KB
/
launcher.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/python3
# coding: utf-8
import queue
import simplejson
import threading
import subprocess
import requests
import warnings
warnings.filterwarnings(action='ignore')
urls_queue = queue.Queue()
tclose=0
def opt2File(paths):
try:
f = open('crawl_result.txt','a')
f.write(paths + '\n')
finally:
f.close()
def opt2File2(subdomains):
try:
f = open('sub_domains.txt','a')
f.write(subdomains + '\n')
finally:
f.close()
def request0():
while tclose==0 or urls_queue.empty() == False:
if(urls_queue.qsize()==0):
continue
print(urls_queue.qsize())
req =urls_queue.get()
proxies = {
'http': 'http://127.0.0.1:7777',
'https': 'http://127.0.0.1:7777',
}
urls0 =req['url']
headers0 =req['headers']
method0=req['method']
data0=req['data']
try:
if(method0=='GET'):
a = requests.get(urls0, headers=headers0, proxies=proxies,timeout=30,verify=False)
opt2File(urls0)
elif(method0=='POST'):
a = requests.post(urls0, headers=headers0,data=data0, proxies=proxies,timeout=30,verify=False)
opt2File(urls0)
except:
continue
return
def main(data1):
target = data1
cmd = ["./crawlergo", "-c", "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe","-t", "20","-f","smart","--fuzz-path", "--output-mode", "json", target]
rsp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = rsp.communicate()
try:
result = simplejson.loads(output.decode().split("--[Mission Complete]--")[1])
except:
return
req_list = result["req_list"]
sub_domain = result["sub_domain_list"]
print(data1)
print("[crawl ok]")
try:
for subd in sub_domain:
opt2File2(subd)
except:
pass
try:
for req in req_list:
urls_queue.put(req)
except:
return
print("[scanning]")
if __name__ == '__main__':
file = open("targets.txt")
t = threading.Thread(target=request0)
t.start()
for text in file.readlines():
data1 = text.strip('\n')
main(data1)
tclose=1