Sha256: b2e55d9eaf2a6239edec3272fa9daa2afabec3c50a60bc8fae1cd360a0617953

Contents?: true

Size: 980 Bytes

Versions: 9

Compression:

Stored size: 980 Bytes

Contents

module Relevance
  module Tarantula

    class 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

  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
codez-tarantula-0.5.3 lib/relevance/tarantula/basic_attack.rb
codez-tarantula-0.5.1 lib/relevance/tarantula/basic_attack.rb
codez-tarantula-0.5.0 lib/relevance/tarantula/basic_attack.rb
tarantula-0.5.1 lib/relevance/tarantula/basic_attack.rb
tarantula-0.5.0 lib/relevance/tarantula/basic_attack.rb
tarantula-0.4.3 lib/relevance/tarantula/basic_attack.rb
tarantula-0.4.2 lib/relevance/tarantula/basic_attack.rb
tarantula-0.4.1 lib/relevance/tarantula/basic_attack.rb
tarantula-0.4.0 lib/relevance/tarantula/basic_attack.rb