Metasploit
Setup
Start the postgresql service:
systemctl start postgresqlEnable the postgresql service at boot:
systemctl enable postgresqlCreate and initialize the MSF database:
msfdb initUpdate Metasploit:
apt update && apt install metasploit-frameworkStart Metasploit quietly:
msfconsole -qCommands
use: activate a module
use exploit/multi/handler
back: go back to the main prompt
previous: activate the previously-used module
show: display module-related info
show optionsshow payloadsshow targets
set/unset: configure options for the currently-used module
set LHOST tun0set LPORT 443unset LHOSTunset LPORT
setg/unsetg: configure options for all modules during this Metasploit session
setg LHOST tun0setg LPORT 443unsetg LHOSTunsetg LPORT
Database Access
Show stored findings in the current module:
msf6 > servicesCheck a specific finding on port 445:
msf6 > services -p 445Run Nmap and save the findings to the database:
msf6 > db_nmap <remote_ip> -A -PnDisplay all discovered hosts:
msf6 > hostsAdd Exploits to Metasploit
If searchsploit finds a Metasploit exploit but it is not in the Metasploit framework, add it manually:
cp <exploit_path> /usr/share/metasploit-framework/modules/exploits/linux/httpIn Metasploit, run reload_all.
msf6 > reload_allAdvanced Options
Metasploit modules have some advanced options for you to play with. For example, in exploit/linux/samba/is_known_pipename, we have to set SMB version to 1. This is done in one of the advanced options:

Set SMB:ProtocolVersion to 1:
msf6 exploit(linux/samba/is_known_pipename) > set SMB::ProtocolVersion 1Last updated
Was this helpful?