Class: Arachni::Platform::Fingerprinter Abstract

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/arachni/platform/fingerprinter.rb

Overview

This class is abstract.

Provides utility methods for fingerprinter components as well as the Arachni::Page object to be fingerprinted

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#available_port, #cookie_encode, #cookies_from_document, #cookies_from_file, #cookies_from_response, #exception_jail, #exclude_path?, #extract_domain, #follow_protocol?, #form_decode, #form_encode, #form_parse_request_body, #forms_from_document, #forms_from_response, #generate_token, #get_path, #html_decode, #html_encode, #include_path?, #links_from_document, #links_from_response, #normalize_url, #page_from_response, #page_from_url, #parse_query, #parse_set_cookie, #parse_url_vars, #path_in_domain?, #path_too_deep?, #port_available?, #rand_port, #redundant_path?, #remove_constants, #seed, #skip_page?, #skip_path?, #skip_resource?, #to_absolute, #uri_decode, #uri_encode, #uri_parse, #uri_parser, #url_sanitize

Constructor Details

#initialize(page) ⇒ Fingerprinter

Returns a new instance of Fingerprinter.



37
38
39
# File 'lib/arachni/platform/fingerprinter.rb', line 37

def initialize( page )
    @page = page
end

Instance Attribute Details

#pagePage (readonly)

Returns Page to fingerprint.

Returns:

  • (Page)

    Page to fingerprint.



35
36
37
# File 'lib/arachni/platform/fingerprinter.rb', line 35

def page
  @page
end

Instance Method Details

#cookiesHash

Returns Cookies as headers with keys and values downcased.

Returns:

  • (Hash)

    Cookies as headers with keys and values downcased.



65
66
67
68
# File 'lib/arachni/platform/fingerprinter.rb', line 65

def cookies
    @cookies ||= page.cookies.
        inject({}) { |h, c| h.merge! c.simple }.downcase
end

#extensionString

Returns Downcased file extension of the page.

Returns:

  • (String)

    Downcased file extension of the page.



86
87
88
# File 'lib/arachni/platform/fingerprinter.rb', line 86

def extension
    @extension ||= uri_parse( page.url ).resource_extension.to_s.downcase
end

#headersHash

Returns Response headers with keys and values downcased.

Returns:

  • (Hash)

    Response headers with keys and values downcased.



71
72
73
# File 'lib/arachni/platform/fingerprinter.rb', line 71

def headers
    @headers ||= page.response_headers.downcase
end

#parametersHash

Returns URI parameters with keys and values downcased.

Returns:

  • (Hash)

    URI parameters with keys and values downcased.



60
61
62
# File 'lib/arachni/platform/fingerprinter.rb', line 60

def parameters
    @parameters ||= page.query_vars.downcase
end

#platformsPlatform

Returns Platform for the given page, should be updated by the fingerprinter accordingly.

Returns:

  • (Platform)

    Platform for the given page, should be updated by the fingerprinter accordingly.



93
94
95
# File 'lib/arachni/platform/fingerprinter.rb', line 93

def platforms
    page.platforms
end

#powered_byString. nil

Returns Downcased value of the ‘X-Powered-By` header.

Returns:

  • (String. nil)

    Downcased value of the ‘X-Powered-By` header.



76
77
78
# File 'lib/arachni/platform/fingerprinter.rb', line 76

def powered_by
    headers['x-powered-by'].to_s.downcase
end

#runObject

This method is abstract.

Executes the payload of the fingerprinter.



43
44
# File 'lib/arachni/platform/fingerprinter.rb', line 43

def run
end

#serverString. nil

Returns Downcased value of the ‘Server` header.

Returns:

  • (String. nil)

    Downcased value of the ‘Server` header.



81
82
83
# File 'lib/arachni/platform/fingerprinter.rb', line 81

def server
    headers['server'].to_s.downcase
end

#server_or_powered_by_include?(string) ⇒ Boolean

Returns ‘true` if either #server or #powered_by include `string`, `false` otherwise.

Parameters:

Returns:

  • (Boolean)

    ‘true` if either #server or #powered_by include `string`, `false` otherwise.



50
51
52
# File 'lib/arachni/platform/fingerprinter.rb', line 50

def server_or_powered_by_include?( string )
    server.include?( string.downcase ) || powered_by.include?( string.downcase )
end

#uriArachni::URI

Returns Parsed URL of the #page.

Returns:



55
56
57
# File 'lib/arachni/platform/fingerprinter.rb', line 55

def uri
    uri_parse( page.url )
end