Revert downcase throughout, instead use single downcase within option parsing

GSoC/Meterpreter_Web_Console
Kevin Kirsche 2018-11-04 08:57:45 -05:00
parent aadefdbc82
commit 9f77966ec9
3 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@ module Buffer
buf = encrypt_buffer(buf, encryption_opts)
end
case fmt.downcase
case fmt
when 'raw'
when 'num'
buf = Rex::Text.to_num(buf)
@ -69,7 +69,7 @@ module Buffer
# raw, ruby, python, perl, bash, js_be, js_le, c, and java.
#
def self.comment(buf, fmt = "ruby")
case fmt.downcase
case fmt
when 'raw'
when 'num', 'dword', 'dw', 'hex'
buf = Rex::Text.to_js_comment(buf)
@ -138,7 +138,7 @@ module Buffer
def self.encrypt_buffer(value, encryption_opts)
buf = ''
case encryption_opts[:format].downcase
case encryption_opts[:format]
when 'aes256'
if encryption_opts[:iv].blank?
raise ArgumentError, 'Initialization vector is missing'

View File

@ -316,7 +316,7 @@ module Msf
def generate_java_payload
payload_module = framework.payloads.create(payload)
payload_module.datastore.import_options_from_hash(datastore)
case format.downcase
case format
when "raw", "jar"
if payload_module.respond_to? :generate_jar
payload_module.generate_jar.pack
@ -373,7 +373,7 @@ module Msf
elsif gen_payload.length > @space and not @smallest
raise PayloadSpaceViolation, 'The payload exceeds the specified space'
else
if format.to_s.downcase != 'raw'
if format.to_s != 'raw'
cli_print "Final size of #{format} file: #{gen_payload.length} bytes"
end

View File

@ -90,7 +90,7 @@ def parse_args(args)
end
opt.on('-f', '--format <format>', String, "Output format (use --list formats to list)") do |f|
opts[:format] = f
opts[:format] = f.downcase
end
opt.on('-e', '--encoder <encoder>', String, 'The encoder to use (use --list encoders to list)') do |e|