From e2dd844e345f4d7f447588bd839d593ccffce805 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Mon, 9 May 2016 21:25:23 +0200 Subject: [PATCH] reenable jar format --- lib/msf/util/exe.rb | 1 + msfvenom | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/msf/util/exe.rb b/lib/msf/util/exe.rb index b7bb58f8d1..161d85930b 100644 --- a/lib/msf/util/exe.rb +++ b/lib/msf/util/exe.rb @@ -2229,6 +2229,7 @@ require 'msf/core/exe/segment_appender' "exe-service", "exe-small", "hta-psh", + "jar", "loop-vbs", "macho", "msi", diff --git a/msfvenom b/msfvenom index 6c25288081..fba3f1c968 100755 --- a/msfvenom +++ b/msfvenom @@ -18,6 +18,7 @@ require 'msf/core/payload_generator' class MsfVenomError < StandardError; end +class HelpError < StandardError; end class UsageError < MsfVenomError; end class NoTemplateError < MsfVenomError; end class IncompatibleError < MsfVenomError; end @@ -95,7 +96,7 @@ def parse_args(args) "\t" + ::Msf::Util::EXE.to_executable_fmt_formats.join(", ") + "\n" + "Transform formats\n" + "\t" + ::Msf::Simple::Buffer.transform_formats.join(", ") - raise UsageError, msg + raise HelpError, msg end opt.on('-e', '--encoder ', String, 'The encoder to use') do |e| @@ -116,7 +117,7 @@ def parse_args(args) Msf::Module::Platform.subclasses.each {|c| supported_platforms << "#{c.realname.downcase}"} msg = "Platforms\n" + "\t" + supported_platforms * ", " - raise UsageError, msg + raise HelpError, msg end opt.on('-s', '--space ', Integer, 'The maximum size of the resulting payload') do |s| @@ -160,7 +161,7 @@ def parse_args(args) end opt.on_tail('-h', '--help', 'Show this message') do - raise UsageError, "#{opt}" + raise HelpError, "#{opt}" end begin @@ -280,6 +281,9 @@ end begin generator_opts = parse_args(ARGV) +rescue HelpError => e + $stderr.puts e.message + exit(1) rescue MsfVenomError, Msf::OptionValidateError => e $stderr.puts "Error: #{e.message}" exit(1)