Class: Arachni::Element::UIInput::DOM

Inherits:
DOM show all
Includes:
Capabilities::WithNode, DOM::Capabilities::Auditable, DOM::Capabilities::Inputtable, DOM::Capabilities::Mutable, DOM::Capabilities::Submittable
Defined in:
lib/arachni/element/input/dom.rb

Overview

Author:

Constant Summary

Constants included from Capabilities::Auditable

Capabilities::Auditable::OPTIONS

Constants included from DOM::Capabilities::Inputtable

DOM::Capabilities::Inputtable::INVALID_INPUT_DATA

Constants included from Capabilities::Inputtable

Capabilities::Inputtable::INPUTTABLE_CACHE

Constants included from Capabilities::Mutable

Capabilities::Mutable::EXTRA_NAME, Capabilities::Mutable::FUZZ_NAME, Capabilities::Mutable::FUZZ_NAME_VALUE, Capabilities::Mutable::MUTATION_OPTIONS

Constants inherited from Base

Base::MAX_SIZE

Instance Attribute Summary

Attributes included from Capabilities::Auditable

#audit_options

Attributes included from Capabilities::WithAuditor

#auditor

Attributes included from Capabilities::Inputtable

#default_inputs, #inputs

Attributes included from Capabilities::Mutable

#affected_input_name, #format, #seed

Attributes included from Capabilities::WithSource

#source

Attributes inherited from DOM

#action, #browser, #parent

Attributes inherited from Base

#page

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DOM::Capabilities::Auditable

#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 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

Methods included from DOM::Capabilities::Submittable

#submit

Methods included from Capabilities::Submittable

#action, #action=, #dup, #http, #http_request, #id, #method, #method=, #platforms, #submit, #to_h

Methods included from DOM::Capabilities::Inputtable

#valid_input_data?

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 Capabilities::Mutable

#affected_input_value, #affected_input_value=, #dup, #each_mutation, #immutables, #inspect, #mutation?, #mutations, #reset, #switch_method, #to_h, #to_rpc_data

Methods included from Capabilities::WithNode

#node

Methods included from Capabilities::WithSource

#dup, #to_h, #to_rpc_data

Methods inherited from DOM

#decode, decode, #dup, #element, #encode, encode, #locate, #locator, #marshal_dump, #page, #prepare_for_report, #url=

Methods inherited from Base

#==, #action, #dup, from_rpc_data, #hash, #id, #marshal_dump, #marshal_load, #persistent_hash, #prepare_for_report, #reset, #to_h, #to_hash, #to_rpc_data, too_big?, #url, #url=

Methods included from Capabilities::WithScope

#scope

Constructor Details

#initialize(options) ⇒ DOM

Returns a new instance of DOM.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/arachni/element/input/dom.rb', line 23

def initialize( options )
    super

    self.method = options[:method] || self.parent.method

    if options[:inputs]
        @valid_input_name = options[:inputs].keys.first.to_s
        self.inputs       = options[:inputs]
    else
        @valid_input_name = (locator.attributes['name'] || locator.attributes['id']).to_s
        self.inputs       = {
            @valid_input_name => locator.attributes['value']
        }
    end

    @default_inputs = self.inputs.dup.freeze
end

Class Method Details

.typeObject



61
62
63
# File 'lib/arachni/element/input/dom.rb', line 61

def self.type
    :ui_input_dom
end

Instance Method Details

#initialization_optionsObject



65
66
67
# File 'lib/arachni/element/input/dom.rb', line 65

def initialization_options
    super.merge( inputs: inputs.dup, method: @method )
end

#nameObject



46
47
48
# File 'lib/arachni/element/input/dom.rb', line 46

def name
    inputs.keys.first
end

#triggerObject

Submits the form using the configured Capabilities::Inputtable#inputs.



42
43
44
# File 'lib/arachni/element/input/dom.rb', line 42

def trigger
    [ browser.fire_event( element, @method, value: value ) ]
end

#typeObject



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

def type
    self.class.type
end

#valid_input_name?(name) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/arachni/element/input/dom.rb', line 54

def valid_input_name?( name )
    @valid_input_name == name.to_s
end

#valueObject



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

def value
    inputs.values.first
end