-
Notifications
You must be signed in to change notification settings - Fork 1
/
ApiScript.rb
36 lines (30 loc) · 1013 Bytes
/
ApiScript.rb
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
include IronWASP
def start_log_range(req, res)
GlobalStore.put("log_start_rb_api", Config.last_proxy_log_id + 1)
res.body_string = "OK"
end
start_log_range_l = lambda{|req, res| start_log_range(req, res)}
ApiCallHandler.add_handler("/rb/log_range_start", start_log_range_l)
def end_log_range(req, res)
GlobalStore.put("log_end_rb_api", Config.last_proxy_log_id)
res.body_string = "OK"
end
end_log_range_l = lambda{|req, res| end_log_range(req, res)}
ApiCallHandler.add_handler("/rb/log_range_end", end_log_range_l)
def scan_log_range(req, res)
start_id = GlobalStore.get("log_start_rb_api")
end_id = GlobalStore.get("log_end_rb_api")
(start_id..end_id).each do |i|
r = Request.from_proxy_log(i)
s = Scanner.new(r)
if r.query.count > 0 or r.body.count > 0
s.inject_query
s.inject_body
s.check_all
s.launch_scan
end
end
res.body_string = "OK"
end
scan_log_range_l = lambda{|req, res| scan_log_range(req, res)}
ApiCallHandler.add_handler("/rb/scan_log_range", scan_log_range_l)