From d90656be0ebc122e6fc22dba23b7dd648a7cb3db Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Mon, 24 May 2010 23:07:52 +0000 Subject: [PATCH] Improve error logging when modules fail to load. * Don't print module file path twice on the same line * Use print_error instead of print * Remove unnecessary newlines git-svn-id: file:///home/svn/framework3/trunk@9358 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/module_manager.rb | 3 +-- lib/msf/ui/console/command_dispatcher/auxiliary.rb | 4 ++-- lib/msf/ui/console/driver.rb | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/msf/core/module_manager.rb b/lib/msf/core/module_manager.rb index a10e44d7c6..4bc8cac1b7 100644 --- a/lib/msf/core/module_manager.rb +++ b/lib/msf/core/module_manager.rb @@ -932,8 +932,7 @@ protected return false end end - - errmsg = "#{file}: #{e.class} #{e}" + errmsg = "#{e.class} #{e}" self.module_failed[file] = errmsg elog(errmsg) return false diff --git a/lib/msf/ui/console/command_dispatcher/auxiliary.rb b/lib/msf/ui/console/command_dispatcher/auxiliary.rb index e5048a69ea..41479d4d51 100644 --- a/lib/msf/ui/console/command_dispatcher/auxiliary.rb +++ b/lib/msf/ui/console/command_dispatcher/auxiliary.rb @@ -71,7 +71,7 @@ class Auxiliary omod = self.mod self.mod = framework.modules.reload_module(mod) if(not self.mod) - print_status("Failed to reload module: #{framework.modules.failed[omod.file_path]}") + print_error("Failed to reload module: #{framework.modules.failed[omod.file_path]}") self.mod = omod end rescue @@ -87,7 +87,7 @@ class Auxiliary omod = self.mod self.mod = framework.modules.reload_module(mod) if(not self.mod) - print_status("Failed to reload module: #{framework.modules.failed[omod.file_path]}") + print_error("Failed to reload module: #{framework.modules.failed[omod.file_path]}") self.mod = omod return end diff --git a/lib/msf/ui/console/driver.rb b/lib/msf/ui/console/driver.rb index e3c0cc09c1..210fe66f63 100644 --- a/lib/msf/ui/console/driver.rb +++ b/lib/msf/ui/console/driver.rb @@ -284,11 +284,10 @@ class Driver < Msf::Ui::Driver def on_startup # Check for modules that failed to load if (framework.modules.failed.length > 0) - print("[*] WARNING! The following modules could not be loaded!\n\n") + print_error("WARNING! The following modules could not be loaded!") framework.modules.failed.each_pair do |file, err| - print("\t#{file}: #{err}\n\n") + print_error("\t#{file}: #{err}") end - print("\n") end framework.events.on_ui_start(Msf::Framework::Revision)