Class: EvilProxy::AgentProxyServer
Constant Summary
HTTPProxyServer::DEFAULT_CALLBACKS, HTTPProxyServer::SUPPORTED_METHODS
Instance Attribute Summary
#callbacks
Instance Method Summary
collapse
define_callback_methods, #do_DELETE, #do_OPTIONS, #do_PATCH, #do_PUT, #exit, #initialize, #restart, #start, #stop
Instance Method Details
#fire(key, *args) ⇒ Object
12
13
14
|
# File 'lib/evil-proxy/agentproxy.rb', line 12
def fire key, *args
@mitm_server.fire key, *args, self
end
|
#initialize_callbacks(config) ⇒ Object
8
9
10
|
# File 'lib/evil-proxy/agentproxy.rb', line 8
def initialize_callbacks config
@mitm_server = config[:MITMProxyServer]
end
|
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
|
# File 'lib/evil-proxy/agentproxy.rb', line 16
def perform_proxy_request(req, res)
uri = req.request_uri
path = uri.path.dup
path << "?" << uri.query if uri.query
= Hash.new
(req, )
response = nil
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start do
if @config[:ProxyTimeout]
http.open_timeout = 30
http.read_timeout = 60
end
response = yield(http, path, )
end
res['proxy-connection'] = "close"
res['connection'] = "close"
res.status = response.code.to_i
(response, res)
set_cookie(response, res)
res.body = response.body
end
|
#service(req, res) ⇒ Object
50
51
52
53
54
|
# File 'lib/evil-proxy/agentproxy.rb', line 50
def service req, res
fire :before_request, req
proxy_service req, res
fire :before_response, req, res
end
|