Android Dynamic Binary Instrumentation Toolkit
C Makefile Shell

adbi - The Android Dynamic Binary Instrumentation Toolkit

Simple binary instrumentation toolkit for Android ARM + Thumb.

Instrumentation is based on library injection and hooking function entry points (in-line hooking).

The toolkit consists of two main components the hijack tool and the base library.


The hijack tool provides the injection functionality. It supports a number of modes for supporting older and newer Android devices. hijack provides help on the command line.


The base library provides the hooking and unhooking functionality. The base library is compiled as a static library so it can be directly included in the actual instrumentation library. This is done so we can keep everything in /data/local/tmp.

Below we provide and easy to follow step-by-step instructions for howto build and use adbi. The example instrument hijacks epoll_wait() and logs every call to a file.

=== External Resources ===

more information at:

slide deck about this toolkit:

old code (with more examples):

=== Prerequisites ===

Android SDK Android NDK

=== How to Build ===

= build the hijack tool =

cd hijack
cd jni
cd ..
adb push libs/armeabi/hijack /data/local/tmp/
cd ..

= build the instrumentation base code =

cd instruments
cd base
cd jni
cd ..
cd ..

= build instrumentation example =

cd example
cd jni
cd ..
adb push libs/armeabi/ /data/local/tmp/

=== How to Run ===

adb shell
cd /data/local/tmp
# GET PID from
./hijack -d -p PID -l /data/local/tmp/
cat adbi_example.log

output should look similar to:

hooking:   epoll_wait = 0x4004c378 ARM using 0x4a84a588
epoll_wait() called
epoll_wait() called
epoll_wait() called
removing hook for epoll_wait()