Land #10802, Make `msfvenom -f` case-insensitive
This commit is contained in:
commit
317f71f7f4
|
@ -14,6 +14,7 @@ module Simple
|
|||
###
|
||||
module Buffer
|
||||
|
||||
class BufferFormatError < ::ArgumentError; end
|
||||
#
|
||||
# Serializes a buffer to a provided format. The formats supported are raw,
|
||||
# num, dword, ruby, python, perl, bash, c, js_be, js_le, java and psh
|
||||
|
@ -58,7 +59,7 @@ module Buffer
|
|||
when 'vbapplication'
|
||||
buf = Rex::Text.to_vbapplication(buf, var_name)
|
||||
else
|
||||
raise ArgumentError, "Unsupported buffer format: #{fmt}", caller
|
||||
raise BufferFormatError, "Unsupported buffer format: #{fmt}", caller
|
||||
end
|
||||
|
||||
return buf
|
||||
|
@ -88,7 +89,7 @@ module Buffer
|
|||
when 'java'
|
||||
buf = Rex::Text.to_c_comment(buf)
|
||||
else
|
||||
raise ArgumentError, "Unsupported buffer format: #{fmt}", caller
|
||||
raise BufferFormatError, "Unsupported buffer format: #{fmt}", caller
|
||||
end
|
||||
|
||||
return buf
|
||||
|
|
|
@ -144,7 +144,7 @@ module Msf
|
|||
@framework = opts.fetch(:framework)
|
||||
|
||||
raise ArgumentError, "Invalid Payload Selected" unless payload_is_valid?
|
||||
raise ArgumentError, "Invalid Format Selected" unless format_is_valid?
|
||||
raise ::Msf::Simple::Buffer::BufferFormatError, "Invalid Format Selected" unless format_is_valid?
|
||||
|
||||
# In smallest mode, override the payload @space & @encoder_space settings
|
||||
if @smallest
|
||||
|
|
5
msfvenom
5
msfvenom
|
@ -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|
|
||||
|
@ -444,6 +444,9 @@ generator_opts[:cli] = true
|
|||
begin
|
||||
venom_generator = Msf::PayloadGenerator.new(generator_opts)
|
||||
payload = venom_generator.generate_payload
|
||||
rescue ::Msf::Simple::Buffer::BufferFormatError => e
|
||||
$stderr.puts "Error: #{e.message}"
|
||||
$stderr.puts dump_formats
|
||||
rescue ::Exception => e
|
||||
elog("#{e.class} : #{e.message}\n#{e.backtrace * "\n"}")
|
||||
$stderr.puts "Error: #{e.message}"
|
||||
|
|
Loading…
Reference in New Issue