2005-07-15 22:30:04 +00:00
|
|
|
require 'msf/base'
|
|
|
|
|
2005-07-14 06:34:58 +00:00
|
|
|
module Msf
|
|
|
|
module Simple
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Exploit
|
|
|
|
# -------
|
|
|
|
#
|
|
|
|
# A simplified exploit wrapper.
|
|
|
|
#
|
|
|
|
###
|
2005-07-14 07:32:11 +00:00
|
|
|
module Exploit
|
2005-07-15 22:30:04 +00:00
|
|
|
|
|
|
|
include Module
|
|
|
|
|
|
|
|
#
|
|
|
|
# Wraps the exploitation process
|
|
|
|
#
|
|
|
|
def self.exploit_simple(exploit, opts)
|
|
|
|
target_idx = opts['Target'].to_i || exploit.default_target
|
|
|
|
|
|
|
|
# Make sure parameters are valid.
|
|
|
|
if (opts['Payload'] == nil)
|
|
|
|
raise MissingPayloadError,
|
|
|
|
"You must specify a payload.", caller
|
|
|
|
end
|
|
|
|
|
|
|
|
if (target_idx == nil)
|
|
|
|
raise MissingTargetError,
|
|
|
|
"You must select a target.", caller
|
|
|
|
end
|
|
|
|
|
|
|
|
# Start it up
|
|
|
|
driver = ExploitDriver.new(exploit.framework)
|
|
|
|
|
|
|
|
# Initialize the driver instance
|
|
|
|
driver.exploit = exploit
|
|
|
|
driver.target_idx = target_idx
|
|
|
|
driver.payload = exploit.framework.modules.create(opts['Payload'])
|
|
|
|
|
|
|
|
# Force the payload to share the exploit's datastore
|
|
|
|
driver.payload.share_datastore(driver.exploit.datastore)
|
|
|
|
|
|
|
|
# Let's rock this party
|
|
|
|
session = driver.run
|
|
|
|
|
|
|
|
return session
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Calls the class method
|
|
|
|
#
|
|
|
|
def exploit_simple(opts)
|
|
|
|
Msf::Simple::Exploit.exploit_simple(self, opts)
|
|
|
|
end
|
|
|
|
|
2005-07-14 06:34:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|