class TurboRex::Fuzzer::COMFuzzer::TargetBuilder

Public Class Methods

new() click to toggle source
# File lib/turborex/fuzzer.rb, line 80
def initialize
  @params = []
end

Public Instance Methods

build() click to toggle source
# File lib/turborex/fuzzer.rb, line 103
def build
  Target.new(@clsid, @interface, @method, @params, @context)
end
clsid(clsid) click to toggle source
# File lib/turborex/fuzzer.rb, line 88
def clsid(clsid)
  @clsid = clsid
end
context(context) click to toggle source
# File lib/turborex/fuzzer.rb, line 92
def context(context)
  @context = context
end
interface(iface) click to toggle source
# File lib/turborex/fuzzer.rb, line 84
def interface(iface)
  @interface = iface
end
method(name) click to toggle source
# File lib/turborex/fuzzer.rb, line 96
def method(name)
  method = @interface.methods.find {|m| m.name == name.to_s}
  raise "No such method #{name}" unless method

  @method = method
end
method_missing(m, *args, &block) click to toggle source
Calls superclass method
# File lib/turborex/fuzzer.rb, line 107
def method_missing(m, *args, &block)
  if m.to_s.start_with?('param_')
    name = m.to_s.split('param_')[-1]

    index = @method.type.args.index {|a| a.name == name}
    raise "No such parameter #{name}" unless index
    arg = @method.type.args[index]
    raise "The THIS pointer can't be specified." if index == 0
    @params[index-1] = Docile.dsl_eval(ParamBuilder.new(index-1, @method.type.args), &block).build
  else
    super(m, *args, &block)
  end
end