2005-07-09 21:18:49 +00:00
|
|
|
require 'msf/core'
|
2005-06-05 00:03:23 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Target
|
|
|
|
# ------
|
|
|
|
#
|
|
|
|
# A target for an exploit.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class Msf::Module::Target
|
|
|
|
|
|
|
|
#
|
|
|
|
# Serialize from an array to a Target instance
|
|
|
|
#
|
|
|
|
def self.from_a(ary)
|
|
|
|
return nil if (ary.length < 2)
|
|
|
|
|
2005-06-05 18:03:56 +00:00
|
|
|
self.new(ary.shift, ary.shift)
|
2005-06-05 00:03:23 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Transforms the supplied source into an array of Target's
|
|
|
|
#
|
|
|
|
def self.transform(src)
|
|
|
|
Rex::Transformer.transform(src, Array, [ self, String ], 'Target')
|
|
|
|
end
|
|
|
|
|
2005-06-05 18:03:56 +00:00
|
|
|
#
|
|
|
|
# Init it up!
|
|
|
|
#
|
|
|
|
def initialize(name, opts)
|
|
|
|
opts = {} if (!opts)
|
|
|
|
|
2005-07-11 15:34:31 +00:00
|
|
|
self.name = name
|
|
|
|
self.platforms = Msf::Module::PlatformList.from_a(opts['Platform'])
|
|
|
|
self.save_registers = opts['SaveRegisters']
|
|
|
|
self.ret = opts['Ret']
|
2005-07-12 14:32:44 +00:00
|
|
|
self.bruteforce = opts['Bruteforce']
|
2005-07-11 15:34:31 +00:00
|
|
|
self.opts = opts
|
2005-06-05 00:03:23 +00:00
|
|
|
end
|
|
|
|
|
2005-06-05 18:03:56 +00:00
|
|
|
#
|
|
|
|
# Index the options directly
|
|
|
|
#
|
|
|
|
def [](key)
|
|
|
|
opts[key]
|
|
|
|
end
|
|
|
|
|
2005-07-12 14:32:44 +00:00
|
|
|
#
|
|
|
|
# Returns whether or not this is a bruteforce target, forces boolean
|
|
|
|
# result.
|
|
|
|
#
|
|
|
|
def bruteforce?
|
|
|
|
return (bruteforce != nil)
|
|
|
|
end
|
|
|
|
|
|
|
|
attr_reader :name, :platforms, :opts, :ret, :save_registers
|
|
|
|
attr_reader :bruteforce
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
attr_writer :name, :platforms, :opts, :ret, :save_registers
|
|
|
|
attr_writer :bruteforce
|
2005-06-05 00:33:38 +00:00
|
|
|
|
2005-06-05 00:03:23 +00:00
|
|
|
end
|
|
|
|
|