An Anonymous VPN-Adapter

OnionCat on Android

This article is about how to compile and run OnionCat on Android. Unfortunately, there is no Android app which simply enables it, due to the lack of programming power.1 But if you are familiar with compiling projects and using ADB and the command line, this should be no big deal for you. Here’s how it works!

Root Your Phone

A requirement is that you Android smartphone is rooted since OnionCat accesses the tunnel device and configures an IPv6 address. Please do not ask how to root your phone! Please have a look at xdadevelopers instead.

Install Android NDK

You have to install the Android NDK. Go to developer.android.com/ndk and download and install it according to the instructions found on this page. Please do not forget to set the environment variable ANDROID_NDK properly. The best place to do this is .bashrc or .zshrc (or whatever shell you use). In my case this is

ANDROID_NDK=/home/eagle/android/android-ndk-r9d

Download OnionCat

Download the android_configure shell script into the previously extracted build directory of OC. This is a simple script which sets up the environment for cross-compilation and finally runs OnionCat’s native configure script. Run the script with

$ sh android_configure

Now simply run make.

$ make

This will compile OnionCat and finally produce an ARM 32 bit binary. You’ll find the executable file in src/ocat. ARM may not be the right platform for your smartphone. You’ll find the type of CPU in Settings->About Phone->CPU. If it is different you have to adjust the android_configure script accordingly (enivronment variables ANDROID_PREFIX and SYSROOT).

Copy OnionCat to Your Phone

Copy the executable to your Android phone. A good place for it is e.g. /system/bin. Make sure that it is executable. The best way to do the following tasks is either on the adb shell or directly within a terminal on your smartphone (or tablet). ADB (the Android Debug Bridge) is part of the Android SDK. Most Linux distros also have a package for it. I assume that you copied the ocat executable to your sdcard. Now run the adb shell, copy the file, and make it executable.

Install Orbot

Now install Orbot from F-Droid or GooglePlay and start the app. Go into the Settings and enable Hidden Service Hosting and choose 8060 to be the Hidden Service Port. Finally close the app and restart it. Connect Orbot to the Tor network by long-pressing the push button in the middle of the app. It will first turn yellow and then green if it’s ready.

Orbot will create the hidden service which is necessary for OnionCat. You can find the Onion Hostname (Onion ID) either in the Orbot Settings under Onion Hostname or on the command line in the appropriate data directory: