From 68a0e7c16e2d47968dd0cecc49ae0e6a3430f137 Mon Sep 17 00:00:00 2001 From: Brandon Perry Date: Fri, 4 Jul 2014 10:53:37 -0500 Subject: [PATCH] Create sqlmap_session.rb --- lib/sqlmap/sqlmap_session.rb | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/sqlmap/sqlmap_session.rb diff --git a/lib/sqlmap/sqlmap_session.rb b/lib/sqlmap/sqlmap_session.rb new file mode 100644 index 0000000000..3fb64f7c88 --- /dev/null +++ b/lib/sqlmap/sqlmap_session.rb @@ -0,0 +1,37 @@ +module Sqlmap + class Session + def initialize(host, port = 8775) + @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 + res = c.request_cgi(args) + res = c.send_recv(res) + return res + 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 + res = c.request_cgi(args) + res = c.send_recv(res) + return res + end + end +end