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, "The CMD Stager selected isn't compatible with the target" unless compatible?(flavor)
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
@ -195,21 +195,23 @@ module Exploit::CmdStager
STAGERS[flavor][:klass].new(exe)
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 [nil] if there isn't a default decoder to use for the current
# cmd stager flavor.
def default_decoder
DECODERS[flavor]
def default_decoder(f)
DECODERS[f]
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 [nil] if there isn't a best decoder to use for the current flavor.
def decoder_required?
STAGERS[flavor][:decoder]
def decoder_required?(f)
STAGERS[f][:decoder]
end
# 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)
return opts[:decoder].to_sym if opts.include?(:decoder)
return datastore['CMDSTAGER::DECODER'].to_sym unless datastore['CMDSTAGER::DECODER'].blank?
default_decoder
default_decoder(flavor)
end
# Selects the correct cmd stager to use based on three rules: (1) use the