Metasploit Exploitation
May 18, 2025Scanning
We can perform a nmap scan inside and we can search for specific scanners to apply our attack
Metasploit Database
You will first need to start the PostgreSQL database, which Metasploit will use with the following command: systemctl start postgresql.
Then you will need to initialize the Metasploit Database using the msfdb init command. However, trying to run msfdb init as root will give the following error message, “Please run msfdb as a non-root user.” This can be solved by running it as the postgres account using sudo -u postgres msfdb init.
The terminal below shows the example output. As mentioned, the steps below have already been performed on the AttackBox; however, if you are interested in repeating them, you will need to delete the existing database first using sudo -u postgres msfdb delete.
After This we can start making workspaces on metasploit by using workspace -a [workspace name] and select the workspace by workspace [workspace name]
We also use db_[command name] to save the results to the database
Exploitation
Here we can search for exploits from the info that we got from the nmap scan
MSFVENOM
this is a tool the craft exploits to be run on target machine and can be accessed using multi/handler. it also help us craft exploits in many formats that we could need.