Class: Arachni::Support::KeyFiller
- Defined in:
- lib/arachni/support/key_filler.rb
Overview
Tries to fill in input parameters with values of proper type based on their name.
Class Method Summary collapse
-
.fill(parameters, default = '1') ⇒ Hash
Tries to fill a hash with values of appropriate type based on the key of the parameter.
- .name_to_value(name, default = nil) ⇒ Object
-
.regexps ⇒ Hash<Regexp, String>
Patterns for parameter names and the values to to fill in.
Class Method Details
.fill(parameters, default = '1') ⇒ Hash
Tries to fill a hash with values of appropriate type based on the key of the parameter.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/arachni/support/key_filler.rb', line 49 def fill( parameters, default = '1' ) parameters = parameters.dup parameters.each do |k, v| next if !v.to_s.empty? # moronic default value... # will figure out something better in the future... parameters[k] = name_to_value( k, default ) end parameters end |
.name_to_value(name, default = nil) ⇒ Object
60 61 62 63 |
# File 'lib/arachni/support/key_filler.rb', line 60 def name_to_value( name, default = nil ) regexps.each { |k, v| return v if name =~ k } default.to_s end |
.regexps ⇒ Hash<Regexp, String>
Returns Patterns for parameter names and the values to to fill in.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/arachni/support/key_filler.rb', line 27 def regexps @regexps ||= { /name/i => 'arachni_name', /user/i => 'arachni_user', /usr/i => 'arachni_user', /pass/i => '5543!%arachni_secret', /txt/i => 'arachni_text', /num/i => '132', /amount/i => '100', /mail/i => '[email protected]', /account/i => '12', /id/i => '1' } end |