Class: Arachni::Module::KeyFiller

Inherits:
Object
  • Object
show all
Defined in:
lib/module/key_filler.rb

Overview

KeyFiller class

Included by Auditor.<br/> Tries to fill in webapp parameters with values of proper type based on their name.

@author: Tasos “Zapotek” Laskos

<[email protected]>
<[email protected]>

@version: 0.1.1

Constant Summary collapse

@@regexps =

Hash of regexps for the parameter keys and the values to to fill in

Returns:

  • (Hash)
{
    'name'    => 'arachni_name',
    'user'    => 'arachni_user',
    'usr'     => 'arachni_user',
    'pass'    => '5543!%arachni_secret',
    'txt'     => 'arachni_text',
    'num'     => '132',
    'amount'  => '100',
    'mail'    => '[email protected]',
    'account' => '12',
    'id'      => '1'
}

Class Method Summary collapse

Class Method Details

.fill(hash) ⇒ Hash

Tries to fill a hash with values of appropriate type<br/> based on the key of the parameter.

Parameters:

  • hash (Hash)

    hash of name=>value pairs

Returns:

  • (Hash)


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/module/key_filler.rb', line 54

def self.fill( hash )
    
    hash.keys.each{
        |key|
        
        next if hash[key] && !hash[key].empty?
        
        if val = self.match?( key )
            hash[key] = val
        end
        
        # moronic default value...
        # will figure  out ssomething better in the future...
        hash[key] = '1' if( !hash[key] || hash[key].empty? )
    }
    
    return hash
end