Land #9848, handle 'check' command on modules that do not implement it
commit
c525bc3c0a
|
@ -217,9 +217,16 @@ module ModuleCommandDispatcher
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
code = instance.check_simple(
|
if instance.respond_to?(:check_simple)
|
||||||
'LocalInput' => driver.input,
|
code = instance.check_simple(
|
||||||
'LocalOutput' => driver.output)
|
'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 and code.kind_of?(Array) and code.length > 1)
|
||||||
if (code == Msf::Exploit::CheckCode::Vulnerable)
|
if (code == Msf::Exploit::CheckCode::Vulnerable)
|
||||||
print_good("#{peer} #{code[1]}")
|
print_good("#{peer} #{code[1]}")
|
||||||
|
@ -240,6 +247,9 @@ module ModuleCommandDispatcher
|
||||||
rescue ::RuntimeError => e
|
rescue ::RuntimeError => e
|
||||||
# Some modules raise RuntimeError but we don't necessarily care about those when we run check()
|
# Some modules raise RuntimeError but we don't necessarily care about those when we run check()
|
||||||
elog("#{e.message}\n#{e.backtrace.join("\n")}")
|
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
|
rescue ::Exception => e
|
||||||
print_error("Check failed: #{e.class} #{e}")
|
print_error("Check failed: #{e.class} #{e}")
|
||||||
elog("#{e.message}\n#{e.backtrace.join("\n")}")
|
elog("#{e.message}\n#{e.backtrace.join("\n")}")
|
||||||
|
|
Loading…
Reference in New Issue