Class: Arachni::Element::Base

Inherits:
Object
  • Object
show all
Extended by:
Utilities
Includes:
Capabilities::Auditable
Defined in:
lib/arachni/element/base.rb

Direct Known Subclasses

Cookie, Form, Header, Link

Constant Summary

Constants included from Capabilities::Auditable

Capabilities::Auditable::OPTIONS

Constants included from Capabilities::Auditable::RDiff

Capabilities::Auditable::RDiff::RDIFF_OPTIONS

Constants included from Capabilities::Auditable::Taint

Capabilities::Auditable::Taint::TAINT_OPTIONS

Constants included from Capabilities::Mutable

Capabilities::Mutable::MUTATION_OPTIONS

Instance Attribute Summary collapse

Attributes included from Capabilities::Auditable

#auditor, #opts, #orig

Attributes included from Capabilities::Mutable

#altered

Instance Method Summary collapse

Methods included from Utilities

cookie_encode, cookies_from_document, cookies_from_file, cookies_from_response, exception_jail, exclude_path?, extract_domain, form_decode, form_encode, form_parse_request_body, forms_from_document, forms_from_response, get_path, hash_keys_to_str, html_decode, html_encode, include_path?, links_from_document, links_from_response, normalize_url, page_from_response, page_from_url, parse_query, parse_set_cookie, parse_url_vars, path_in_domain?, path_too_deep?, remove_constants, seed, skip_path?, to_absolute, uri_decode, uri_encode, uri_parse, uri_parser, url_sanitize

Methods included from Capabilities::Auditable

#==, #[], #[]=, #audit, #audit_id, #auditable, #auditable=, #changes, #debug?, #has_inputs?, #hash, #http, #http_request, #info, #orphan?, #override_instance_scope, #override_instance_scope?, #print_bad, #print_debug, #print_debug_backtrace, #print_error, #print_error_backtrace, #print_info, #print_line, #print_ok, #print_status, #provisioned_issue_id, #remove_auditor, #reset, reset, reset_instance_scope, #reset_scope_override, restrict_to_elements, #scope_audit_id, #skip?, #skip_path?, #status_string, #submit, #update

Methods included from Capabilities::Auditable::RDiff

included, #rdiff_analysis

Methods included from Capabilities::Auditable::Timeout

add_timeout_audit_block, add_timeout_candidate, #call_on_timing_blocks, call_on_timing_blocks, current_timeout_audit_operations_cnt, included, on_timing_attacks, #responsive?, running_timeout_attacks?, #timeout_analysis, timeout_analysis_phase_2, timeout_audit_blocks, timeout_audit_operations_cnt, timeout_audit_run, timeout_loaded_modules

Methods included from Capabilities::Auditable::Taint

#taint_analysis

Methods included from Capabilities::Mutable

#altered_value, #altered_value=, #immutables, #mutated?, #mutations, #mutations_for, #original?, #permutations, #permutations_for

Constructor Details

#initialize(url, raw = {}) ⇒ Base

Initialize the element.

Parameters:



49
50
51
52
53
54
55
# File 'lib/arachni/element/base.rb', line 49

def initialize( url, raw = {} )
    @raw = raw.dup
    @raw.freeze
    self.url = url.to_s

    @opts = {}
end

Instance Attribute Details

#rawHash (readonly)

Relatively ‘raw’ (frozen) hash holding the element’s HTML attributes, values, etc.

Returns:

  • (Hash)


41
42
43
# File 'lib/arachni/element/base.rb', line 41

def raw
  @raw
end

Instance Method Details

#actionString

The url to which the element points and should be audited against.

Ex. ‘href’ for links, ‘action’ for forms, etc.

Returns:



102
103
104
# File 'lib/arachni/element/base.rb', line 102

def action
    @action.freeze
end

#action=(url) ⇒ Object

See Also:



107
108
109
110
111
# File 'lib/arachni/element/base.rb', line 107

def action=( url )
    @action = self.url ? to_absolute( url, self.url ) : normalize_url( url )
    rehash
    self.action
end

#dupObject



136
137
138
139
140
141
142
143
144
# File 'lib/arachni/element/base.rb', line 136

def dup
    new = self.class.new( @url ? @url.dup : nil, @raw.dup )
    new.override_instance_scope if override_instance_scope?
    new.auditor   = self.auditor
    new.method    = self.method.dup
    new.altered   = self.altered.dup if self.altered
    new.auditable = self.auditable.dup
    new
end

#idString

Must provide a string uniquely identifying self.

Returns:



62
63
64
# File 'lib/arachni/element/base.rb', line 62

def id
    @raw.to_s
end

#methodString

Method for the element.

Should represent a method in Module::HTTP.

Ex. get, post, cookie, header

Returns:

See Also:

  • Module::HTTP


84
85
86
# File 'lib/arachni/element/base.rb', line 84

def method
    @method.freeze
end

#method=(method) ⇒ Object

See Also:



89
90
91
92
93
# File 'lib/arachni/element/base.rb', line 89

def method=( method )
    @method = method
    rehash
    self.method
end

#simpleObject

Must provide a simple hash representation of self



69
70
71
# File 'lib/arachni/element/base.rb', line 69

def simple
    {}
end

#typeObject

Must provide the element type, one of Module::Auditor::Element.



132
133
134
# File 'lib/arachni/element/base.rb', line 132

def type
    self.class.name.split( ':' ).last.downcase
end

#urlString

The URL of the page that owns the element.

Returns:



118
119
120
# File 'lib/arachni/element/base.rb', line 118

def url
    @url.freeze
end

#url=(url) ⇒ Object

See Also:



123
124
125
126
127
# File 'lib/arachni/element/base.rb', line 123

def url=( url )
    @url = normalize_url( url )
    rehash
    self.url
end