Skip to content

Commit 458da2b

Browse files
committed
Land rapid7#3988, @wchen-r7's fix for rapid7#3985, a lack of logging for 'check'
2 parents d4297a7 + 48d2343 commit 458da2b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/msf/ui/console/module_command_dispatcher.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,22 @@ def check_simple(instance=nil)
188188
print_status("#{peer} - #{code[1]}")
189189
end
190190
else
191-
print_error("#{peer} - Check failed: The state could not be determined.")
191+
msg = "#{peer} - Check failed: The state could not be determined."
192+
print_error(msg)
193+
elog("#{msg}\n#{caller.join("\n")}")
192194
end
193-
rescue ::Rex::ConnectionError, ::Rex::ConnectionProxyError, ::Errno::ECONNRESET, ::Errno::EINTR, ::Rex::TimeoutError, ::Timeout::Error
195+
rescue ::Rex::ConnectionError, ::Rex::ConnectionProxyError, ::Errno::ECONNRESET, ::Errno::EINTR, ::Rex::TimeoutError, ::Timeout::Error => e
194196
# Connection issues while running check should be handled by the module
195-
rescue ::RuntimeError
197+
elog("#{e.message}\n#{e.backtrace.join("\n")}")
198+
rescue ::RuntimeError => e
196199
# Some modules raise RuntimeError but we don't necessarily care about those when we run check()
200+
elog("#{e.message}\n#{e.backtrace.join("\n")}")
197201
rescue Msf::OptionValidateError => e
198202
print_error("Check failed: #{e.message}")
203+
elog("#{e.message}\n#{e.backtrace.join("\n")}")
199204
rescue ::Exception => e
200205
print_error("#{peer} - Check failed: #{e.class} #{e}")
206+
elog("#{e.message}\n#{e.backtrace.join("\n")}")
201207
end
202208
end
203209

0 commit comments

Comments
 (0)