Module: Arachni::Element::Capabilities::Auditable::DOM
Overview
Provides access to DOM operations for elements.
Constant Summary
collapse
- INVALID_INPUT_DATA =
[ "\0" ]
OPTIONS
Constants included
from Mutable
Mutable::MUTATION_OPTIONS
Instance Attribute Summary collapse
#audit_options
Attributes included from WithAuditor
#auditor
Attributes included from Mutable
#affected_input_name, #format, #seed
Attributes included from Inputtable
#default_inputs, #inputs
Attributes included from WithNode
#html
Instance Method Summary
collapse
#audit, #audit_id, #audit_status_message, #audit_status_message_action, #audit_verbose_message, #coverage_hash, #coverage_id, #matches_skip_like_blocks?, #reset, reset, #skip?, skip_like
#orphan?, #remove_auditor
Methods included from Mutable
#affected_input_value, #affected_input_value=, #each_mutation, #immutables, #mutation?, #mutations, #reset, #switch_method, #to_h
#http, #http_request, #id, #method, #method=, #platforms, #to_h
Methods included from Inputtable
#[], #[]=, #changes, #has_inputs?, #inputtable_id, #reset, #to_h, #try_input, #update, #valid_input_name?, #valid_input_name_data?, #valid_input_value?, #valid_input_value_data?
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
Methods included from WithNode
#node, #to_h
Instance Attribute Details
Returns the value of attribute action.
32
33
34
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 32
def action
@action
end
|
30
31
32
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 30
def browser
@browser
end
|
27
28
29
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 27
def parent
@parent
end
|
Instance Method Details
126
127
128
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 126
def dup
super.tap { |new| new.parent = parent }
end
|
#element ⇒ Watir::HTMLElement
77
78
79
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 77
def element
@element ||= locate
end
|
#initialization_options ⇒ Object
134
135
136
137
138
139
140
141
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 134
def initialization_options
options = {}
options[:url] = url.dup if @url
options[:action] = @action.dup if @action
options[:page] = page if page
options[:html] = @html.dup if @html
options
end
|
#initialize(options) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 40
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
@html = parent.html.dup.freeze if parent.respond_to?(:html) && parent.html
else
@url = options[:url].freeze
@action = options[:action].freeze
@page = options[:page]
@html = options[:html].freeze
end
@audit_options = {}
end
|
Locates the element in the page.
106
107
108
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 106
def locate
locator.locate( browser )
end
|
101
102
103
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 101
def locator
@locator ||= Browser::ElementLocator.from_node( node )
end
|
#marshal_dump ⇒ Object
130
131
132
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 130
def marshal_dump
super.reject{ |k, _| [:@parent, :@page, :@browser, :@element].include? k }
end
|
71
72
73
74
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 71
def page
return @page if @page
@page = parent.page if parent
end
|
#prepare_for_report ⇒ Object
118
119
120
121
122
123
124
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 118
def prepare_for_report
super
@page = nil
@parent = nil
@element = nil
@browser = nil
end
|
#submit(options = {}, &block) ⇒ Object
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 84
def submit( options = {}, &block )
with_browser do |browser|
prepare_browser( browser, options )
if (transition = trigger) && (page = browser.to_page)
page.dom.transitions << transition
block.call page.tap { |p| p.request.performer = self }
end
@element = nil
@browser = nil
end
nil
end
|
Triggers the event on the subject #element.
113
114
115
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 113
def trigger
fail NotImplementedError
end
|
59
60
61
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 59
def url=(*)
end
|
67
68
69
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 67
def valid_input_data?( data )
!INVALID_INPUT_DATA.find { |c| data.include? c }
end
|
#with_browser(&block) ⇒ Object
38
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 38
def_delegator :auditor, :with_browser
|
#with_browser_cluster(&block) ⇒ Object
35
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 35
def_delegator :auditor, :with_browser_cluster
|