Class: Msf::Auxiliary::Web::HTTP::Response

Inherits:
Rex::Proto::Http::Response show all
Defined in:
lib/msf/core/auxiliary/web/http.rb

Overview

Decorates Rex::Proto::Http::Response with convenience helpers used by web auxiliaries.

Instance Attribute Summary

Attributes inherited from Rex::Proto::Http::Response

#code, #count_100, #message, #peerinfo, #proto, #request

Attributes inherited from Rex::Proto::Http::Packet

#auto_cl, #body, #body_bytes_left, #bufq, #chunk_max_size, #chunk_min_size, #compress, #error, #headers, #incomplete, #inside_chunk, #keepalive, #max_data, #state, #transfer_chunked

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Rex::Proto::Http::Response

#check_100, #cmd_string, #get_cookies, #get_cookies_parsed, #get_hidden_inputs, #get_html_document, #get_html_meta_elements, #get_html_scripts, #get_json_document, #get_xml_document, #gzip_decode, #gzip_decode!, #initialize, #redirect?, #redirection, #update_cmd_parts

Methods inherited from Rex::Proto::Http::Packet

#[], #[]=, #check_100, #chunk, #cmd_string, #completed?, #from_s, #initialize, #output_packet, #parse, #parse_body, #parse_header, #reset, #reset_except_queue, #to_s, #to_terminal_output, #update_cmd_parts

Constructor Details

This class inherits a constructor from Rex::Proto::Http::Response

Class Method Details

.emptyResponse

Returns An empty placeholder response.

Returns:

  • (Response)

    An empty placeholder response.



65
66
67
# File 'lib/msf/core/auxiliary/web/http.rb', line 65

def self.empty
  new( 0, '' )
end

.from_rex_response(response) ⇒ Response

Builds a response object from a Rex HTTP response.

Parameters:

Returns:

  • (Response)

    A wrapped response, or empty when no response was received.



54
55
56
57
58
59
60
61
62
# File 'lib/msf/core/auxiliary/web/http.rb', line 54

def self.from_rex_response( response )
  return empty if !response

  r = new( response.code, response.message, response.proto )
  response.instance_variables.each do |iv|
    r.instance_variable_set( iv, response.instance_variable_get( iv ) )
  end
  r
end

.timed_outResponse

Builds an empty response marked as having timed out.

Returns:

  • (Response)

    A timeout sentinel response.



72
73
74
75
76
# File 'lib/msf/core/auxiliary/web/http.rb', line 72

def self.timed_out
  r = empty
  r.timed_out
  r
end

Instance Method Details

#timed_outTrueClass

Marks this response as timed out.

Returns:

  • (TrueClass)

    Always returns true.



86
87
88
# File 'lib/msf/core/auxiliary/web/http.rb', line 86

def timed_out
  @timed_out = true
end

#timed_out?Boolean

Returns True when the request timed out.

Returns:

  • (Boolean)

    True when the request timed out.



79
80
81
# File 'lib/msf/core/auxiliary/web/http.rb', line 79

def timed_out?
  !!@timed_out
end