How to use Metasploit | Full Basics | Installation

how to use metasploit

How To Use Metasploit | Installation


Metasploit is a widely-used penetration testing framework that empowers security professionals to identify and exploit vulnerabilities in computer systems. Developed by Rapid7, Metasploit provides a robust set of tools for ethical hacking and security assessments. This article will delve into the basics of Metasploit, covering its functionality and guiding you through the installation process.

Key Features

1. Exploit Development

Metasploit simplifies the process of exploiting security flaws in systems. It includes a vast database of exploits, making it easier for penetration testers to find and deploy the right exploit against a specific vulnerability.

2. Payloads

Payloads are code snippets that run on a target system after a successful exploit. Metasploit supports various payloads, allowing testers to choose the appropriate one based on the objective, whether it’s gaining remote access, executing commands, or extracting information.

3. Post-Exploitation Modules

Metasploit extends its capabilities beyond initial exploitation. Post-exploitation modules enable users to perform tasks on compromised systems, such as gathering additional information, privilege escalation, or lateral movement within the network.

4. Meterpreter

Meterpreter is a powerful, extensible payload used to control compromised systems. It provides a command-line interface with a wide array of commands for interacting with the target, gathering data, and executing further exploits.


1. System Requirements

Before installing Metasploit, ensure your system meets the requirements. Metasploit is compatible with Linux, Windows, and macOS. It is recommended to use a Linux distribution for optimal performance.

2. Installation Steps

Linux (Debian-based)

  1. Open a terminal window.
  2. Update the package list:
   sudo apt update
  1. Install the Metasploit framework:
   sudo apt install metasploit-framework

Manual Installation:

curl > msfinstall &&
  • chmod 755 msfinstall && ./msfinstall
  • /opt/metasploit-framework/bin/msfconsole


In windows you just need to download metasploit framework and double tap to install it.

Download from here :-


  1. Install the Homebrew package manager if not already installed:
 /bin/bash -c "$(curl -fsSL"
  1. Install Metasploit using Homebrew:
   brew install metasploit

3. Verifying Installation

After installation, verify that Metasploit is working by opening a terminal and typing:


This will launch the Metasploit console, indicating a successful installation.

Database Setup :

Metasploit uses PostgreSQL Database

  • systemctl start postgresql

Initialize Metasploit Database

  • msfdb init

How To Use Metasploit

Using Metasploit involves several steps, from launching the framework to executing specific modules for exploiting vulnerabilities. Here’s a basic guide on how to use Metasploit:

1. Launch Metasploit Console

Open a terminal and type:


This command launches the Metasploit console.

2. Explore Commands

Get familiar with basic commands within the Metasploit console:

  • help: Displays a list of available commands.
  • search [keyword]: Searches for modules using keywords.
  • use [module]: Selects a specific module for use.

3. Select a Target

Identify the target system’s vulnerabilities and choose an appropriate exploit module. For example:

search [target]
use [exploit/module]

4. Set Payload

Choose a payload that suits your objectives. Common payloads include reverse_tcp for establishing a reverse shell.

set payload [payload]

5. Configure Options

Set necessary options like the target IP address, port, or any other required parameters.

set RHOSTS [target IP]
set LHOST [attacker IP]

6. Exploit

Once configured, execute the exploit:


7. Post-Exploitation

If the exploit is successful, you might gain a Meterpreter shell. Use post-exploitation modules for various tasks:

  • sysinfo: Retrieves system information.
  • shell: Opens a shell on the target.
  • upload and download: Transfer files to/from the target.

8. Clean Up

After completing your testing, exit the Meterpreter session:


Important Notes:

  • Ethical Use: Ensure you have explicit permission to test or assess the security of a system. Unauthorized use is illegal and unethical.
  • Update Metasploit: Keep Metasploit updated to access the latest features and exploit modules.
  • Documentation: Metasploit has extensive documentation. Refer to it for detailed information on specific modules and commands.

This is a simplified overview, and using Metasploit effectively requires a deep understanding of networking, security concepts, and ethical hacking practices. Always prioritize responsible and legal use of security tools.


Metasploit is a versatile tool that plays a crucial role in cybersecurity assessments. Understanding its features and mastering its uslage empowers security professionals to identify and address vulnerabilities effectively. By following the installation steps, you can set up Metasploit on your preferred platform and begin exploring its capabilities in ethical hacking and security testing.


Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Blocked because of Ad Blocker. It seems that you are using some ad blocking software which is preventing the page from fully loading. Please Disable Block Third Party Cookies or disable ad blocking software.