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
If db_status does not say "connected", hosts/services stay empty and students get confused. Run sudo msfdb init first. With the database in place, Metasploit becomes much faster and more organised.
Ravindra Bagale's Tip – मराठी
db_status मध्ये "connected" दिसत नसेल तर hosts/services रिकामे राहतात आणि students गोंधळतात. आधी sudo msfdb init करा. Database असेल तर Metasploit खूप वेगवान आणि organised होतो.
Ravindra Bagale's Tip – हिंदी
db_status में "connected" नहीं दिखता तो hosts/services खाली रहते हैं और students उलझ जाते हैं. पहले sudo msfdb init करो. Database हो तो Metasploit बहुत तेज़ और organised हो जाता है.
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.