Connect to the default database on startup
parent
b6401dbe56
commit
57243106f7
|
@ -231,6 +231,33 @@ class Driver < Msf::Ui::Driver
|
|||
end
|
||||
}
|
||||
end
|
||||
if conf.group?('framework/database')
|
||||
conf['framework/database'].each_pair do |k, v|
|
||||
if k.downcase == 'default_db'
|
||||
print_line "Default data service found. Attempting to connect..."
|
||||
default_db_config_path = "#{Msf::Ui::Console::CommandDispatcher::Db::DB_CONFIG_PATH}/#{v}"
|
||||
default_db = conf[default_db_config_path]
|
||||
if default_db
|
||||
connect_string = "db_connect"
|
||||
if default_db['cert']
|
||||
connect_string += " -c #{default_db['cert']}"
|
||||
if default_db['skip_verify']
|
||||
connect_string += " --skip-verify"
|
||||
end
|
||||
end
|
||||
if default_db['api_token']
|
||||
connect_string += " -t #{default_db['api_token']}"
|
||||
end
|
||||
connect_string += " #{default_db['url']}"
|
||||
|
||||
run_single(connect_string)
|
||||
else
|
||||
print_error "Config entry for '#{default_db_config_path}' could not be found. Config file might be corrupt."
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue