From b3e828359d479a17d2a2a0975460563276fd7c7a Mon Sep 17 00:00:00 2001 From: Tasos Laskos Date: Wed, 6 Feb 2013 01:02:46 +0200 Subject: [PATCH] Web::HTTP#_request: allow Rex opt level overrides Allow overriding options at the Rex level when performing requests via the Auxiliary::Web::HTTP wrapper. --- lib/msf/core/auxiliary/web/http.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/msf/core/auxiliary/web/http.rb b/lib/msf/core/auxiliary/web/http.rb index 0a59187c02..a7c8fc86e3 100644 --- a/lib/msf/core/auxiliary/web/http.rb +++ b/lib/msf/core/auxiliary/web/http.rb @@ -266,10 +266,12 @@ class Auxiliary::Web::HTTP end def _request( url, opts = {} ) - body = opts[:body] + body = opts[:body] timeout = opts[:timeout] || 10 - method = opts[:method].to_s.upcase || 'GET' - url = url.is_a?( URI ) ? url : URI( url.to_s ) + method = opts[:method].to_s.upcase || 'GET' + url = url.is_a?( URI ) ? url : URI( url.to_s ) + + rex_overrides = opts.delete( :rex ) || {} param_opts = {} @@ -285,10 +287,11 @@ class Auxiliary::Web::HTTP end opts = @request_opts.merge( param_opts ).merge( - 'uri' => url.path || '/', - 'method' => method, + 'uri' => url.path || '/', + 'method' => method, 'headers' => headers.merge( opts[:headers] || {} ) - ) + # Allow for direct rex overrides + ).merge( rex_overrides ) opts['data'] = body if body