A Python implementation of ADB with shell and FileSync functionality.
Project description
Documentation for this package can be found at https://adb-shell.readthedocs.io/.
Prebuilt wheel can be downloaded from nightly.link.
This Python package implements ADB shell and FileSync functionality. It originated from python-adb.
Installation
pip install adb-shell
Async
To utilize the async version of this code, you must install into a Python 3.7+ environment via:
pip install adb-shell[async]
USB Support (Experimental)
To connect to a device via USB, install this package via:
pip install adb-shell[usb]
Example Usage
(Based on androidtv/adb_manager.py)
from adb_shell.adb_device import AdbDeviceTcp, AdbDeviceUsb
from adb_shell.auth.sign_pythonrsa import PythonRSASigner
# Load the public and private keys
adbkey = 'path/to/adbkey'
with open(adbkey) as f:
priv = f.read()
with open(adbkey + '.pub') as f:
pub = f.read()
signer = PythonRSASigner(pub, priv)
# Connect
device1 = AdbDeviceTcp('192.168.0.222', 5555, default_transport_timeout_s=9.)
device1.connect(rsa_keys=[signer], auth_timeout_s=0.1)
# Connect via USB (package must be installed via `pip install adb-shell[usb])`
device2 = AdbDeviceUsb()
device2.connect(rsa_keys=[signer], auth_timeout_s=0.1)
# Send a shell command
response1 = device1.shell('echo TEST1')
response2 = device2.shell('echo TEST2')
Generate ADB Key Files
If you need to generate a key, you can do so as follows.
from adb_shell.auth.keygen import keygen
keygen('path/to/adbkey')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
adb_shell-0.4.4.tar.gz
(61.8 kB
view details)
File details
Details for the file adb_shell-0.4.4.tar.gz
.
File metadata
- Download URL: adb_shell-0.4.4.tar.gz
- Upload date:
- Size: 61.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04c305f30a2ca25d5c54b3cd6ce9bb64c36e5f07967b23b3fb6aaecc851b90b6 |
|
MD5 | 9874352aa4ac7a9060c1c01d382c0993 |
|
BLAKE2b-256 | 8f73d246034db6f3e374dad9a35ee3f61345a6b239d4febd2a41ab69df9936fe |