'Error with ruby version on termux when I try to install metasploit

I was installing metasploit with termux and it said: termux output

~ $ ls <br>
metasploit-framework  storage  wiki-termux<br>
~ $ cd metasploit-framework<br>
~/metasploit-framework $ ruby msfconsole<br>
Could not find Ascii85-1.1.0 in any of the sources<br>
Run bundle install to install missing gems.<br>
~/metasploit-framework $ bundle install<br>
Fetching gem metadata from https://rubygems.org/.........<br>
pcaprub-0.13.0 requires ruby version ~> 2.0, which is incompatible with the<br>
current version, ruby 3.0.0p0<br>

And if I try to install metaploit directly:

termux output

~ $ ls
metasploit-framework  storage  wiki-termux <br>
~ $ cd metasploit-framework <br>
~/metasploit-framework $ msfconsole <br>
The program msfconsole is not installed. Install it by executing: <br>
 pkg install metasploit <br>
~/metasploit-framework $ pkg install metasploit <br>
Checking availability of current mirror: ok <br>
Get:2  https://ipfs.io/ipns/k51qzi5uqu5dj05z8mr958kwvrg7a0wqouj5nnoo5uqu1btnsljvpznfaav9nk unstable InRelease [14.0 kB]<br>
Get:3 https://ipfs.io/ipns/k51qzi5uqu5dgu3homski160l4t4bmp52vb6dbgxb5bda90rewnwg64wnkwxj4 x11 InRelease [14.0 kB]<br>
Get:1 https://10.via0.com/ipns/k51qzi5uqu5dg9vawh923wejqffxiu9bhqlze5f508msk0h7ylpac27fdgaskx stable InRelease<br>
Hit:4 https://grimler.se/game-packages-24 games InRelease <br>
Hit:5 https://grimler.se/science-packages-24 science InRelease <br>
Fetched 42.0 kB in 4s (10.9 kB/s) <br>
Reading package lists... Done <br>
Building dependency tree... Done <br>
Reading state information... Done <br>
All packages are up to date. <br>
Reading package lists... Done <br>
Building dependency tree... Done <br>
Reading state information... Done <br>
E: Unable to locate package metasploit <br>


Solution 1:[1]

termux have removed metasploit and hydra package https://wiki.termux.com/wiki/FAQ#Where_are_Metasploit_and_Hydra_packages

Solution 2:[2]

You need Termuxblack for install Ruby2.

First install wget:

pkg install wget

Now get the Termuxblack install.sh:

wget https://github.com/Hax4us/TermuxBlack/raw/master/install.sh

Then type

sh install.sh

Now you can install Ruby2:

apt update && apt remove ruby && apt install ruby2

Now type 'bundler install' for installing missing gems (you should be in metasploit-framework/ directory.)

Then you can use ./msfconsole or ./msfvenom

If you want make shortcuts:

nano /usr/etc/profile.d/bash_aliases.sh

Then type the code:

alias msfconsole='/$HOME/path to metasploit/msfconsole' alias msfvenom='/$HOME/path to metasploit/msfvenom'

Now you can use msfconsole or msfvenom.

Solution 3:[3]

This problem has been fixed. Please check the source

cd metasploit-framework;
sed -i '13,15 {s/^/#/}' /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/hrr_rb_ssh-0.4.2/lib/hrr_rb_ssh/transport/encryption_algorithm/functionable.rb; sed -i '14 {s/^/#/}' /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/hrr_rb_ssh-0.4.2/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ecdsa_sha2_nistp256.rb; sed -i '14 {s/^/#/}' /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/hrr_rb_ssh-0.4.2/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ecdsa_sha2_nistp384.rb; sed -i '14 {s/^/#/}' /data/data/com.termux/files/usr/lib/ruby/gems/3.1.0/gems/hrr_rb_ssh-0.4.2/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ecdsa_sha2_nistp521.rb;
clear;echo "Done...."

Use official Metasploit repository suggested by the source. Working for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nicolas Martinez
Solution 2
Solution 3 user3286970