Fix #compatible? method
parent
ddd1dd5155
commit
31acc4a528
|
@ -163,6 +163,7 @@ module Exploit::CmdStager
|
|||
# Create an instance of the flavored stager.
|
||||
#
|
||||
# @return [Rex::Exploitation::CmdStagerBase] The cmd stager to use.
|
||||
# @raise [NoMethodError] raised if the flavor doesn't exist.
|
||||
def create_stager
|
||||
STAGERS[flavor].new(exe)
|
||||
end
|
||||
|
@ -233,10 +234,11 @@ module Exploit::CmdStager
|
|||
#
|
||||
# @return [Array] the list of compatible cmd stager flavors.
|
||||
# @return [Symbol] the compatible cmd stager flavor.
|
||||
# @return [String] the compatible cmd stager flavor.
|
||||
# @return [nil] if there isn't any compatible flavor defined.
|
||||
def target_flavor
|
||||
return target.opts['CmdStagerFlavor'].to_sym if target && target.opts['CmdStagerFlavor']
|
||||
return module_info['CmdStagerFlavor'].to_sym if module_info['CmdStagerFlavor']
|
||||
return target.opts['CmdStagerFlavor'] if target && target.opts['CmdStagerFlavor']
|
||||
return module_info['CmdStagerFlavor'] if module_info['CmdStagerFlavor']
|
||||
nil
|
||||
end
|
||||
|
||||
|
@ -245,7 +247,16 @@ module Exploit::CmdStager
|
|||
# @param f [Symbol] The flavor to check
|
||||
# @returns [Boolean] true if compatible, false otherwise.
|
||||
def compatible?(f)
|
||||
target_flavor.nil? || target_flavor == f || target_flavor.include?(f)
|
||||
return true if target_flavor.nil?
|
||||
case target_flavor.class.to_s
|
||||
when 'String'
|
||||
return true if target_flavor == f.to_s
|
||||
when 'Array'
|
||||
target_flavor.each { |tr| return true if tr.to_sym == f }
|
||||
when 'Symbol'
|
||||
return true if target_flavor == f
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
# Code to execute before the cmd stager stub. This method is designed to be
|
||||
|
|
Loading…
Reference in New Issue