Metasploit: Building Database

Metasploit allows us to build a database to store our target information so that we can keep track of different target in a single workspace. This workspace can contain all the command results that you ran on the target.

Databases which were supported by Metasploit back in 2011 were MySQL and PostgreSQL. The default is PostgreSQL. MySQL is also deprecated after the year 2015. So we have PostgreSQL database to setup!

Let’s start on how we can connect the database:

>> On terminal write: msfconsole

 

>> Start the PostgreSQL service:

OR  You can write service postgreSQL start on the terminal.

 

>>Before we can work with PostgreSQL on msfconsole. So I opened another terminal (Just so I don’t mess up msfconsole terminal). We need to create a user and Database on PostgreSQL database.

    1. So login to PostgreSQL – sudo -su postgres and create user by – createuser myworkspace -P -S -R -D

 

>>Create database with – createdb msfwork

 

>>Connect with the workspace with the credentials you put above. db_connect username:password@localhost/databasename. My username that I created was myworkspace. Slipper is the password I entered and 127.0.0.1 is ip for localhost (obviously) and msfwork is the database I created under my username.

 

>>Check the status for database connection using db_status command.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.