Wmap Metasploit – How to fix 'database not connected' problem
WMAP is a web application vulnerability scanner available as module within the Metasploit framework.
When attempting to use it, if Metasploit has not been configured to use the PostgreSQL database, you may encounter an error similar to the one shown in the screenshot below.
In fact, it is possible to use Metasploit even without having a database configured, but is is certainly useful to do so. For example, if you want to keep the data of your searches or scan results.
However, in the case of the WMAP module this is a fundamental requirement.
Let’s see how to fix problem.
# Check the current database status
sudo service postgresql status
# Startup the PostgreSQL service
sudo service postgresql start
# Re-checking that everything started correctly
sudo service postgresql status
# Let's create and initialise the msf database
sudo msfdb init
Once all this is done, we can try to restart Metasploit by loading the WMAP module again and verify that everything is working correctly.