class Arachni::Element::UIInput

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

Constants

SUPPORTED_TYPES

Private Class Methods

from_browser( browser, page ) click to toggle source
# 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 ) click to toggle source
# 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
type() click to toggle source
# File lib/arachni/element/ui_input.rb, line 21
def self.type
    :ui_input
end
with_input_in_html?( html ) click to toggle source
# 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 ) click to toggle source
# File lib/arachni/element/ui_input.rb, line 55
def self.with_textarea_in_html?( html )
    html.has_html_tag?( 'textarea' )
end