lib/ronin/exploits/binary_exploit.rb in ronin-exploits-0.1.0 vs lib/ronin/exploits/binary_exploit.rb in ronin-exploits-0.1.1
- old
+ new
@@ -37,18 +37,20 @@
# Targets of the exploit
has n, :targets, :class_name => 'ExploitTarget'
# Target index to use
parameter :target_index,
- :value => 0,
+ :default => 0,
:description => 'default target index'
# Custom target to use
parameter :custom_target, :description => 'custom target'
# String to pad extra space with
- parameter :pad, :value => 'A', :description => 'padding string'
+ parameter :pad,
+ :default => 'A',
+ :description => 'padding string'
# Restricted characters that may not occurr in the built exploit
attr_accessor :restricted
# The built exploit
@@ -63,13 +65,17 @@
@restricted = Chars::CharSet.new(attributes[:restricted] || [])
end
#
# Adds an ExploitTarget with the given _attributes_. If a _block_ is
- # given, it will be passed the ExploitTarget.
+ # given, it will be passed to the newly created ExploitTarget
+ # object.
#
def target(attributes={},&block)
- @targets << ExploitTarget.first_or_create(attributes,&block)
+ self.targets << ExploitTarget.new(
+ attributes.merge(:exploit => self),
+ &block
+ )
end
#
# Returns the selected target.
#