From 924a336287b11347fe7ee170d84a4ce555d52e27 Mon Sep 17 00:00:00 2001 From: William Vu Date: Mon, 9 Apr 2018 13:27:13 -0500 Subject: [PATCH] Fix unsupported check_simple method for modules --- lib/msf/ui/console/module_command_dispatcher.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/msf/ui/console/module_command_dispatcher.rb b/lib/msf/ui/console/module_command_dispatcher.rb index 7064ce6e83..339abf8933 100644 --- a/lib/msf/ui/console/module_command_dispatcher.rb +++ b/lib/msf/ui/console/module_command_dispatcher.rb @@ -217,9 +217,16 @@ module ModuleCommandDispatcher end begin - code = instance.check_simple( - 'LocalInput' => driver.input, - 'LocalOutput' => driver.output) + if instance.respond_to?(:check_simple) + code = instance.check_simple( + 'LocalInput' => driver.input, + 'LocalOutput' => driver.output + ) + else + msg = "Check failed: #{instance.type.capitalize} modules do not support check." + raise NotImplementedError, msg + end + if (code and code.kind_of?(Array) and code.length > 1) if (code == Msf::Exploit::CheckCode::Vulnerable) print_good("#{peer} #{code[1]}") @@ -240,6 +247,9 @@ module ModuleCommandDispatcher rescue ::RuntimeError => e # Some modules raise RuntimeError but we don't necessarily care about those when we run check() elog("#{e.message}\n#{e.backtrace.join("\n")}") + rescue ::NotImplementedError => e + print_error(e.message) + elog("#{e.message}\n#{e.backtrace.join("\n")}") rescue ::Exception => e print_error("Check failed: #{e.class} #{e}") elog("#{e.message}\n#{e.backtrace.join("\n")}")