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.
-
#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, #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
#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.
62 63 64 65 |
# File 'lib/arachni/platform/fingerprinter.rb', line 62 def @cookies ||= page.. inject({}) { |h, c| h.merge! c.simple }.downcase end |
#extension ⇒ String
Returns 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 |
#headers ⇒ Hash
Returns 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 |
#parameters ⇒ Hash
Returns 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 |
#platforms ⇒ Platform
Returns 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_by ⇒ String. nil
Returns 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 |
#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.
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.
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 |
#uri ⇒ Arachni::URI
Returns Parsed URL of the #page.
50 51 52 |
# File 'lib/arachni/platform/fingerprinter.rb', line 50 def uri uri_parse( page.url ) end |