class Arachni::Platform::Fingerprinter

Provides utility methods for fingerprinter components as well as the {Page} object to be fingerprinted

@author Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com> @abstract

Attributes

page[R]

@return [Page]

Page to fingerprint.

Public Class Methods

new( page ) click to toggle source
# File lib/arachni/platform/fingerprinter.rb, line 29
def initialize( page )
    @page = page
end

Public Instance Methods

cookies() click to toggle source

@return [Hash]

Cookies as headers with keys and values downcased.
# File lib/arachni/platform/fingerprinter.rb, line 67
def cookies
    @cookies ||= page.cookies.
        inject({}) { |h, c| h.merge! c.simple }.downcase
end
extension() click to toggle source

@return [String]

Downcased file extension of the page.
# File lib/arachni/platform/fingerprinter.rb, line 92
def extension
    @extension ||= uri_parse( page.url ).resource_extension.to_s.downcase
end
headers() click to toggle source

@return [Hash]

Response headers with keys and values downcased.
# File lib/arachni/platform/fingerprinter.rb, line 74
def headers
    @headers ||= page.response.headers.downcase
end
html?() click to toggle source
# File lib/arachni/platform/fingerprinter.rb, line 39
def html?
    @is_html ||= page.response.headers['content-type'].to_s.
        downcase.include?( 'text/html' )
end
parameters() click to toggle source

@return [Hash]

URI parameters with keys and values downcased.
# File lib/arachni/platform/fingerprinter.rb, line 61
def parameters
    @parameters ||= page.query_vars.downcase
end
platforms() click to toggle source

@return [Platform]

Platform for the given page, should be updated by the
fingerprinter accordingly.
# File lib/arachni/platform/fingerprinter.rb, line 99
def platforms
    page.platforms
end
powered_by() click to toggle source

@return [String. nil]

Downcased value of the `X-Powered-By` header.
# File lib/arachni/platform/fingerprinter.rb, line 80
def powered_by
    headers['x-powered-by'].to_s.downcase
end
run() click to toggle source

Executes the payload of the fingerprinter.

@abstract

# File lib/arachni/platform/fingerprinter.rb, line 36
def run
end
server() click to toggle source

@return [String. nil]

Downcased value of the `Server` header.
# File lib/arachni/platform/fingerprinter.rb, line 86
def server
    headers['server'].to_s.downcase
end
server_or_powered_by_include?( string ) click to toggle source

@param [String] string

@return [Boolean]

`true` if either {#server} or {#powered_by} include `string`,
`false` otherwise.
# 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
uri() click to toggle source

@return [Arachni::URI]

Parsed URL of the {#page}.
# File lib/arachni/platform/fingerprinter.rb, line 55
def uri
    uri_parse( page.url )
end