Skip to content

Commit 06aa239

Browse files
author
Brent Cook
committed
pass loggger conditionally to common search function
1 parent aa387e9 commit 06aa239

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/msf/core/framework.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,16 @@ def threads?
229229
}
230230
end
231231

232-
def search(match, verbose: false)
232+
def search(match, logger: nil)
233233
# Check if the database is usable
234234
use_db = true
235235
if self.db
236236
if !(self.db.migrated && self.db.modules_cached)
237-
if verbose
238-
print_warning("Module database cache not built yet, using slow search")
239-
end
237+
logger.print_warning("Module database cache not built yet, using slow search") if logger
240238
use_db = false
241239
end
242240
else
243-
if verbose
244-
print_warning("Database not connected, using slow search")
245-
end
241+
logger.print_warning("Database not connected, using slow search") if logger
246242
use_db = false
247243
end
248244

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def cmd_search(*args)
400400

401401
# Display the table of matches
402402
tbl = generate_module_table("Matching Modules", search_term)
403-
framework.search(match, verbose: true).each do |m|
403+
framework.search(match, logger: self).each do |m|
404404
tbl << [
405405
m.fullname,
406406
m.disclosure_date.nil? ? "" : m.disclosure_date.strftime("%Y-%m-%d"),

0 commit comments

Comments
 (0)