Skip to content

Commit 725b085

Browse files
committed
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 rapid7#7533]
1 parent 4bc1159 commit 725b085

File tree

1 file changed

+5
-2
lines changed
  • lib/msf/ui/console/command_dispatcher

1 file changed

+5
-2
lines changed

lib/msf/ui/console/command_dispatcher/core.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,10 +1335,13 @@ def cmd_search(*args)
13351335
}
13361336

13371337
if framework.db and framework.db.migrated and framework.db.modules_cached
1338-
return search_modules_sql(match)
1338+
sql_results = search_modules_sql(match)
1339+
eturn sql_results if sql_results # Patches around #7533
1340+
else
1341+
print_warning("Database not connected or cache not built.")
13391342
end
13401343

1341-
print_error("Warning: database not connected or cache not built, falling back to slow search")
1344+
print_warning("Falling back to slow search.")
13421345

13431346
tbl = generate_module_table("Matching Modules")
13441347
[

0 commit comments

Comments
 (0)