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