diff --git a/lib/anemone/docs/MODIFIED.txt b/lib/anemone/docs/MODIFIED.txt index 5547e5ae0c..52bd1d6f3b 100644 --- a/lib/anemone/docs/MODIFIED.txt +++ b/lib/anemone/docs/MODIFIED.txt @@ -7,3 +7,4 @@ This snapshot of Anemone has been modified for use within the Metasploit Framewo * Addition of a Rex::Proto::HTTP version of anemone/http * Handle Rex::Proto::HTTP headers (not arrays) * Disable freeze_options() since it can recurse into the framework/module options + * Addition of a page.request accessor to store the associated raw request diff --git a/lib/anemone/page.rb b/lib/anemone/page.rb index 7e1bebf35d..6aed271f9a 100644 --- a/lib/anemone/page.rb +++ b/lib/anemone/page.rb @@ -29,7 +29,9 @@ module Anemone attr_accessor :referer # Response time of the request for this page in milliseconds attr_accessor :response_time - + # Storage for the original HTTP request that generated this response + attr_accessor :request + # # Create a new page # diff --git a/lib/anemone/rex_http.rb b/lib/anemone/rex_http.rb index af6620ca21..3fba12eff5 100644 --- a/lib/anemone/rex_http.rb +++ b/lib/anemone/rex_http.rb @@ -40,13 +40,16 @@ module Anemone pages = [] get(url, referer) do |response, code, location, redirect_to, response_time| - pages << Page.new(location, :body => response.body.dup, + page = Page.new(location, :body => response.body.dup, :code => code, :headers => response.headers, :referer => referer, :depth => depth, :redirect_to => redirect_to, :response_time => response_time) + # Store the associated raw HTTP request + page.request = response.request + pages << page end return pages diff --git a/lib/rex/proto/http/client.rb b/lib/rex/proto/http/client.rb index bcc6844a0e..2e28862462 100644 --- a/lib/rex/proto/http/client.rb +++ b/lib/rex/proto/http/client.rb @@ -328,7 +328,9 @@ class Client def send_recv(req, t = -1, persist=false) @pipeline = persist send_request(req) - read_response(t) + res = read_response(t) + res.request = req.to_s + res end # diff --git a/lib/rex/proto/http/response.rb b/lib/rex/proto/http/response.rb index 3b8efc7998..d465b7318a 100644 --- a/lib/rex/proto/http/response.rb +++ b/lib/rex/proto/http/response.rb @@ -74,12 +74,17 @@ class Response < Packet "HTTP\/#{proto} #{code}#{(message and message.length > 0) ? ' ' + message : ''}\r\n" end - attr_accessor :code + # + # Used to store a copy of the original request + # + attr_accessor :request + + + attr_accessor :code attr_accessor :message attr_accessor :proto - end end end -end \ No newline at end of file +end