Class: Arachni::Element::DOM

Inherits:
Base show all
Includes:
Capabilities::WithSource
Defined in:
lib/arachni/element/dom.rb,
lib/arachni/element/dom/capabilities/mutable.rb,
lib/arachni/element/dom/capabilities/auditable.rb,
lib/arachni/element/dom/capabilities/locatable.rb,
lib/arachni/element/dom/capabilities/inputtable.rb,
lib/arachni/element/dom/capabilities/submittable.rb

Overview

Author:

Defined Under Namespace

Modules: Capabilities

Constant Summary

Constants inherited from Base

Base::MAX_SIZE

Instance Attribute Summary collapse

Attributes included from Capabilities::WithSource

#source

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Capabilities::WithSource

#to_h, #to_rpc_data

Methods inherited from Base

#==, from_rpc_data, #hash, #id, #marshal_load, #persistent_hash, #reset, #to_h, #to_hash, #to_rpc_data, too_big?, #type, type, #url

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

Methods included from Capabilities::WithScope

#scope

Constructor Details

#initialize(options) ⇒ DOM

Returns a new instance of DOM.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/arachni/element/dom.rb', line 30

def initialize( options )
    options = options.dup
    @parent = options.delete(:parent)

    if parent
        @url    = parent.url.dup.freeze    if parent.url
        @action = parent.action.dup.freeze if parent.action
        @page   = parent.page              if parent.page
        @source = parent.source.dup.freeze if parent.respond_to?(:source) && parent.source
    else
        @url    = options[:url].freeze
        @action = options[:action].freeze
        @page   = options[:page]
        @source = options[:source].freeze
    end

    @audit_options = {}
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



28
29
30
# File 'lib/arachni/element/dom.rb', line 28

def action
  @action
end

#browserBrowser

Returns:



26
27
28
# File 'lib/arachni/element/dom.rb', line 26

def browser
  @browser
end

#parentElement::Base

Returns:



23
24
25
# File 'lib/arachni/element/dom.rb', line 23

def parent
  @parent
end

Class Method Details

.decode(string) ⇒ Object



110
111
112
# File 'lib/arachni/element/dom.rb', line 110

def self.decode( string )
    string
end

.encode(string) ⇒ Object



106
107
108
# File 'lib/arachni/element/dom.rb', line 106

def self.encode( string )
    string
end

Instance Method Details

#decode(string) ⇒ Object



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

def decode( string )
    self.class.decode( string )
end

#dupObject



81
82
83
# File 'lib/arachni/element/dom.rb', line 81

def dup
    super.tap { |new| new.parent = parent }
end

#encode(string) ⇒ Object



98
99
100
# File 'lib/arachni/element/dom.rb', line 98

def encode( string )
    self.class.encode( string )
end

#initialization_optionsObject



89
90
91
92
93
94
95
96
# File 'lib/arachni/element/dom.rb', line 89

def initialization_options
    options = {}
    options[:url]    = @url.dup    if @url
    options[:action] = @action.dup if @action
    # options[:page]   = @page       if @page
    options[:source] = @source.dup if @source
    options
end

#marshal_dumpObject



85
86
87
# File 'lib/arachni/element/dom.rb', line 85

def marshal_dump
    super.reject{ |k, _| [:@parent, :@page, :@browser, :@element].include? k }
end

#pageObject



57
58
59
60
# File 'lib/arachni/element/dom.rb', line 57

def page
    return @page if @page
    @page = parent.page if parent
end

#prepare_for_reportObject

Removes the associated #page, #parent and #browser



72
73
74
75
76
77
78
79
# File 'lib/arachni/element/dom.rb', line 72

def prepare_for_report
    super

    @page    = nil
    @parent  = nil
    @element = nil
    @browser = nil
end

#triggerArray<Page::DOM::Transition>

This method is abstract.

Triggers the event on the subject #element.



67
68
69
# File 'lib/arachni/element/dom.rb', line 67

def trigger
    fail NotImplementedError
end

#url=Object



49
50
51
# File 'lib/arachni/element/dom.rb', line 49

def url=(*)
    # NOP
end