msfdb: MSF Database Administration commands
1. View the MSF database connection status
MSF > db_status[*] PostgreSQL selected, no connection//not connected
2. Msfdb command
MSF > msfdb//msfdb can be used directly at the command line using the [*] exec:msfdbmanage a Metasploit framework database Msfdb init
# Initialize the database//Initialize databases msfdb reinit # Delete and reinitialize the database//empty config to reinitialize the databases
msfdb Delete # Delete database and stop using it//delete databases and stop use msfdb start # Start the The database/ /Start Database msfdb Stop # Stop the database//Stop
3. Initialize the database
MSF > msfdb init[*'MSF ' ' msf_test ' file in/usr/share/metasploit-framework/config/database.ymlcreating initial Database schema
4. View the MSF database configuration file
[Email protected]:~#Cat /usr/share/metasploit-framework/config/ database.ymldevelopment:adapter:postgresql database:msf username:msf password:eusdzzkrsyxvmwmpi+dz2kf1rojkkeekqnrvnbv7ldy=host:localhost Port:5432Pool:5Timeout:5production:adapter:postgresql database:msf username:msf password:eusdzzkrsyxvmwmpi+dz2kf1rojkkeekqnrvnbv7ldy=host:localhost Port:5432Pool:5Timeout:5test:adapter:postgresql database:msf_test username:msf password:eusdzzkrsyxvmwmpi+dz2kf1rojkkeekqnrvnbv7ldy=host:localhost Port:5432Pool:5Timeout:5
5. Start or restart MSF
[Email protected]:~# msfconsole ______________________________ ________________________________________________| || 3Kom superhack II Logon | | ______________________________________________________________________________|| || || || User Name: [Security] | | || Password: [] | | || || || [OK ] || ______________________________________________________________________________|| || Https//metasploit.com ||______________________________________________________________________________| =[Metasploit v4.15.5-Dev]+ -- --=[1673Exploits-959Auxiliary-294post]+ -- --=[489Payloads- +Encoders-9Nops]+----=[free Metasploit Pro trial:http://R-7.co/trymsp]MSF>db_status[*] PostgreSQL connected to MSF
Kali2017 Metasploit connecting PostgreSQL database