Sha256: d7610285e1a3f7c4b919da2008e3a963fcf81c8f2044725eb1c832f23c55d15e

Contents?: true

Size: 848 Bytes

Versions: 5

Compression:

Stored size: 848 Bytes

Contents

class Relevance::Tarantula::BasicAttack
  ATTRS = [:name, :output, :description]

  attr_reader *ATTRS

  def initialize
    @name = "Tarantula Basic Fuzzer"
    @output = nil
    @description = "Supplies purely random but simplistically generated form input."
  end

  def ==(other)
    Relevance::Tarantula::BasicAttack === other && ATTRS.all? { |attr| send(attr) == other.send(attr)}
  end

  def input(input_field)
    case input_field['name']
      when /amount/         then random_int
      when /_id$/           then random_whole_number
      when /uploaded_data/  then nil
      when nil              then input['value']
      else
        random_int
    end
  end

  def big_number
    10000   # arbitrary
  end
  
  def random_int
    rand(big_number) - (big_number/2)
  end
  
  def random_whole_number
    rand(big_number)
  end
end


Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
relevance-tarantula-0.3.2 lib/relevance/tarantula/basic_attack.rb
relevance-tarantula-0.3.3 lib/relevance/tarantula/basic_attack.rb
tarantula-rails3-0.3.3 lib/relevance/tarantula/basic_attack.rb
panmind-tarantula-0.3.3 lib/relevance/tarantula/basic_attack.rb
tarantula-0.3.3 lib/relevance/tarantula/basic_attack.rb