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, available_port_mutex, #bytes_to_kilobytes, #bytes_to_megabytes, #caller_name, #caller_path, #cookie_decode, #cookie_encode, #cookies_from_file, #cookies_from_parser, #cookies_from_response, #exception_jail, #exclude_path?, #follow_protocol?, #form_decode, #form_encode, #forms_from_parser, #forms_from_response, #full_and_absolute_url?, #generate_token, #get_path, #hms_to_seconds, #html_decode, #html_encode, #include_path?, #links_from_parser, #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?, #regexp_array_match, #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.


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

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.


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

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.


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

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

#html?Boolean

Returns:

  • (Boolean)

39
40
41
42
# File 'lib/arachni/platform/fingerprinter.rb', line 39

def html?
    @is_html ||= page.response.headers['content-type'].to_s.
        downcase.include?( 'text/html' )
end

#parametersHash

Returns URI parameters with keys and values downcased.

Returns:

  • (Hash)

    URI parameters with keys and values downcased.


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

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.


99
100
101
# File 'lib/arachni/platform/fingerprinter.rb', line 99

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.


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

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.


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

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:


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

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