Sha256: 480f36c558f49251d13c2fda5cf601e033b69bcea26fbb6f57a7de0b99efa230

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

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)
        return input_field['value'] if input_field['type'] == 'hidden'

        case input_field['name']
        when /amount/         then random_int
        when /_id$/           then random_whole_number
        when /uploaded_data/  then nil
        when nil              then input_field['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

2 entries across 2 versions & 1 rubygems

Version Path
codez-tarantula-0.5.5 lib/relevance/tarantula/basic_attack.rb
codez-tarantula-0.5.4 lib/relevance/tarantula/basic_attack.rb