Skip to content

NetherlandsForensicInstitute/adb-pywrapper

Repository files navigation

adb-pywrapper

A python wrapper for the Android Debug Bridge enabling interaction with Android devices and emulators.

adb-pywrapper logo

AdbDevice: Interacting with Android Devices using ADB in Python

The AdbDevice class in the adb-pywrapper Python package facilitates seamless interaction with Android devices using the Android Debug Bridge (ADB) directly within Python scripts.

Installation

To install the adb-pywrapper package from the internal Nexus PyPI server, you can use pip:

pip install adb-pywrapper

Before using adb-pywrapper, ensure that ADB is installed on your machine and added to PATH. You can download and install the Android SDK, which includes ADB, from the official Android developer website.

If running the below in a terminal gives you an output, you are ready to go!

adb --version

Getting Started

Import the necessary modules:

from adb_pywrapper.adb_device import AdbDevice
from adb_pywrapper.adb_result import AdbResult
from adb_pywrapper.pull_result import PullResult

Listing Connected Devices

You can list all connected devices using the list_devices method (this can be done before creating an instance):

Looks for connected adb devices and returns the device names in a list.
:return: list of adb device names. Example: ['device-5554','AU9AD74','netagfer987']

devices = AdbDevice.list_devices()

get_device_status