Use Rex::Text::Table for outputting data services
parent
24cf99f59c
commit
5b7127c826
|
@ -2106,17 +2106,25 @@ class Db
|
||||||
def list_saved_data_services
|
def list_saved_data_services
|
||||||
conf = Msf::Config.load
|
conf = Msf::Config.load
|
||||||
default = nil
|
default = nil
|
||||||
|
tbl = Rex::Text::Table.new({
|
||||||
|
'Header' => 'Data Services',
|
||||||
|
'Columns' => ['name', 'url', 'default?']
|
||||||
|
})
|
||||||
|
|
||||||
conf.each_pair do |k,v|
|
conf.each_pair do |k,v|
|
||||||
if k =~ /#{DB_CONFIG_PATH}/
|
if k =~ /#{DB_CONFIG_PATH}/
|
||||||
default = v['default_db'] if v['default_db']
|
default = v['default_db'] if v['default_db']
|
||||||
name = k.split('/').last
|
name = k.split('/').last
|
||||||
next if name == 'database' # Data service information is not stored in 'framework/database', just metadata
|
next if name == 'database' # Data service information is not stored in 'framework/database', just metadata
|
||||||
url = v['url']
|
url = v['url']
|
||||||
line = "#{name} - #{url}"
|
default_output = ''
|
||||||
line += " (default)" if name == default
|
default_output = '*' if name == default
|
||||||
print_line line
|
line = [name, url, default_output]
|
||||||
|
tbl << line
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
print_line
|
||||||
|
print_line tbl.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_msgs(status_msg, error_msg)
|
def print_msgs(status_msg, error_msg)
|
||||||
|
|
Loading…
Reference in New Issue