If there are no search results, try harder.

Sometimes, the database is active but the cache isn't filled out, or
doesn't contain the module you want. This can come up especially when
msfconsole first starts and you are programmatically searching for
modules, for whatever reason.

This allows for falling back to the regular (slow) search in the event
no hits have been returned. It does not actually address the caching
problem seen in QA, but it's generally going to be Good Enough. Search
is getting overhauled Real Soon Now anyway.

[FixRM #7533]
unstable
Tod Beardsley 2012-12-01 14:06:32 -06:00
parent 4bc1159953
commit 725b085ef2
1 changed files with 5 additions and 2 deletions

View File

@ -1335,10 +1335,13 @@ class Core
}
if framework.db and framework.db.migrated and framework.db.modules_cached
return search_modules_sql(match)
sql_results = search_modules_sql(match)
eturn sql_results if sql_results # Patches around #7533
else
print_warning("Database not connected or cache not built.")
end
print_error("Warning: database not connected or cache not built, falling back to slow search")
print_warning("Falling back to slow search.")
tbl = generate_module_table("Matching Modules")
[