2014-07-04 15:53:37 +00:00
|
|
|
module Sqlmap
|
|
|
|
class Session
|
2015-04-24 07:00:50 +00:00
|
|
|
def initialize(host, port)
|
2014-07-04 15:53:37 +00:00
|
|
|
@host = host
|
|
|
|
@port = port
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(uri, headers = nil, params = nil)
|
|
|
|
c = Rex::Proto::Http::Client.new(@host, @port)
|
|
|
|
args = {
|
|
|
|
'uri' => uri
|
|
|
|
}
|
|
|
|
|
|
|
|
args['headers'] = headers if headers
|
|
|
|
args['vars_get'] = params if params
|
2015-05-04 04:57:53 +00:00
|
|
|
begin
|
|
|
|
res = c.request_cgi(args)
|
|
|
|
res = c.send_recv(res)
|
|
|
|
return res
|
|
|
|
rescue Rex::ConnectionRefused
|
|
|
|
return
|
|
|
|
end
|
2014-07-04 15:53:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def post(uri, headers = nil, data = nil, originator_args = nil)
|
|
|
|
c = Rex::Proto::Http::Client.new(@host, @port)
|
|
|
|
args = {
|
|
|
|
'uri' => uri,
|
|
|
|
'method' => 'POST'
|
|
|
|
}
|
|
|
|
|
|
|
|
args.merge!(originator_args) if originator_args
|
|
|
|
args['headers'] = headers if headers
|
|
|
|
args['data'] = data if data
|
2015-05-04 04:57:53 +00:00
|
|
|
begin
|
|
|
|
res = c.request_cgi(args)
|
|
|
|
res = c.send_recv(res)
|
|
|
|
return res
|
|
|
|
rescue Rex::ConnectionRefused
|
|
|
|
return
|
|
|
|
end
|
2014-07-04 15:53:37 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|