Direct user to framework.log for load problems

This reduces long lines and cluttered output during startup.
master
William Vu 2019-03-11 23:27:12 -05:00
parent 6c4729de7e
commit 1d8538caee
3 changed files with 25 additions and 10 deletions

View File

@ -417,7 +417,7 @@ class Msf::Modules::Loader::Base
log_lines += error.backtrace
end
log_message = log_lines.join("\n")
log_message = log_lines.join(' ')
elog(log_message)
end
@ -434,7 +434,7 @@ class Msf::Modules::Loader::Base
log_lines = []
log_lines << "#{module_path} generated a warning during load:"
log_lines << error.to_s
log_message = log_lines.join("\n")
log_message = log_lines.join(' ')
wlog(log_message)
end

View File

@ -809,23 +809,31 @@ module Msf
cmd_reload_all_help
return
end
print_status("Reloading modules from all module paths...")
framework.modules.reload_modules
log_msg = "Please see #{File.join(Msf::Config.log_directory, 'framework.log')} for details."
# Check for modules that failed to load
if framework.modules.module_load_error_by_path.length > 0
print_error("WARNING! The following modules could not be loaded!")
framework.modules.module_load_error_by_path.each do |path, error|
print_error("\t#{path}: #{error}")
framework.modules.module_load_error_by_path.each do |path, _error|
print_error("\t#{path}")
end
print_error(log_msg)
end
if framework.modules.module_load_warnings.length > 0
print_warning("The following modules were loaded with warnings:")
framework.modules.module_load_warnings.each do |path, error|
print_warning("\t#{path}: #{error}")
framework.modules.module_load_warnings.each do |path, _error|
print_warning("\t#{path}")
end
print_warning(log_msg)
end
self.driver.run_single("banner")

View File

@ -353,20 +353,27 @@ class Driver < Msf::Ui::Driver
# displayed, scripts can be processed, and other fun can be had.
#
def on_startup(opts = {})
log_msg = "Please see #{File.join(Msf::Config.log_directory, 'framework.log')} for details."
# Check for modules that failed to load
if framework.modules.module_load_error_by_path.length > 0
print_error("WARNING! The following modules could not be loaded!")
framework.modules.module_load_error_by_path.each do |path, error|
print_error("\t#{path}: #{error}")
framework.modules.module_load_error_by_path.each do |path, _error|
print_error("\t#{path}")
end
print_error(log_msg)
end
if framework.modules.module_load_warnings.length > 0
print_warning("The following modules were loaded with warnings:")
framework.modules.module_load_warnings.each do |path, error|
print_warning("\t#{path}: #{error}")
framework.modules.module_load_warnings.each do |path, _error|
print_warning("\t#{path}")
end
print_warning(log_msg)
end
if framework.db && framework.db.active