Land #4294, msfconsole speedups on module load
Related to #4257 and #4195 vaguely, and possibly even #4147.bug/bundler_fix
commit
0431720a07
|
@ -7,26 +7,32 @@ module Msf
|
|||
#
|
||||
# @return [void]
|
||||
def init_module_paths(opts={})
|
||||
# Ensure the module cache is accurate
|
||||
self.modules.refresh_cache_from_database
|
||||
if @module_paths_inited
|
||||
fail "Module paths already initialized. To add more module paths call `modules.add_module_path`"
|
||||
else
|
||||
# Ensure the module cache is accurate
|
||||
self.modules.refresh_cache_from_database
|
||||
|
||||
add_engine_module_paths(Rails.application, opts)
|
||||
add_engine_module_paths(Rails.application, opts)
|
||||
|
||||
Rails.application.railties.engines.each do |engine|
|
||||
add_engine_module_paths(engine, opts)
|
||||
end
|
||||
Rails.application.railties.engines.each do |engine|
|
||||
add_engine_module_paths(engine, opts)
|
||||
end
|
||||
|
||||
# Initialize the user module search path
|
||||
if (Msf::Config.user_module_directory)
|
||||
self.modules.add_module_path(Msf::Config.user_module_directory, opts)
|
||||
end
|
||||
# Initialize the user module search path
|
||||
if (Msf::Config.user_module_directory)
|
||||
self.modules.add_module_path(Msf::Config.user_module_directory, opts)
|
||||
end
|
||||
|
||||
# If additional module paths have been defined globally, then load them.
|
||||
# They should be separated by semi-colons.
|
||||
if self.datastore['MsfModulePaths']
|
||||
self.datastore['MsfModulePaths'].split(";").each { |path|
|
||||
self.modules.add_module_path(path, opts)
|
||||
}
|
||||
# If additional module paths have been defined globally, then load them.
|
||||
# They should be separated by semi-colons.
|
||||
if self.datastore['MsfModulePaths']
|
||||
self.datastore['MsfModulePaths'].split(";").each { |path|
|
||||
self.modules.add_module_path(path, opts)
|
||||
}
|
||||
end
|
||||
|
||||
@module_paths_inited = true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -59,7 +59,10 @@ class Driver < Msf::Ui::Driver
|
|||
histfile = opts['HistFile'] || Msf::Config.history_file
|
||||
|
||||
# Initialize attributes
|
||||
self.framework = opts['Framework'] || Msf::Simple::Framework.create(opts)
|
||||
|
||||
# Defer loading of modules until paths from opts can be added below
|
||||
framework_create_options = {'DeferModuleLoads' => true}.merge(opts)
|
||||
self.framework = opts['Framework'] || Msf::Simple::Framework.create(framework_create_options)
|
||||
|
||||
if self.framework.datastore['Prompt']
|
||||
prompt = self.framework.datastore['Prompt']
|
||||
|
|
Loading…
Reference in New Issue