Class: Arachni::Platform::Fingerprinter Abstract
- Includes:
- Utilities
- Defined in:
- lib/arachni/platform/fingerprinter.rb
Overview
Provides utility methods for fingerprinter components as well as the Arachni::Page object to be fingerprinted
Instance Attribute Summary collapse
-
#page ⇒ Page
readonly
Page to fingerprint.
Instance Method Summary collapse
-
#cookies ⇒ Hash
Cookies as headers with keys and values downcased.
-
#extension ⇒ String
Downcased file extension of the page.
-
#headers ⇒ Hash
Response headers with keys and values downcased.
- #html? ⇒ Boolean
-
#initialize(page) ⇒ Fingerprinter
constructor
A new instance of Fingerprinter.
-
#parameters ⇒ Hash
URI parameters with keys and values downcased.
-
#platforms ⇒ Platform
Platform for the given page, should be updated by the fingerprinter accordingly.
-
#powered_by ⇒ String. nil
Downcased value of the `X-Powered-By` header.
-
#run ⇒ Object
abstract
Executes the payload of the fingerprinter.
-
#server ⇒ String. nil
Downcased value of the `Server` header.
-
#server_or_powered_by_include?(string) ⇒ Boolean
`true` if either #server or #powered_by include `string`, `false` otherwise.
-
#uri ⇒ Arachni::URI
Parsed URL of the #page.
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
#page ⇒ Page (readonly)
Returns Page to fingerprint.
27 28 29 |
# File 'lib/arachni/platform/fingerprinter.rb', line 27 def page @page end |
Instance Method Details
#cookies ⇒ Hash
Returns Cookies as headers with keys and values downcased.
67 68 69 70 |
# File 'lib/arachni/platform/fingerprinter.rb', line 67 def @cookies ||= page.. inject({}) { |h, c| h.merge! c.simple }.downcase end |
#extension ⇒ String
Returns 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 |
#headers ⇒ Hash
Returns 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
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 |
#parameters ⇒ Hash
Returns 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 |
#platforms ⇒ Platform
Returns 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_by ⇒ String. nil
Returns 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 |
#run ⇒ Object
Executes the payload of the fingerprinter.
36 37 |
# File 'lib/arachni/platform/fingerprinter.rb', line 36 def run end |
#server ⇒ String. nil
Returns 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.
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 |
#uri ⇒ Arachni::URI
Returns Parsed URL of the #page.
55 56 57 |
# File 'lib/arachni/platform/fingerprinter.rb', line 55 def uri uri_parse( page.url ) end |