class TurboRex::Fuzzer::COMFuzzer::ParamBuilder

Public Class Methods

new(index, args) click to toggle source
# File lib/turborex/fuzzer.rb, line 34
def initialize(index, args)
  @args = args
  @struct = Parameter.new
  @struct.index = index
end

Public Instance Methods

build() click to toggle source
# File lib/turborex/fuzzer.rb, line 74
def build
  @struct
end
container(c) click to toggle source
# File lib/turborex/fuzzer.rb, line 40
def container(c)
  @struct.container = c
end
fixed(value) click to toggle source
# File lib/turborex/fuzzer.rb, line 70
def fixed(value)
  @struct.fixed = value
end
mutator(m) click to toggle source
# File lib/turborex/fuzzer.rb, line 66
def mutator(m)
  @struct.mutator = m
end
seed(s, opts = {}) click to toggle source
# File lib/turborex/fuzzer.rb, line 44
def seed(s, opts = {})

  if s.is_a?(Array)
  elsif s.is_a?(TurboRex::Fuzzer::Seed)
    s = [s]
  else
    raise "Invalid seed type: #{s.class}"
  end

  @struct.seed = s

  if opts[:depends_on] && opts[:relationship]
    depends_arg = @args.find {|a| a.name == opts[:depends_on].to_s}
    unless depends_arg
      raise "No such parameter: #{opts[:depends_on]}"
    end

    @struct.depends_on = opts[:depends_on]
    @struct.relationship = opts[:relationship]
  end
end