From 5b7127c82644798c0b8f3fcefdad7ab6fe49cc2b Mon Sep 17 00:00:00 2001 From: James Barnett Date: Mon, 27 Aug 2018 13:18:41 -0500 Subject: [PATCH] Use Rex::Text::Table for outputting data services --- lib/msf/ui/console/command_dispatcher/db.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/msf/ui/console/command_dispatcher/db.rb b/lib/msf/ui/console/command_dispatcher/db.rb index 84692c4120..1a9c42c340 100644 --- a/lib/msf/ui/console/command_dispatcher/db.rb +++ b/lib/msf/ui/console/command_dispatcher/db.rb @@ -2106,17 +2106,25 @@ class Db def list_saved_data_services conf = Msf::Config.load default = nil + tbl = Rex::Text::Table.new({ + 'Header' => 'Data Services', + 'Columns' => ['name', 'url', 'default?'] + }) + conf.each_pair do |k,v| if k =~ /#{DB_CONFIG_PATH}/ default = v['default_db'] if v['default_db'] name = k.split('/').last next if name == 'database' # Data service information is not stored in 'framework/database', just metadata url = v['url'] - line = "#{name} - #{url}" - line += " (default)" if name == default - print_line line + default_output = '' + default_output = '*' if name == default + line = [name, url, default_output] + tbl << line end end + print_line + print_line tbl.to_s end def print_msgs(status_msg, error_msg)