Module: Arachni::Element::Capabilities::Auditable::DOM
Overview
Provides access to DOM operations for elements.
Defined Under Namespace
Modules: ClassMethods
Constant Summary
collapse
- INVALID_INPUT_DATA =
[ "\0" ]
OPTIONS
Constants included
from Mutable
Mutable::EXTRA_NAME, Mutable::FUZZ_NAME, Mutable::FUZZ_NAME_VALUE, Mutable::MUTATION_OPTIONS
Constants included
from Inputtable
Inputtable::INPUTTABLE_CACHE
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
Class Method Summary
collapse
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, #inspect, #mutation?, #mutations, #reset, #switch_method, #to_h, #to_rpc_data
#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, #bytes_to_kilobytes, #bytes_to_megabytes, #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, #full_and_absolute_url?, #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?, #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
Instance Attribute Details
Returns the value of attribute action.
30
31
32
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 30
def action
@action
end
|
28
29
30
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 28
def browser
@browser
end
|
25
26
27
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 25
def parent
@parent
end
|
Class Method Details
.included(parent) ⇒ Object
38
39
40
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 38
def self.included( parent )
parent.extend ClassMethods
end
|
Instance Method Details
#decode(string) ⇒ Object
160
161
162
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 160
def decode( string )
self.class.decode( string )
end
|
139
140
141
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 139
def dup
super.tap { |new| new.parent = parent }
end
|
#element ⇒ Watir::HTMLElement
89
90
91
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 89
def element
@element ||= locate
end
|
#encode(string) ⇒ Object
156
157
158
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 156
def encode( string )
self.class.encode( string )
end
|
#initialization_options ⇒ Object
147
148
149
150
151
152
153
154
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 147
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
|
#initialize(options) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 52
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
|
Locates the element in the page.
119
120
121
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 119
def locate
locator.locate( browser )
end
|
114
115
116
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 114
def locator
@locator ||= Browser::ElementLocator.from_node( node )
end
|
#marshal_dump ⇒ Object
143
144
145
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 143
def marshal_dump
super.reject{ |k, _| [:@parent, :@page, :@browser, :@element].include? k }
end
|
83
84
85
86
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 83
def page
return @page if @page
@page = parent.page if parent
end
|
#prepare_for_report ⇒ Object
131
132
133
134
135
136
137
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 131
def prepare_for_report
super
@page = nil
@parent = nil
@element = nil
@browser = nil
end
|
#submit(options = {}, &block) ⇒ Object
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 96
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.
126
127
128
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 126
def trigger
fail NotImplementedError
end
|
71
72
73
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 71
def url=(*)
end
|
79
80
81
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 79
def valid_input_data?( data )
!INVALID_INPUT_DATA.find { |c| data.include? c }
end
|
#with_browser(&block) ⇒ Object
36
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 36
def_delegator :auditor, :with_browser
|
#with_browser_cluster(&block) ⇒ Object
33
|
# File 'lib/arachni/element/capabilities/auditable/dom.rb', line 33
def_delegator :auditor, :with_browser_cluster
|