23. Exploitation with Metasploit
23.2 Starting msfconsole
Metasploit chi mukhya command line mhanje msfconsole.
sudo systemctl enable postgresql # database makes search fast (enable is allowed for boot)
sudo msfdb init # set up the Metasploit database (first time)
msfconsole # start the console
Inside the console:
msf6 > help # list command categories
msf6 > version # framework version
msf6 > db_status # is the database connected?
msf6 > workspace -a lab # keep your lab work separate
msf6 > db_nmap -sV 192.168.56.20 # run Nmap and store results in the database
msf6 > hosts # show discovered hosts
msf6 > services # show discovered services
db_nmap runs the Nmap you already know and saves the results, so search and modules can use them.
Ravindra Bagale's Tip
db_status ne "connected" nasel tar hosts/services rikame ratahtat aani students confuse hotat. Aadhi sudo msfdb init kara. Database asel tar Metasploit khup vegvan aani organised hoto.
Lab
Start msfconsole, confirm db_status shows connected, create a lab workspace, and run db_nmap -sV 192.168.56.20. Then run hosts and services and confirm your scan is stored.