ensure the database cache is always updated, present accurate reporting on search

bug/bundler_fix
Brent Cook 2015-09-22 12:56:26 -05:00
parent 0cc6b53d59
commit 66b453edd6
3 changed files with 12 additions and 16 deletions

View File

@ -112,7 +112,6 @@ module Msf::ModuleManager::Cache
else
framework.db.update_all_module_details
end
refresh_cache_from_database(self.module_paths)
end
end
@ -131,11 +130,7 @@ module Msf::ModuleManager::Cache
# @return [true] if migrations have been run
# @return [false] otherwise
def framework_migrated?
if framework.db and framework.db.migrated
true
else
false
end
framework.db && framework.db.migrated
end
# @!attribute [rw] module_info_by_path

View File

@ -1543,13 +1543,17 @@ class Core
end
}
if framework.db and framework.db.migrated and framework.db.modules_cached
search_modules_sql(match)
return
if framework.db
if framework.db.migrated && framework.db.modules_cached
search_modules_sql(match)
return
else
print_warning("Module database cache not built yet, using slow search")
end
else
print_warning("Database not connected, using slow search")
end
print_warning("Database not connected or cache not built, using slow search")
tbl = generate_module_table("Matching Modules")
[
framework.exploits,

View File

@ -213,11 +213,8 @@ class Driver < Msf::Ui::Driver
end
if framework.db.active && !opts['DeferModuleLoads']
if self.framework.modules.cache_empty?
self.framework.threads.spawn("ModuleCacheRebuild", true) do
self.framework.modules.refresh_cache_from_module_files
end
print_status("The initial module cache will be built in the background, this can take 2-5 minutes...")
framework.threads.spawn("ModuleCacheRebuild", true) do
framework.modules.refresh_cache_from_module_files
end
end