Class: Typhoeus::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/wpscan/typhoeus/response.rb

Overview

Custom Response class

Instance Method Summary collapse

Instance Method Details

#from_vuln_api?Boolean

Note:

Ignores requests done to the /status endpoint of the WPScan Vuln API.

Returns:

  • (Boolean)


30
31
32
33
34
35
# File 'lib/wpscan/typhoeus/response.rb', line 30

def from_vuln_api?
  return false unless effective_url

  effective_url.start_with?(WPScan::DB::VulnApi.uri.to_s) &&
    !effective_url.start_with?(WPScan::DB::VulnApi.uri.join('status').to_s)
end

#htmlNokogiri::XML

Returns The response’s body parsed by Nokogiri::HTML.

Returns:

  • (Nokogiri::XML)

    The response’s body parsed by Nokogiri::HTML



7
8
9
# File 'lib/wpscan/typhoeus/response.rb', line 7

def html
  @html ||= Nokogiri::HTML(body.encode('UTF-8', invalid: :replace, undef: :replace))
end

#request_sizeInteger

Override of the original to ensure an integer is returned

Returns:

  • (Integer)


18
19
20
# File 'lib/wpscan/typhoeus/response.rb', line 18

def request_size
  super || 0
end

#sizeInteger

Returns:

  • (Integer)


23
24
25
# File 'lib/wpscan/typhoeus/response.rb', line 23

def size
  (body.nil? ? 0 : body.size) + (response_headers.nil? ? 0 : response_headers.size)
end

#xmlNokogiri::XML

Returns The response’s body parsed by Nokogiri::XML.

Returns:

  • (Nokogiri::XML)

    The response’s body parsed by Nokogiri::XML



12
13
14
# File 'lib/wpscan/typhoeus/response.rb', line 12

def xml
  @xml ||= Nokogiri::XML(body.encode('UTF-8', invalid: :replace, undef: :replace))
end