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, #caller_name, #caller_path, #cookie_decode, #cookie_encode, #cookies_from_document, #cookies_from_file, #cookies_from_response, #exception_jail, #exclude_path?, #follow_protocol?, #form_decode, #form_encode, #forms_from_document, #forms_from_response, #generate_token, #get_path, #hms_to_seconds, #html_decode, #html_encode, #include_path?, #links_from_document, #links_from_response, #normalize_url, #page_from_response, #page_from_url, #parse_set_cookie, #path_in_domain?, #path_too_deep?, #port_available?, #rand_port, #random_seed, #redundant_path?, #remove_constants, #request_parse_body, #seconds_to_hms, #skip_page?, #skip_path?, #skip_resource?, #skip_response?, #to_absolute, #uri_decode, #uri_encode, #uri_parse, #uri_parse_query, #uri_parser, #uri_rewrite

Constructor Details

#initialize(page) ⇒ Fingerprinter

Returns a new instance of Fingerprinter.



29
30
31
# File 'lib/arachni/platform/fingerprinter.rb', line 29

def initialize( page )
    @page = page
end

Instance Attribute Details

#pagePage (readonly)

Returns Page to fingerprint.

Returns:

  • (Page)

    Page to fingerprint.



27
28
29
# File 'lib/arachni/platform/fingerprinter.rb', line 27

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.



62
63
64
65
# File 'lib/arachni/platform/fingerprinter.rb', line 62

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.



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

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.



69
70
71
# File 'lib/arachni/platform/fingerprinter.rb', line 69

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.



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

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.



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

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.



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

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

#runObject

This method is abstract.

Executes the payload of the fingerprinter.



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

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.



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

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:



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

def uri
    uri_parse( page.url )
end