Class: Arachni::Element::Form::DOM

Inherits:
Base show all
Includes:
Capabilities::Auditable::DOM, Capabilities::WithNode
Defined in:
lib/arachni/element/form/dom.rb

Overview

Extends Capabilities::Auditable::DOM with Arachni::Element::Form-specific functionality.

Author:

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::EXTRA_NAME, Capabilities::Mutable::FUZZ_NAME, Capabilities::Mutable::FUZZ_NAME_VALUE, Capabilities::Mutable::MUTATION_OPTIONS

Instance Attribute Summary

Attributes included from Capabilities::Auditable::DOM

#action, #browser, #parent

Attributes included from Capabilities::Auditable

#audit_options

Attributes included from Capabilities::WithAuditor

#auditor

Attributes included from Capabilities::Mutable

#affected_input_name, #format, #seed

Attributes included from Capabilities::Inputtable

#default_inputs, #inputs

Attributes included from Capabilities::WithSource

#source

Attributes inherited from Base

#page

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Capabilities::Auditable::DOM

#dup, #element, #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, #inspect, #mutation?, #mutations, #reset, #switch_method, #to_h, #to_rpc_data

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, #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 Capabilities::WithNode

#node

Methods included from Capabilities::WithSource

#dup, #to_h, #to_rpc_data

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, #url, #url=

Methods included from Capabilities::WithScope

#scope

Constructor Details

#initialize(options) ⇒ DOM

Returns a new instance of DOM.



20
21
22
23
24
25
26
27
28
# File 'lib/arachni/element/form/dom.rb', line 20

def initialize( options )
    super

    inputs = (options[:inputs] || self.parent.inputs).dup
    @valid_input_names = inputs.keys.map(&:to_s)

    self.inputs     = inputs
    @default_inputs = self.inputs.dup.freeze
end

Class Method Details

.typeObject



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

def self.type
    :form_dom
end

Instance Method Details

#decode(*args) ⇒ Object



43
44
45
# File 'lib/arachni/element/form/dom.rb', line 43

def decode( *args )
    Form.decode( *args )
end

#encode(*args) ⇒ Object



39
40
41
# File 'lib/arachni/element/form/dom.rb', line 39

def encode( *args )
    Form.encode( *args )
end

#initialization_optionsObject



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

def initialization_options
    super.merge( inputs: inputs.dup )
end

#triggerObject

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



31
32
33
# File 'lib/arachni/element/form/dom.rb', line 31

def trigger
    browser.fire_event element, :submit, inputs: inputs.dup
end

#typeObject



47
48
49
# File 'lib/arachni/element/form/dom.rb', line 47

def type
    self.class.type
end

#valid_input_name?(name) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/arachni/element/form/dom.rb', line 35

def valid_input_name?( name )
    @valid_input_names.include? name.to_s
end