Sha256: e7db138bf34db3153671ffb0493b4566935c29ad99c084ca44fc52eefe4577da

Contents?: true

Size: 1.52 KB

Versions: 42

Compression:

Stored size: 1.52 KB

Contents

module Rex
module Payloads
module Win32

require 'rex/payloads/win32/kernel/common'
require 'rex/payloads/win32/kernel/recovery'
require 'rex/payloads/win32/kernel/stager'
require 'rex/payloads/win32/kernel/migration'

module Kernel

	#
	# Constructs a kernel-mode payload using the supplied options.  The options
	# can be:
	#
	# Recovery      : The recovery method to use, such as 'spin'.
	# Stager        : The stager method to use, such as 'sud_syscall_hook'.
	# RecoveryStub  : The recovery stub that should be used, if any.
	# UserModeStub  : The user-mode payload to execute, if any.
	# KernelModeStub: The kernel-mode payload to execute, if any.
	#
	def self.construct(opts = {})
		payload = nil

		# Generate the recovery stub
		if opts['Recovery'] and Kernel::Recovery.respond_to?(opts['Recovery'])
			opts['RecoveryStub'] = Kernel::Recovery.send(opts['Recovery'], opts)
		end

		# Append supplied recovery stub information in case there is some
		# context specific recovery that must be done.
		if opts['AppendRecoveryStub']
			opts['RecoveryStub'] = (opts['RecoveryStub'] || '') + opts['AppendRecoveryStub']
		end

		# Generate the stager
		if opts['Stager'] and Kernel::Stager.respond_to?(opts['Stager'])
			payload = Kernel::Stager.send(opts['Stager'], opts)
		# Or, generate the migrator
		elsif opts['Migrator'] and Kernel::Migration.respond_to?(opts['Migrator'])
			payload = Kernel::Migration.send(opts['Migrator'], opts)
		else
			raise ArgumentError, "A stager or a migrator must be specified."
		end

		payload
	end

end

end
end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
librex-0.0.65 lib/rex/payloads/win32/kernel.rb
librex-0.0.63 lib/rex/payloads/win32/kernel.rb
librex-0.0.54 lib/rex/payloads/win32/kernel.rb
librex-0.0.53 lib/rex/payloads/win32/kernel.rb
librex-0.0.52 lib/rex/payloads/win32/kernel.rb
librex-0.0.51 lib/rex/payloads/win32/kernel.rb
librex-0.0.50 lib/rex/payloads/win32/kernel.rb
librex-0.0.49 lib/rex/payloads/win32/kernel.rb
librex-0.0.48 lib/rex/payloads/win32/kernel.rb
librex-0.0.47 lib/rex/payloads/win32/kernel.rb
librex-0.0.46 lib/rex/payloads/win32/kernel.rb
librex-0.0.44 lib/rex/payloads/win32/kernel.rb
librex-0.0.43 lib/rex/payloads/win32/kernel.rb
librex-0.0.42 lib/rex/payloads/win32/kernel.rb
librex-0.0.41 lib/rex/payloads/win32/kernel.rb
librex-0.0.40 lib/rex/payloads/win32/kernel.rb
librex-0.0.39 lib/rex/payloads/win32/kernel.rb
librex-0.0.38 lib/rex/payloads/win32/kernel.rb
librex-0.0.37 lib/rex/payloads/win32/kernel.rb
librex-0.0.36 lib/rex/payloads/win32/kernel.rb