Class: Arachni::Module::KeyFiller
- Defined in:
- lib/arachni/module/key_filler.rb
Overview
KeyFiller class
Included by Auditor
Tries to fill in input parameters with values of proper type based on their name.
Class Method Summary collapse
-
.fill(parameters) ⇒ 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) ⇒ Hash
Tries to fill a hash with values of appropriate type based on the key of the parameter.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/arachni/module/key_filler.rb', line 56 def self.fill( parameters ) 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, '1' ) end parameters end |
.name_to_value(name, default = nil) ⇒ Object
67 68 69 70 |
# File 'lib/arachni/module/key_filler.rb', line 67 def self.name_to_value( name, default = nil ) regexps.each { |k, v| return v if name =~ k } default end |
.regexps ⇒ Hash<Regexp, String>
Returns Patterns for parameter names and the values to to fill in.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/arachni/module/key_filler.rb', line 33 def self.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 |