CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/sqlmap/sqlmap_session.rb
Views: 1904
1
module Sqlmap
2
class Session
3
def initialize(host, port)
4
@host = host
5
@port = port
6
end
7
8
def get(uri, headers = nil, params = nil)
9
c = Rex::Proto::Http::Client.new(@host, @port)
10
args = {
11
'uri' => uri
12
}
13
14
args['headers'] = headers if headers
15
args['vars_get'] = params if params
16
begin
17
res = c.request_cgi(args)
18
res = c.send_recv(res)
19
return res
20
rescue Rex::ConnectionRefused
21
return
22
end
23
end
24
25
def post(uri, headers = nil, data = nil, originator_args = nil)
26
c = Rex::Proto::Http::Client.new(@host, @port)
27
args = {
28
'uri' => uri,
29
'method' => 'POST'
30
}
31
32
args.merge!(originator_args) if originator_args
33
args['headers'] = headers if headers
34
args['data'] = data if data
35
begin
36
res = c.request_cgi(args)
37
res = c.send_recv(res)
38
return res
39
rescue Rex::ConnectionRefused
40
return
41
end
42
end
43
end
44
end
45
46