py-adbkit
Python ADB automation toolkit for Android. Control devices, run shell commands, manage apps, capture screenshots, stream logcat, and automate pentesting workflows.
Install
pip install py-adbkit
Quick Start
from pyadbkit import ADB
adb = ADB()
# List devices
devices = adb.devices()
for dev in devices:
print(f"{dev.serial} - {dev.model} (Android {dev.android_version})")
# Connect via WiFi
adb.connect("192.168.1.100")
# Shell commands
code, stdout, stderr = adb.shell("DEVICE_SERIAL", "ls -la /sdcard/")
# Take screenshot
screenshot = adb.screenshot("DEVICE_SERIAL")
with open("screenshot.png", "wb") as f:
f.write(screenshot)
# Battery info
battery = adb.battery("DEVICE_SERIAL")
print(f"Battery: {battery.get('level', '?')}%")
Shell Automation
from pyadbkit import ADB
adb = ADB()
serial = adb.devices()[0].serial
# High-level shell interface
from pyadbkit.commands import Shell
sh = Shell(adb, serial)
# Get/set properties
android_ver = sh.getprop("ro.build.version.release")
# Settings
sh.settings_put("system", "screen_off_timeout", "600000")
# Launch activities
sh.am_start("com.android.settings/.Settings")
# Input automation
sh.input_tap(500, 500)
sh.input_swipe(100, 500, 900, 500, 300)
sh.input_text("hello world")
sh.input_keyevent(3) # HOME
# Root shell (if rooted)
sh.su("cat /data/data/com.package/databases/app.db")
App Management
# List installed packages
packages = adb.packages(serial, third_party=True)
# Install APK
adb.install(serial, "app.apk", flags=["-r", "-g"])
# Uninstall
adb.uninstall(serial, "com.package.name")
# Backup
adb.backup(serial, "backup.ab", packages=["com.package.name"])
Logcat
from pyadbkit.commands import Logcat
logcat = Logcat(adb, serial)
# Dump all logs
lines = logcat.dump(max_lines=500)
# Filter by tag
errors = logcat.by_tag("ActivityManager", level="E")
# Crash logs only
crashes = logcat.crash()
# Kernel logs
kernel = logcat.kernel()
File Operations
from pyadbkit.commands import Push, Pull
# Push file
pusher = Push(adb, serial)
pusher.file("local.apk", "/sdcard/Download/")
# Push entire directory
count = pusher.dir("./my_folder", "/sdcard/my_folder")
# Pull file
puller = Pull(adb, serial)
puller.file("/sdcard/Download/data.json", "./data.json")
# Pull directory
count = puller.dir("/sdcard/Documents", "./backup_docs")
Network
# WiFi ADB
adb.tcpip(serial, port=5555)
adb.connect("192.168.1.100", port=5555)
# Port forwarding
adb.forward(serial, local_port=8080, remote_port=8080)
# Reverse forwarding
adb.reverse(serial, remote_port=9090, local_port=9090)
Device Info
# Full device properties
dev = adb.get_device_props(serial)
print(f"Model: {dev.model}")
print(f"Android: {dev.android_version}")
print(f"Build: {dev.build_id}")
# Battery
battery = adb.battery(serial)
print(battery)
# Disk usage
mounts = adb.df(serial)
for m in mounts:
print(f"{m['mount']}: {m['used']}/{m['size']} ({m['use_pct']})")
# Running processes
processes = adb.process_list(serial)
Requirements
- Python >= 3.10
adbandfastbootinstalled and in PATH- USB debugging enabled on target device
Use Cases
- Root automation: Script the full root workflow alongside moto-root-2026
- Pentesting: Automate Android device reconnaissance and data extraction
- Testing: UI automation, app testing, screenshot capture
- Forensics: Pull app data, databases, and device logs
Donate
If this saved you time:
- PayPal: bill.jtrammell@gmail.com
- Cash App: $slauter99
License
MIT
Metadata
Release files for py-adbkit 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_adbkit-0.1.0.tar.gz | 7.2 kB | Without provenance | Details for py_adbkit-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_adbkit-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for py_adbkit-0.1.0-py3-none-any.whl |
Total release size: 14.9 kB
Release files / py_adbkit-0.1.0.tar.gz
| Download URL | py_adbkit-0.1.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45e95282b040cd7634d655f8cee1d0930a643a37d62ca92dded6f81e7a84584f
|
|
BLAKE2b-256 checksum How to use checksums |
c7abcc45344f1c7caad331a7ede8ddc131a2dfaf1064b673e28afda2d5c7be26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / py_adbkit-0.1.0-py3-none-any.whl
| Download URL | py_adbkit-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e735d9ad0d9bf7f0527ccee0c7be65b275e85fb60b5b5a1c8d2df1d4874c8ac9
|
|
BLAKE2b-256 checksum How to use checksums |
a5f6243a63550a22867ccab357d85673e59b1383be02932fc4a0f9511c669ddc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for py-adbkit 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.