diff --git a/lib/msf/base/simple/auxiliary.rb b/lib/msf/base/simple/auxiliary.rb index b4bedcf3d3..4af93acd7a 100644 --- a/lib/msf/base/simple/auxiliary.rb +++ b/lib/msf/base/simple/auxiliary.rb @@ -118,7 +118,7 @@ module Auxiliary unless mod.has_check? # Bail out early if the module doesn't have check - raise Msf::ValidationError, Msf::Exploit::CheckCode::Unsupported.message + raise ::NoMethodError.new(Msf::Exploit::CheckCode::Unsupported.message, 'check') end # Validate the option container state so that options will diff --git a/lib/msf/base/simple/exploit.rb b/lib/msf/base/simple/exploit.rb index 6da3ed04e0..47e2087a7e 100644 --- a/lib/msf/base/simple/exploit.rb +++ b/lib/msf/base/simple/exploit.rb @@ -186,7 +186,7 @@ module Exploit unless mod.has_check? # Bail out early if the module doesn't have check - raise Msf::ValidationError, Msf::Exploit::CheckCode::Unsupported.message + raise ::NoMethodError.new(Msf::Exploit::CheckCode::Unsupported.message, 'check') end # Validate the option container state so that options will diff --git a/lib/msf/core/rpc/json/dispatcher.rb b/lib/msf/core/rpc/json/dispatcher.rb index ad5525fac3..2fe6a420ff 100644 --- a/lib/msf/core/rpc/json/dispatcher.rb +++ b/lib/msf/core/rpc/json/dispatcher.rb @@ -111,6 +111,10 @@ module Msf::RPC::JSON end response + rescue Msf::OptionValidateError => e + raise InvalidParams.new(data: { options: e.options, message: e.message }) + rescue ::NoMethodError => e + raise MethodNotFound.new(e.name, data: { method: e.name, message: e.message }) rescue ArgumentError raise InvalidParams.new rescue Msf::RPC::Exception => e @@ -213,4 +217,4 @@ module Msf::RPC::JSON end end end -end \ No newline at end of file +end