Make some methods not dependant of the instance flavor

bug/bundler_fix
jvazquez-r7 2014-02-08 21:23:29 -06:00 committed by Spencer McIntyre
parent 45248dcdec
commit 160147b370
1 changed files with 10 additions and 8 deletions

View File

@ -172,7 +172,7 @@ module Exploit::CmdStager
raise ArgumentError, "Unable to select CMD Stager" if flavor.nil? raise ArgumentError, "Unable to select CMD Stager" if flavor.nil?
raise ArgumentError, "The CMD Stager selected isn't compatible with the target" unless compatible?(flavor) raise ArgumentError, "The CMD Stager selected isn't compatible with the target" unless compatible?(flavor)
self.decoder = select_decoder(opts) self.decoder = select_decoder(opts)
raise ArgumentError, "Unable to select decoder stub" if decoder.nil? && decoder_required? raise ArgumentError, "Unable to select decoder stub" if decoder.nil? && decoder_required?(flavor)
end end
@ -195,21 +195,23 @@ module Exploit::CmdStager
STAGERS[flavor][:klass].new(exe) STAGERS[flavor][:klass].new(exe)
end end
# Returns the default decoder stub for the current cmd stager flavor. # Returns the default decoder stub for the input flavor.
# #
# @param f [Symbol] the input flavor.
# @return [Symbol] the decoder. # @return [Symbol] the decoder.
# @return [nil] if there isn't a default decoder to use for the current # @return [nil] if there isn't a default decoder to use for the current
# cmd stager flavor. # cmd stager flavor.
def default_decoder def default_decoder(f)
DECODERS[flavor] DECODERS[f]
end end
# Returns the better cmd stager decoder stub to use for the current flavor. # Returns the better cmd stager decoder stub to use for the input flavor.
# #
# @param f [Symbol] the input flavor.
# @return [Symbol] the decoder to use. # @return [Symbol] the decoder to use.
# @return [nil] if there isn't a best decoder to use for the current flavor. # @return [nil] if there isn't a best decoder to use for the current flavor.
def decoder_required? def decoder_required?(f)
STAGERS[flavor][:decoder] STAGERS[f][:decoder]
end end
# Selects the correct cmd stager decoder to use based on three rules: (1) use # Selects the correct cmd stager decoder to use based on three rules: (1) use
@ -225,7 +227,7 @@ module Exploit::CmdStager
def select_decoder(opts) def select_decoder(opts)
return opts[:decoder].to_sym if opts.include?(:decoder) return opts[:decoder].to_sym if opts.include?(:decoder)
return datastore['CMDSTAGER::DECODER'].to_sym unless datastore['CMDSTAGER::DECODER'].blank? return datastore['CMDSTAGER::DECODER'].to_sym unless datastore['CMDSTAGER::DECODER'].blank?
default_decoder default_decoder(flavor)
end end
# Selects the correct cmd stager to use based on three rules: (1) use the # Selects the correct cmd stager to use based on three rules: (1) use the