Class: Arachni::Element::UIInput

Inherits:
Base show all
Includes:
Capabilities::DOMOnly
Defined in:
lib/arachni/element/ui_input.rb,
lib/arachni/element/input/dom.rb

Overview

Author:

Defined Under Namespace

Classes: DOM

Constant Summary collapse

SUPPORTED_TYPES =
Set.new([:input, :textarea])

Constants included from Capabilities::Inputtable

Capabilities::Inputtable::INPUTTABLE_CACHE

Constants inherited from Base

Base::MAX_SIZE

Instance Attribute Summary

Attributes included from Capabilities::DOMOnly

#method

Attributes included from Capabilities::WithDOM

#dom, #skip_dom

Attributes included from Capabilities::WithSource

#source

Attributes included from Capabilities::Inputtable

#default_inputs, #inputs

Attributes inherited from Base

#initialization_options, #page

Class Method Summary collapse

Methods included from Capabilities::DOMOnly

#coverage_hash, #coverage_id, #dup, #id, #initialize, #mutation?, #type

Methods included from Capabilities::WithDOM

#dup, #skip_dom?

Methods included from Capabilities::WithNode

#node

Methods included from Capabilities::WithSource

#dup, #initialize, #to_h, #to_rpc_data

Methods included from Capabilities::Inputtable

#[], #[]=, #changes, #dup, #has_inputs?, #inputtable_id, #reset, #to_h, #try_input, #update, #valid_input_data?, #valid_input_name?, #valid_input_name_data?, #valid_input_value?, #valid_input_value_data?

Methods inherited from Base

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

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

#scope

Class Method Details

.from_browser(browser, page) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/arachni/element/ui_input.rb', line 25

def self.from_browser( browser, page )
    inputs = []

    return inputs if !browser.javascript.supported?

    if page.document.css( 'textarea' ).empty? &&
        page.document.xpath( '//input[@type="text"]' ).empty? &&
            page.document.xpath( '//input[not(@type)]' ).empty?
        return inputs
    end

    browser.each_element_with_events false do |locator, events|
        next if !SUPPORTED_TYPES.include?( locator.tag_name )
        next if locator.attributes['type'] &&
            locator.attributes['type'] != 'text'

        browser.filter_events( locator.tag_name, events ).each do |event, _|
            name = locator.attributes['name'] || locator.attributes['id'] ||
                locator.to_s

            inputs << new(
                action: page.url,
                source: locator.to_s,
                method: event,
                inputs: {
                    name => locator.attributes['value'].to_s
                }
            )
        end
    end

    inputs
end

.typeObject



21
22
23
# File 'lib/arachni/element/ui_input.rb', line 21

def self.type
    :ui_input
end