Class: Arachni::Element::LinkTemplate::DOM
- Includes:
- Capabilities::Auditable::DOM
- Defined in:
- lib/arachni/element/link_template/dom.rb
Overview
Provides access to DOM operations for link templates.
Constant Summary
Constants included from Capabilities::Auditable::DOM
Capabilities::Auditable::DOM::INVALID_INPUT_DATA
Constants included from Capabilities::Auditable
Capabilities::Auditable::OPTIONS
Constants included from Capabilities::Mutable
Capabilities::Mutable::MUTATION_OPTIONS
Instance Attribute Summary collapse
-
#fragment ⇒ String?
readonly
URL fragment.
-
#template ⇒ Regexp
readonly
Regular expressions with named captures, serving as templates used to identify and manipulate inputs in Capabilities::Auditable::DOM#action.
Attributes included from Capabilities::Auditable::DOM
Attributes included from Capabilities::Auditable
Attributes included from Capabilities::WithAuditor
Attributes included from Capabilities::Mutable
#affected_input_name, #format, #seed
Attributes included from Capabilities::Inputtable
Attributes included from Capabilities::WithNode
Attributes inherited from Base
#initialization_options, #page
Class Method Summary collapse
- .data_from_node(node) ⇒ Object
- .decode(*args) ⇒ Object
- .encode(string) ⇒ Object
- .extract_inputs(url, templates = Arachni::Options.audit.link_template_doms) ⇒ Object
- .from_rpc_data(data) ⇒ Object
- .type ⇒ Object
Instance Method Summary collapse
- #decode(*args) ⇒ Object
- #encode(string) ⇒ Object
- #extract_inputs(*args) ⇒ Object
- #hash ⇒ Object
-
#initialize ⇒ DOM
constructor
A new instance of DOM.
- #message_action ⇒ Object
- #to_rpc_data ⇒ Object
-
#to_s ⇒ String
Capabilities::Auditable::DOM#action updated with the the DOM Capabilities::Inputtable#inputs.
-
#trigger ⇒ Object
Loads #to_s.
- #type ⇒ Object
-
#valid_input_name?(name) ⇒ Bool
‘true` if the `name` can be found as a named capture in #template, `false` otherwise.
Methods included from Capabilities::Auditable::DOM
#dup, #element, #initialization_options, #locate, #locator, #marshal_dump, #page, #prepare_for_report, #submit, #url=, #valid_input_data?, #with_browser, #with_browser_cluster
Methods included from Capabilities::Auditable
#audit, #audit_id, #audit_status_message, #audit_status_message_action, #audit_verbose_message, #coverage_hash, #coverage_id, #dup, #matches_skip_like_blocks?, #reset, reset, #skip?, skip_like
Methods included from Capabilities::WithAuditor
#dup, #marshal_dump, #orphan?, #prepare_for_report, #remove_auditor
Methods included from Capabilities::Mutable
#affected_input_value, #affected_input_value=, #dup, #each_mutation, #immutables, #mutation?, #mutations, #reset, #switch_method, #to_h
Methods included from Capabilities::Submittable
#action, #action=, #dup, #http, #http_request, #id, #method, #method=, #platforms, #submit, #to_h
Methods included from Capabilities::Inputtable
#[], #[]=, #changes, #dup, #has_inputs?, #inputtable_id, #reset, #to_h, #try_input, #update, #valid_input_data?, #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 Capabilities::WithNode
Methods inherited from Base
#==, #action, #dup, #id, #marshal_dump, #marshal_load, #persistent_hash, #prepare_for_report, #reset, #to_h, #to_hash, #url, #url=
Methods included from Capabilities::WithScope
Constructor Details
#initialize ⇒ DOM
Returns a new instance of DOM.
30 31 32 33 34 35 |
# File 'lib/arachni/element/link_template/dom.rb', line 30 def initialize(*) super prepare_data_from_node @method = :get end |
Instance Attribute Details
#fragment ⇒ String? (readonly)
Returns URL fragment.
‘test.com/stuff#/path/in/fragment?with-input=too` => `/path/in/fragment?with-input=too`.
23 24 25 |
# File 'lib/arachni/element/link_template/dom.rb', line 23 def fragment @fragment end |
#template ⇒ Regexp (readonly)
Returns Regular expressions with named captures, serving as templates used to identify and manipulate inputs in Capabilities::Auditable::DOM#action.
28 29 30 |
# File 'lib/arachni/element/link_template/dom.rb', line 28 def template @template end |
Class Method Details
.data_from_node(node) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/arachni/element/link_template/dom.rb', line 94 def self.data_from_node( node ) href = node.attributes['href'].to_s return if !href.include? '#' fragment = Link.decode( href.split( '#', 2 ).last.to_s ) template, inputs = extract_inputs( fragment ) return if !template || inputs.empty? { inputs: inputs, template: template, fragment: fragment } end |
.decode(*args) ⇒ Object
82 83 84 |
# File 'lib/arachni/element/link_template/dom.rb', line 82 def self.decode( *args ) Link.decode( *args ) end |
.encode(string) ⇒ Object
74 75 76 |
# File 'lib/arachni/element/link_template/dom.rb', line 74 def self.encode( string ) string end |
.extract_inputs(url, templates = Arachni::Options.audit.link_template_doms) ⇒ Object
66 67 68 |
# File 'lib/arachni/element/link_template/dom.rb', line 66 def self.extract_inputs( url, templates = Arachni::Options.audit.link_template_doms ) LinkTemplate.extract_inputs( url, templates ) end |
.from_rpc_data(data) ⇒ Object
118 119 120 |
# File 'lib/arachni/element/link_template/dom.rb', line 118 def self.from_rpc_data( data ) super data.merge( 'template' => Regexp.new( data['template'] ) ) end |
.type ⇒ Object
90 91 92 |
# File 'lib/arachni/element/link_template/dom.rb', line 90 def self.type :link_template_dom end |
Instance Method Details
#decode(*args) ⇒ Object
78 79 80 |
# File 'lib/arachni/element/link_template/dom.rb', line 78 def decode( *args ) self.class.decode( *args ) end |
#encode(string) ⇒ Object
70 71 72 |
# File 'lib/arachni/element/link_template/dom.rb', line 70 def encode( string ) self.class.encode( string ) end |
#extract_inputs(*args) ⇒ Object
63 64 65 |
# File 'lib/arachni/element/link_template/dom.rb', line 63 def extract_inputs( *args ) self.class.extract_inputs( *args ) end |
#hash ⇒ Object
110 111 112 |
# File 'lib/arachni/element/link_template/dom.rb', line 110 def hash to_s.hash end |
#message_action ⇒ Object
59 60 61 |
# File 'lib/arachni/element/link_template/dom.rb', line 59 def "#{@action}##{fragment}" end |
#to_rpc_data ⇒ Object
114 115 116 |
# File 'lib/arachni/element/link_template/dom.rb', line 114 def to_rpc_data super.merge( 'template' => @template.source ) end |
#to_s ⇒ String
Returns Capabilities::Auditable::DOM#action updated with the the DOM Capabilities::Inputtable#inputs.
55 56 57 |
# File 'lib/arachni/element/link_template/dom.rb', line 55 def to_s "#{@action}#" + fragment.sub_in_groups( @template, inputs ) end |
#trigger ⇒ Object
Loads #to_s.
38 39 40 |
# File 'lib/arachni/element/link_template/dom.rb', line 38 def trigger browser.goto to_s, take_snapshot: false, update_transitions: false end |
#type ⇒ Object
86 87 88 |
# File 'lib/arachni/element/link_template/dom.rb', line 86 def type self.class.type end |
#valid_input_name?(name) ⇒ Bool
Returns ‘true` if the `name` can be found as a named capture in #template, `false` otherwise.
48 49 50 51 |
# File 'lib/arachni/element/link_template/dom.rb', line 48 def valid_input_name?( name ) return if !@template @template.names.include? name end |