Site icon Bytefreaks.net

Building SnoopSnitch on Ubuntu 16.10 64bit

Advertisements

Step A: Update the system and install all necessary packages

sudo dpkg --add-architecture i386;
sudo apt-get update;
sudo apt-get upgrade -y;
sudo apt-get install git openjdk-8-jdk dh-autoreconf ant libncurses5:i386 libstdc++6:i386 zlib1g:i386 -y;
cd ~/;
mkdir Android;
cd Android;

Step B: Download the Android SDK and install all required packages

The following download link we got it from this page https://developer.android.com/studio/

wget https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz;
tar -xf android-sdk_r24.4.1-linux.tgz;
cd android-sdk-linux/tools;
#To list all available packages, including the obsolete extra-android-support
#./android list sdk --all –extended;
./android update sdk --no-ui --all --filter extra-android-support,tools,platform-tools,build-tools-19.1.0,android-19;

You will get a prompt for a license agreement, you need to type Y to proceed

November 20, 2015
Do you accept the license 'android-sdk-license-c81a61d9' [y/n]: y
cd ../..;
export ANDROID_HOME=`pwd`/android-sdk-linux;

Step C: Once the installation is complete, we need to install the Android NDK.

The following link we got it from https://developer.android.com/ndk/downloads/

wget https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip;
unzip -q android-ndk-r13b-linux-x86_64.zip;
export NDK_DIR=`pwd`/android-ndk-r13b;
#If we do not update the PATH we will get the following error: ../libtool: line 1719: arm-linux-androideabi-ranlib: command not found
PATH=$PATH:`pwd`/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin;
mkdir Projects;
cd Projects;

Step D: Afterwards, we can download SnoopSnitch and all of the git submodules of it using the following command.

git clone --recursive https://opensource.srlabs.de/git/snoopsnitch.git;

Step E: Then we need to compile two separate parts of the project.

We will start by compiling contrib/ projects, that are the supplementary projects needed for SnoopSnitch to get data.

cd snoopsnitch/contrib/;
./compile.sh -t android -u;
cd ..;

Step F: Finally, we can proceed to compile the android project of SnoopSnitch.

cd ./SnoopSnitch;

We need to update Application.mk and add APP_ABI := armeabi to it.
We do this to make sure that we compile  diag-helper.c only for armeabi as the rest of the packages will be available only on that architecture.
If we do not do this and we have a processor that supports armeabi-v7a (or different), then it will only install diag-helper.so and it will ignore the rest. Which will of course cause the application to fail.

echo "APP_ABI := armeabi" >> jni/Application.mk;
ant debug;
~/Android/android-sdk-linux/platform-tools/adb start-server

Once the compilation is complete, we can upload our apk to a device using the following commands:

#First we make sure that the adb server is running
$ANDROID_HOME/platform-tools/adb start-server;
#Then we check that our device is visible to the adb
$ANDROID_HOME/platform-tools/adb devices;
#Finally, we install the application to the device.
$ANDROID_HOME/platform-tools/adb install bin/SnoopSnitch-debug.apk;

This guide was tested on freshly installed Ubuntu 16.10 64bit.

snoopsnitch-map

Useful links

This post is also available in: Αγγλικα

Exit mobile version