Skip to main content

Binder Trace

Binder Trace is a tool for intercepting and parsing Android Binder messages. Think of it as "Wireshark for Binder".

binder-trace demo

⚙️ Installation

You'll need a rooted Android device or emulator.

  • (Linux only) - install xclip or xsel for "copy to clipboard" functionality

    sudo apt-get install xclip

    sudo apt-get install xsel

  • Install from PyPi

    pip install binder-trace

  • Check which version of frida is installed (make sure you've pip installed the requirements)

    pip list | grep frida

  • Download the matching version of frida-server from the frida releases page

  • Make sure adb is running as root, push frida-server to your device and run it

    adb root

    adb push frida-server /data/local/tmp

    adb shell

    chmod u+x /data/local/tmp/frida-server

    adb shell /data/local/tmp/frida-server

Arguments

Argument Description
-h Prints the argument help.
-d DEVICE The device to attach to e.g. "emulator-5554". Use adb devices to list available devices. If not provided defaults to the USB device.
-p PID The pid of the process on DEVICE to attach to.
-n NAME The name of the process on DEVICE to attach to e.g. "Messaging".
-a [9, 10, 11, 13] The version of android to load structures for.
-s STRUCTPATH The path to the directory of structure files.

▶️ Starting binder trace

To start binder trace we need to pick a device and process to attach to. In the following example we use adb and frida-ps to identify a process to attach to on a local emulator. As it's an Android 11 emulator we choose the Android 11 structs directory. Pick the struct directory that most closely matches your version of Android. If you would like structures for a different version of Android, please let us know. Once it's running start using the target app to generate some binder transactions.

> adb devices
List of devices attached
emulator-5554   device

> frida-ps -Ua
 PID  Name           Identifier
----  -------------  ----------------------------
8334  Messaging      com.android.messaging
7941  Phone          com.android.dialer
9607  Settings       com.android.settings

> cd binder_trace
> binder-trace -d emulator-5554 -n Messaging -a 11

⌨️ Controls

Key Action
up Move up
down Move down
shift + up Page up
shift + down Page down
home Go to top
end Go to bottom
tab Next pane
shift + tab Previous pane
ctrl + c Copy pane to clipboard
f Open filter options
h Open help
q Quit

🔎 Filtering

If you're interested in specific messages you can filter the displayed results with the following options.

  • Interface - limit results to interfaces that contain the case sensitive search string e.g. "com.android" or "Sms".
  • Method - limit results to function names containing the specified case sensitive string.
  • Type - Limit results to certain types of messages e.g. requests or responses.

Once you've entered your filter options just press Enter to apply them.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

binder_trace-1.0.4-py3-none-any.whl (5.9 MB view details)

Uploaded Python 3

File details

Details for the file binder_trace-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: binder_trace-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for binder_trace-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cd138794e8c05ef97b5579309318e18f5fd5afd1bab3ed8da2aab653e0f041c0
MD5 bf8b8355f1fc9bdd44524c8fd411e8ce
BLAKE2b-256 7854ce1b903764dd3c78b1ae9be6953de2631e4f1e0ec837385f251b6b04e0d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page