What are the common metasploit commands?
- Nov 19, 2024
- 3 min read
Metasploit Framework is one of the most powerful and leading penetration-testing tool written in Ruby, and also one of the biggest open-source projects in information security and penetration testing or ethical hacking. It was started by H.D. Moore in 2003, which was later acquired by Rapid7. Metasploit Framework comes pre-installed on Kali Linux operating system. It is an open-source platform that supports a large set of database including- exploit development, vulnerabilities, payloads, modules, conducting automated testing and so on.
In order to start Metasploit Framework, you need “msfconsole” which is a command-line utility and an interface to access and work with MSF(Metasploit Framework).
Some of the common commands which are used in MSF are as follows -
Help - type ‘help’ command on the console and it will show you a list of core commands along with their description.

Update - the ‘update’ or ‘apt update’ command which is used to update the Metasploit Framework with the latest version including exploits, payloads, auxiliaries, etc.

Search - using ‘search’ command you can find any type of exploits, payloads, etc. For example : if you want to find exploit for ftp 2.0, the command will be -

Info - the ‘info’ command shows the information about a particular module like exploit, payload such as module name, platform, who is the author, where it is used, description, etc.

Use - ‘use’ command is used to select a specific exploit or payload.

show options - which is used to show the information, options, list modules, etc. In a context for a particular exploit, it receives the following parameters such as - SRVHOST, SRVPORT, SSLCert, RHOSTS, RPORT, etc.

Back - the ‘back’ command is used to come back from the current exploit or module.

Set - the ‘set’ command is used to set a value of the parameter depending on its context. For example :

exploit or run is used to execute the module.
rerun - if a module failed or you have accidentally exited it, you can use the ‘rerun’ command.
multi/handler - it is a stub that handles exploits launched outside of the framework.

Msfvenom - it is useful for creating payloads, listing encoders/payloads to exploit the targets or victim machine. You can also use the ‘msfvenom or -h flag’ to look for help messages.

Jobs Commands :
sessions - it shows the information listed in the current active session, and allows you to interact with them.
jobs - this command lists and manages all running jobs
kill - kills a job
Database Commands :
db_connect - helps you to connect to database
db_disconnect - disconnect from all active database
Meterpreter Commands : Meterpreter is an MSF attack payload that provides an interactive shell from which an attacker can explore the target machine and execute code. Meterpreter is deployed using in-memory DLL injection.
help - displays the meterpreter help menu
background - this command sends the current meterpreter session in the background.
clearev - this command will clear all the application, access, security logs, etc. on a system.
download - it is used to download a file from a remote machine or shell.
hashdump - it is a post module which is used to dump all the hashes of passwords or other contents from the victim machine.
sysinfo - this command displays the system information, OS type, system time,etc.
Other commands such as : cd, pwd, execute, ps shell, etc.
The above MSF commands are commonly used in penetration testing/ethical hacking. These are not limited, one can use the full functionality of MSF by exploring, using and understanding the particular commands in depth.
Helpful Resources :
YouTube:
Comments