Improve the guess_flavor logic to pull from module info

bug/bundler_fix
Spencer McIntyre 2014-04-30 10:07:06 -04:00
parent 952c935730
commit ea077b2f12
1 changed files with 15 additions and 1 deletions

View File

@ -226,11 +226,25 @@ module Exploit::CmdStager
guess_flavor
end
# Guess the cmd stager flavor to use using the target platform.
# Guess the cmd stager flavor to use using information from the module,
# target or platform.
#
# @return [Symbol] The cmd stager flavor to use.
# @return [nil] if the cmd stager flavor can not be guessed.
def guess_flavor
# First try to guess a compatible flavor based on the module & target information.
unless target_flavor.nil?
case target_flavor.class.to_s
when 'Array'
return target_flavor[0].to_sym
when 'String'
return target_flavor.to_sym
when 'Symbol'
return target_flavor
end
end
# Second try to guess a compatible flavor based on the target platform.
return nil unless target_platform.names.length == 1
c_platform = target_platform.names.first
case c_platform