##
# $Id: cmdstager_debug_write.rb 9375 2010-05-26 22:39:56Z jduck $
##

require 'msf/core/exploit/cmdstager'

module Msf

###
#
# This mixin provides an interface for staging cmd to arbitrary payloads
#
###
module Exploit::CmdStagerDebugWrite

	include Msf::Exploit::CmdStager

	def initialize(info = {})
		super

		register_advanced_options(
			[
				OptString.new( 'DECODERSTUB',  [ true, 'The debug.exe file-writing decoder stub to use.',
					File.join(Msf::Config.install_root, "data", "exploits", "cmdstager", "debug_write")]),
			], self.class)
	end

	def create_stager(exe)
		Rex::Exploitation::CmdStagerDebugWrite.new(exe)
	end

	def execute_cmdstager(opts = {})
		opts.merge!({ :decoder => datastore['DECODERSTUB'] })
		super
	end

end

end
