Connect to the default database on startup

GSoC/Meterpreter_Web_Console
James Barnett 2018-08-21 14:29:20 -05:00
parent b6401dbe56
commit 57243106f7
No known key found for this signature in database
GPG Key ID: 647983861A4EC5EA
1 changed files with 27 additions and 0 deletions

View File

@ -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
#