Class: Arachni::Module::KeyFiller

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

Overview

KeyFiller class

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

@author: Anastasios “Zapotek” Laskos

                                     <tasos.laskos@gmail.com>
                                     <zapotek@segfault.gr>

@version: 0.1-pre

Constant Summary

@@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'    => 'arachni@email.gr',
    'account' => '12',
    'id'      => '1'
}

Class Method Summary (collapse)

Class Method Details

+ (Hash) fill(hash)

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

Parameters:

  • (Hash) hash

    hash of name=>value pairs

Returns:

  • (Hash)


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

def self.fill( hash )
    
    hash.keys.each{
        |key|
        
        next if hash[key] && !hash[key].empty?
        
        if val = self.match?( key )
            hash[key] = val
        end
        
        hash[key] = 'arachni_default' if( !hash[key] )
    }
    
    return hash
end