How to Install Metasploit in Termux [No Root Required]

Install MetaSploit in termux

Learn how to install Metasploit in Termux, so that you can use this powerful penetration testing framework to test your own systems for security weaknesses. This step-by-step guide will walk you through the process, from installing the necessary dependencies to launching Metasploit for the first time.

What is Metasploit?

Metasploit is an open-source penetration testing framework that provides tools for developing and executing exploit code against target systems. Some key things to know about Metasploit:
  • It is maintained by Rapid7 and has a large community of contributors. It started in 2003 as a Perl project and was later rewritten in Ruby.
  • It includes a database of known exploits that can be used to take advantage of vulnerabilities in systems. The exploits target various operating systems, software, and devices.
  • In addition to exploits, Metasploit has a rich development environment for creating new modules. Developers can add their own exploits, payloads, encoders, and other tools.
  • Payloads are the code that gets executed on the target machine after an exploit succeeds. Metasploit has payloads for various purposes like command execution, establishing a remote shell, password extraction, etc.
  • Metasploit has numerous evasion techniques to try to avoid detection by anti-virus/firewalls such as encoding, packing, and more.
  • It provides reconnaissance tools for information gathering and fingerprinting. This helps attackers learn about the target system before launching an attack.
  • Automation tools are included to allow penetration tests to be performed quickly against multiple systems.
Metasploit is an extremely versatile and extensive framework used for developing and executing exploit code against target systems with the goal of penetration testing or security research. It is a go-to tool for many security professionals and hackers. However, it does require expertise to use properly.


How to install Metasploit in Termux

Here is the procedure on how to install the Metasploit in Termux.

Open your Termux and upgrade your repositories by using the following command.

pkg update && pkg upgrade -y

Now install the unstable repository by running this command.

pkg install unstable-repo

Use the below Termux command to Install the Metasploit in your Termux.

pkg install metasploit

Termux will install other packages required to run Metasploit. The extra package includes Ruby, BisonFTP, etc.

The installation process may take some time. Do not close the Termux session until the completion of the installation.

Run the Metasploit

You can now run and use the Metasploit framework on your Android device via the Termux. Type the below command to run the Metasploit in Termux.

msfconsole

MetaSploit Framework

The first time it will take time to load because Metasploit is initializing the database. So wait for the process to finish.

Tip: If you are not running Metasploit for the first time, make sure to run the PostgreSQL. Through PostgreSQL, Metasploit runs quicker.

Make sure Postgresql is working.

Metasploit uses PostgreSQL as its database. Using PostgreSQL helps speed up the execution of commands typed into Metasploit. Metasploit can run without PostgreSQL, but the response time will be slower without it.

Make sure to run PostgreSQL before running Metasploit. To check whether PostgreSQL is running or not, you can use the following command:
pg_ctl -D $PREFIX/var/lib/Postgresql status

You will get the following output if Postgresql is already running.

pg_ctl: server is running (PID: 9023 ) /data/data/com.termux/files/usr/bin/postgres "-D" "/data/data/com.termux/files/usr/var/lib/postgresql"

You will get the following output if Postgresql is not running.

pg_ctl: no server running

Now let's see how to start PostgreSQL.

Use the following command to start the PostgreSQL.

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

Use the following command to stop the PostgreSQL.

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

You can watch the below YouTube video on how to install the Metasploit framework in Termux.


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

Here is the second method for installing Metasploit in Termux by using GitHub. Follow these steps to install Metasploit in Termux via GitHub. You'll need to wait for each command to finish executing before moving on to the next one:

In the first step, we have to update our Termux repository. Use the below command to update the Termux repository.

pkg update && pkg upgrade -y

After updating the Termux repository, our next step is to install Metasploit requirements.

pkg install wget curl openssh git -y

Type the below command in your Termux to install Ncurses-utils

apt install ncurses-utils

Copy and paste the below command in your Termux to download Metasploit.

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

Use the below command to make the file read, write, and executable.

chmod +x  metasploit.sh

Type the below command to install the Metasploit.

./metasploit.sh

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

bash metasploit.sh

After the installation, launch the Metasploit by using this command:

msfconsole

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

 Install more great tools for Termux:





Conclusion

In this article, we learned how to install the Metasploit Framework in Termux. Metasploit has a great database of exploits, and new exploits are added as new vulnerabilities are discovered in systems. You will not encounter any errors if you read the full article. If you encounter an error while installing Metasploit, please contact me by commenting below.

15 Comments

Previous Post Next Post