Class: Relevance::Tarantula::BasicAttack
- Defined in:
- lib/relevance/tarantula/basic_attack.rb
Constant Summary collapse
- ATTRS =
[:name, :output, :description]
Instance Method Summary collapse
- #==(other) ⇒ Object
- #big_number ⇒ Object
-
#initialize ⇒ BasicAttack
constructor
A new instance of BasicAttack.
- #input(input_field) ⇒ Object
- #random_int ⇒ Object
- #random_whole_number ⇒ Object
Constructor Details
#initialize ⇒ BasicAttack
Returns a new instance of BasicAttack.
9 10 11 12 13 |
# File 'lib/relevance/tarantula/basic_attack.rb', line 9 def initialize @name = "Tarantula Basic Fuzzer" @output = nil @description = "Supplies purely random but simplistically generated form input." end |
Instance Method Details
#==(other) ⇒ Object
15 16 17 |
# File 'lib/relevance/tarantula/basic_attack.rb', line 15 def ==(other) Relevance::Tarantula::BasicAttack === other && ATTRS.all? { |attr| send(attr) == other.send(attr)} end |
#big_number ⇒ Object
30 31 32 |
# File 'lib/relevance/tarantula/basic_attack.rb', line 30 def big_number 10000 # arbitrary end |
#input(input_field) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/relevance/tarantula/basic_attack.rb', line 19 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 |
#random_int ⇒ Object
34 35 36 |
# File 'lib/relevance/tarantula/basic_attack.rb', line 34 def random_int rand(big_number) - (big_number/2) end |
#random_whole_number ⇒ Object
38 39 40 |
# File 'lib/relevance/tarantula/basic_attack.rb', line 38 def random_whole_number rand(big_number) end |