Land #5997, database cache update fix

This commit is contained in:
William Vu 2015-09-26 14:10:04 -05:00
commit cb4e609dd5
No known key found for this signature in database
GPG Key ID: 68BD00CE25866743
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