Phone as Workstation: Termux & Kali Nethunter

Phone as Workstation: Termux & Kali Nethunter

In modern times, smartphones are said to be as powerful as modern computers. Whatever you can do on your proper desktop or PC you can do on your phone.

I decided to put that to the test by doing PC-related programming, hacking, and other stuff right on my phone. Also because I’m in a situation where I don’t get to use my computer often and I want a way to continue with my hacking and programming related hobbies.

Conditions

I’m currently using a Samsung A70 (2-Year-old smartphone). I decided not to root my device due to laziness and stability concerns.

I think the main goal is not just to make my phone do the things my desktop can, but also do it comfortably and conveniently.

Solutions

Termux

Termux is a Terminal emulator for Android. However, unlike other terminal emulators like Terminal Emulator, it also provides a package manager (pkg, which is basically a wrapper around apt) and a workable environment to install some Linux packages and use proper Linux tools.

To use it, you can just google the apk online, or download it from FDroid / Google Play

Kali Nethunter (Rootless)

Kali Nethunter allows you to basically run a full instance of Kali Linux right on your Android phone. This is useful for Hacking and CTFs, you may want tools like gobuster and more easily accessible.

Unfortunately, the full version of NetHunter requires rooting, and only certain phone models are supported (which doesn’t include my mid-range smartphone). Hence, I settled with the Rootless version, which does not have other features that I don’t need like BadUSB, Man in the Middle attacks and more. You can find instructions on how to install it on Kali’s website.

Cool looking Android Setup. (Not my actual Setup)

Other Android on Linux solutions

There are many other apps such as Android, like AnLinux, UserLAnd and more, but they often use Termux. I personally haven’t tested too much, but I find them cumbersome and less straightforward to set up than Kali Nethunter.

For Termux, you can install this package proot to allow you to download and chroot into many different Linux distributions, like Ubuntu and more.

Usability

If you want you can install X11 and a desktop environment. After that, use VNC (or KeX for Kali Nethunter) to access the environment. However, this is not that easy on the eyes, and you would need an external monitor (or a magnifying glass, which I used because I’m poor). Having a proper keyboard and mouse connected to your phone through either Bluetooth or USB OTG helps a lot too.

However, if you want to keep using VNC, I find it better to use an alternative VNC client instead of the one included with Kali Nethunter. Some examples include VNC Viewer.

On the go, I just find it more convenient to type in terminal commands on my phone. It allows you to copy and paste text commands and more. One useful tool to install is Hacker’s Keyboard, which gives you additional keys like Ctrl and Alt, useful for interacting with Termux/Kali

Functionality

So what can you actually do with this setup? Here are some things I did

  • Do TryHackMe Boxes with tools like gobuster, nmap, sqlmap, Metasploit and more
  • Participate in CTFs, ssh into remote boxes and disassemble binaries using Cutter
  • Use qemu to fun a full x86 virtual machine for testing.
  • Verilog/Python/C programming and testing out libraries, even coding games (using PhaserJS)
  • Host a mini webserver on your phone using python3 http.server(but the port number must be greater than 1000 unless if your phone is rooted)
  • Use the desktop environment to do things in a desktop way, such as visiting websites (Like Google Colab), terminal emulators and more.

Limitations

Unfortunately, there are limitations. Some of these include

  • x86/x64 and some other packages would not install or run properly on the setup. This severely restricts the type of apps you can use. This can be countered with virtual machines like qemu but still
  • Performance. After all, it is still a small mobile phone not optimized for performance, especially a mid-ranged one like mine. Programs will run more slowly than usual. One great example is Metasploit, which can take minutes to load.
  • File management is a pain. This is because Termux stores its data in the app itself and not as a folder in internal storage. This makes it much harder to access, move and modify files, having to resort to alternatives like moving the file in Termux instead of in the file browser or hosting a web server to download the file easily from Android’s UI.

Overall

I think this is a great solution so far in terms of productivity. It is rather flexible to use. You can change between typing on the terminal on the go, and connecting your phone to a Bluetooth keyboard and mouse (and magnifying glass) to use a proper desktop interface. There is a lot you can do with this setup. However, there are still some things that cannot be done or done well, so we’ll see next time….