Run Metasploit only in a lab or against systems you are explicitly authorized to assess. Define the target scope before starting.
ποΈ Initialize the Database
sudo systemctl start postgresql
sudo msfdb init
msfconsole
db_status
If db_status reports that PostgreSQL is selected but not connected, leave msfconsole, initialize or repair the database, restart PostgreSQL, and check again:
exit
sudo msfdb init
sudo systemctl restart postgresql
msfconsole
db_status
πΊοΈ Import an Nmap Scan
Create XML output with Nmap:
nmap -Pn -sS -A -oX test.xml target
Import and inspect it from msfconsole:
db_import test.xml
hosts
services
π SYN Port Scanner
search portscan
use auxiliary/scanner/portscan/syn
set INTERFACE eth0
set PORTS 80
set RHOSTS targets
set THREADS 50
run
π TCP Port Scanner
use auxiliary/scanner/portscan/tcp
hosts -R
set RHOSTS target
run
πͺ SMB Version Scanner
use auxiliary/scanner/smb/smb_version
set RHOSTS targets
set THREADS 11
run
Review
show optionsbefore running a module. Confirm the selected hosts, ports, interface, and thread count are appropriate for the authorized environment.