lib/ronin/exploits/target.rb in ronin-exploits-0.2.0 vs lib/ronin/exploits/target.rb in ronin-exploits-0.2.1
- old
+ new
@@ -20,14 +20,14 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#++
#
require 'ronin/exploits/exceptions/target_data_missing'
+require 'ronin/exploits/product'
require 'ronin/model/targets_arch'
require 'ronin/model/targets_os'
require 'ronin/model'
-require 'ronin/targeted_product'
require 'dm-types/yaml'
module Ronin
module Exploits
@@ -42,13 +42,11 @@
# Target comments
property :description, String
# Targeted product
- belongs_to :product,
- :child_key => [:product_id],
- :class_name => 'Ronin::TargetedProduct'
+ belongs_to :product
# The exploit the target belongs to
belongs_to :exploit
# The extra target data to use for the exploit
@@ -63,23 +61,23 @@
block.call(self) if block
end
#
- # Returns the TargetedProduct if no _arguments_ are given. If
- # _arguments_ are given, a new TargetedProduct object will be created
- # from the given _arguments_ and associated with the target.
+ # Returns the Product if no _arguments_ are given. If _arguments_ are
+ # given, a new Product object will be created from the given
+ # _arguments_ and associated with the target.
#
# target.product
# # => nil
#
# target.product(:name => 'Apache', :version => '1.3.3.7')
- # # => #<Ronin::TargetedProduct type=Ronin::TargetedProduct
- # # id=nil name="Apache" version="1.3.3.7" vendor="Apache">
+ # # => #<Ronin::Product type=Ronin::Product id=nil name="Apache"
+ # # version="1.3.3.7" vendor="Apache">
#
def product(*arguments)
unless arguments.empty?
- return self.product = TargetedProduct.first_or_create(*arguments)
+ return self.product = Product.first_or_create(*arguments)
else
return product_association
end
end