How to Connect Metasploit with Database [Kali]

Hey guys,

Here i’m gonna share what i learned on how to connect metasploit with postgresql. Usually, by default [Kali Linux], when you are starting Postgresql and Metasploit, when you type db_status, it will says ” [*] postgresql selected, no connection “.

Ok let’s started:

1st Step : Become Postgresql

su postgres

2nd Step: Creating User Database

createuser msf_user -P
===============================================
Enter password for new role: yourmsfpassword
Enter it again: yourmsfpassword 
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
===============================================

3rd Step: Creating Database

createdb --owner=msf_user msf_database

4th Step: Configuring Metasploit

msf > db_status 
[*] postgresql selected, no connection
msf> db_connect msf_user:yourmsfpassword@127.0.0.1:5432/msf_database

That’s all folks. Cheers :p

Leave a Reply

Your email address will not be published. Please enter your name, email and a comment.