How to Install Metasploit in Termux 2024 [No Root Required]

Install MetaSploit in termux

Metasploit is an open-source penetration testing framework used to test system security. This guide explains how to install it on Android devices using Termux.

What is Metasploit?

Metasploit is a tool released in 2003 for developing and executing exploit code against target systems to test for vulnerabilities. It is now maintained by security firm Rapid7 and has an active open-source community.

Key features include:
  • Database of known exploits for various operating systems, software, and devices.
  • Tools for creating custom exploit modules.
  • Library of payloads to execute malicious code on compromised systems.
  • Evasion techniques to avoid anti-virus and firewall detection.
  • Recon tools to fingerprint target systems before attacking.
  • Automation for rapid mass vulnerability testing.
It is used by security professionals and researchers to systematically test system security.


How to install Metasploit in Termux

Termux is an Android terminal emulator that allows installing Linux tools. Here are the steps to install Metasploit:

Update Termux package repositories.

pkg update && pkg upgrade -y

Install the "unstable repository" to access cutting-edge packages.

pkg install unstable-repo

Install the Metasploit package and dependencies.

pkg install metasploit

The installation process may take some time.


Launch the "msfconsole" terminal to initialize the Metasploit Framework.

msfconsole

The first launch may be slow as it sets up the PostgreSQL database. For better performance, users should ensure PostgreSQL is running before launching Metasploit.

Ensuring PostgreSQL Functionality

Metasploit utilizes PostgreSQL as a database backend to enable faster command execution. Without PostgreSQL running, Metasploit response times are considerably slower.

Users should verify PostgreSQL is active before launching Metasploit. The pg_ctl utility can check PostgreSQL status:

pg_ctl -D $PREFIX/var/lib/Postgresql status

If PostgreSQL is running, it will display details like the process ID. Otherwise, it will state "no server running."

To start PostgreSQL:

pg_ctl -D $PREFIX/var/lib/postgresql start

To stop the server:

pg_ctl -D $PREFIX/var/lib/postgresql stop

With PostgreSQL running, Metasploit will initialize much faster. Users should start the PostgreSQL server in the background before launching Metasploit for optimal performance.

Do you want to get more Termux packages? Then check the list of best Termux packages.

How to install Metasploit in Termux by using GitHub

Metasploit can also be installed by cloning the GitHub repository:

Update Termux.

pkg update && pkg upgrade -y

Install wget, curl, git, and other dependencies.

pkg install wget curl openssh git -y

Install Ncurses-utils.

apt install ncurses-utils

Download Metasploit.

wget https://raw.githubusercontent.com/gushmazuko/metasploit_in_termux/master/metasploit.sh

Make the script executable.

chmod +x  metasploit.sh

Run the script to install Metasploit.

./metasploit.sh

If the above command does not work, try the below command.

bash metasploit.sh

Launch with "msfconsole".

msfconsole

Want to know more about Termux? Read this article on Termux full tutorial with complete Termux commands. Bored with the Termux? Try some Termux alternatives.

 Install more great tools for Termux:





Final Thoughts

This guide has outlined the necessary steps to install Metasploit Framework in Termux on Android for mobile penetration testing. Caution should be exercised to avoid unauthorized use on production systems.