Clean up a little CMDStager methods

bug/bundler_fix
jvazquez-r7 2014-02-08 16:51:29 -06:00 committed by Spencer McIntyre
parent 8db7ec683f
commit 37d0dd59e8
1 changed files with 19 additions and 14 deletions

View File

@ -132,10 +132,17 @@ module Exploit::CmdStager
print_status("Command Stager progress - %7s done (%d/%d bytes)" % [percent, sent, total]) print_status("Command Stager progress - %7s done (%d/%d bytes)" % [percent, sent, total])
end end
#
# Create an instance of the flavored stager
#
def create_stager def create_stager
STAGERS[flavor].new(exe) STAGERS[flavor].new(exe)
end end
#
# Guess the default decoder stub if there is one defined for
# the flavor
#
def guess_decoder def guess_decoder
return nil unless STUBS.key?(flavor) return nil unless STUBS.key?(flavor)
@ -185,21 +192,20 @@ module Exploit::CmdStager
end end
def guess_flavor def guess_flavor
c_platform = nil return nil unless target_platform.names.length == 1
if target_platform.names.length == 1 c_platform = target_platform.names.first
c_platform = target_platform.names.first
end
case c_platform case c_platform
when 'linux', 'Linux' when /linux/i
return :bourne :bourne
when 'osx', 'OSX' when /osx/i
return :bourne :bourne
when 'unix', 'Unix' when /unix/i
return :bourne :bourne
when 'win', 'Windows' when /win/i
return :vbs :vbs
else
nil
end end
return nil
end end
def target_flavor def target_flavor
@ -212,7 +218,6 @@ module Exploit::CmdStager
target_flavor.nil? || target_flavor == flavor || target_flavor.include?(flavor) target_flavor.nil? || target_flavor == flavor || target_flavor.include?(flavor)
end end
# #
# Methods to override - not used internally # Methods to override - not used internally
# #