
Install and run Metasploit Framework 6 on Android via Termux with automated setup, payload generation (msfvenom), and full msfconsole access for mobile penetration testing.
Installs and maintains Metasploit Framework on a non-rooted Android phone, entirely inside Termux.

Old or previously-broken Termux setup? Purge Termux data in Android Settings, reinstall from F-Droid, open it once, force-stop, then proceed. A stale package set is the most common source of install failures.
One command:
bash <(curl -fsSL https://raw.githubusercontent.com/gushmazuko/metasploit_in_termux/master/metasploit.sh)
Or manually:
curl -fsSL -o metasploit.sh https://raw.githubusercontent.com/gushmazuko/metasploit_in_termux/master/metasploit.sh
chmod +x metasploit.sh
./metasploit.sh
The installer verifies that msfconsole actually boots before reporting success.
| Command | What it does |
|---|---|
msfconsole | Start Metasploit |
msfvenom | Generate payloads |
msfrpcd | Start the RPC daemon |
msf-setup --update | Update Metasploit in place |
msf-setup --uninstall | Remove Metasploit, symlinks and the installer |
msf-setup --uninstall --purge | Also delete ~/.msf4 — loot, history, database |
msf-setup is installed locally as a command; the same flags also work directly from the one-liner (e.g. ... metasploit.sh --update).
bash <(curl -fsSL https://raw.githubusercontent.com/gushmazuko/metasploit_in_termux/master/metasploit.sh) --with-db
Initializes a dedicated PostgreSQL in ~/.msf4/db on port 5433 (msfdb-style). An existing Termux PostgreSQL cluster, if you have one, is never touched. The database does not auto-start after a reboot — restart it with pg_ctl -D ~/.msf4/db -o "-p 5433" start.
Full transparency, since this script installs packages and modifies your Termux prefix:
| Item | Detail |
|---|---|
| Installs | Termux packages (clang, ruby, postgresql, libxml2, …) and upgrades existing ones, then Metasploit via bundle install |
| Framework location | $PREFIX/opt/metasploit-framework (shallow clone of upstream master) |
| Gems | Isolated in vendor/bundle inside the framework dir — only bundler itself goes to the system gem dir |
| Commands | msfconsole, msfvenom, msfrpcd, msf-setup symlinked into $PREFIX/bin |
| Local patches to upstream | termux-fix-shebang on the three binaries (Android has no /usr/bin/env); Ruby-4.0 default-gem alignment (date, stringio) and a relaxed date pin in the gemspec — re-applied automatically by --update |
| Data | ~/.msf4 is created by Metasploit itself (and by --with-db) and is only removed with --uninstall --purge |