Class: Arachni::Element::UIInput

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

Overview

Author:

  • Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com>

Defined Under Namespace

Classes: DOM

Constant Summary collapse

SUPPORTED_TYPES =
%w(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, #raw_inputs

Attributes included from Capabilities::WithAuditor

#auditor

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?, #initialize, #inputtable_id, inputtable_id, #raw_input?, #reset, #to_h, #try_input, #update, #updated?, #valid_input_data?, #valid_input_name?, #valid_input_name_data?, #valid_input_value?, #valid_input_value_data?

Methods included from Capabilities::WithAuditor

#dup, #marshal_dump, #orphan?, #prepare_for_report, #remove_auditor

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, available_port_mutex, #bytes_to_kilobytes, #bytes_to_megabytes, #caller_name, #caller_path, #cookie_decode, #cookie_encode, #cookies_from_file, #cookies_from_parser, #cookies_from_response, #exception_jail, #exclude_path?, #follow_protocol?, #form_decode, #form_encode, #forms_from_parser, #forms_from_response, #full_and_absolute_url?, #generate_token, #get_path, #hms_to_seconds, #html_decode, #html_encode, #include_path?, #links_from_parser, #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
# File 'lib/arachni/element/ui_input.rb', line 25

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

    return inputs if !browser.javascript.supported? || !in_html?( page.body )

    browser.each_element_with_events SUPPORTED_TYPES do |locator, events|
        next if locator.attributes['type'] && locator.attributes['type'] != 'text'

        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

.in_html?(html) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/arachni/element/ui_input.rb', line 51

def self.in_html?( html )
    with_textarea_in_html?( html ) || with_input_in_html?( html )
end

.typeObject



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

def self.type
    :ui_input
end

.with_input_in_html?(html) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/arachni/element/ui_input.rb', line 59

def self.with_input_in_html?( html )
    html.has_html_tag?( 'input', /text|(?!type=)/ )
end

.with_textarea_in_html?(html) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/arachni/element/ui_input.rb', line 55

def self.with_textarea_in_html?( html )
    html.has_html_tag?( 'textarea' )
end