Managing the Database from the Pro Console
Metasploit provides back end database support for PostgreSQL. The database stores information, such as host data, evidence, and exploit results. Any data collected by Metasploit is stored within the database.
The first time you launch the Pro Console, the system automatically sets up the database for you. The console loads the database each subsequent time you launch it.
Commands that manage the database start with a db_
prefix.
Connecting to the Database
To connect to the database instance, you need the user name, password, host name for the database, host port number, and the database name. You can find the database settings that the Metasploit uses in <msf dir>/config/database.yml
.
To connect to the database, use the following syntax:
1msf-pro > db_connect username:password@host:port/db
For example, if you are a Linux user, you can run the following:
1msf-pro > db_connect -y /opt/metasploit/config/database.yml
The Pro Console retains the connection with the database unless you disconnect from it.
Verifying the Database Status
After you connect to the database, you can run the db_status
command to check the database connection. If the database is connected, you should see a status message like 'postgresql connected to msf3'.
1msf-pro > db_status2[*] postgresql connected to msf3
Disconnecting from the Database
Use the db_disconnect
command to disconnect from the database.
1msf-pro > db_disconnect