# -*- coding: binary -*-
##
# $Id$
##

require 'msf/core/exploit/cmdstager'

module Msf

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

	include Msf::Exploit::CmdStager

	def initialize(info = {})
		super

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

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

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

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

end
