Skip to main content

A Python implementation of ADB with shell and FileSync functionality.

Project description

https://travis-ci.com/JeffLIrion/adb_shell.svg?branch=master https://coveralls.io/repos/github/JeffLIrion/adb_shell/badge.svg?branch=master https://pepy.tech/badge/adb-shell

Documentation for this package can be found at https://adb-shell.readthedocs.io/.

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.6+ 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

# Connect (no authentication necessary)
device1 = AdbDeviceTcp('192.168.0.111', 5555, default_transport_timeout_s=9.)
device1.connect(auth_timeout_s=0.1)

# Connect (authentication required)
with open('path/to/adbkey') as f:
    priv = f.read()
signer = PythonRSASigner('', priv)
device2 = AdbDeviceTcp('192.168.0.222', 5555, default_transport_timeout_s=9.)
device2.connect(rsa_keys=[signer], auth_timeout_s=0.1)

# Connect via USB (package must be installed via `pip install adb-shell[usb])`
with open('path/to/adbkey') as f:
    priv = f.read()
signer = PythonRSASigner('', priv)
device3 = AdbDeviceUsb('ab78c6ef')
device3.connect(rsa_keys=[signer], auth_timeout_s=0.1)

# Send a shell command
response1 = device1.shell('echo TEST1')
response2 = device2.shell('echo TEST2')
response3 = device3.shell('echo TEST3')

Project details


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.2.0.tar.gz (37.1 kB view details)

Uploaded Source

Built Distribution

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

adb_shell-0.2.0-py3-none-any.whl (48.3 kB view details)

Uploaded Python 3

File details

Details for the file adb_shell-0.2.0.tar.gz.

File metadata

  • Download URL: adb_shell-0.2.0.tar.gz
  • Upload date:
  • Size: 37.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.3

File hashes

Hashes for adb_shell-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b47d47b8983d7508cf32a24866e1579a4f75f4637b9502454bed5fc77a86ee22
MD5 3b8552de366e201c88bf6a623370a1a1
BLAKE2b-256 5cb96e92852b565cacb4695cc8594b0487b5c0384bde8e792e7ee1405da8737e

See more details on using hashes here.

File details

Details for the file adb_shell-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: adb_shell-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 48.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.3

File hashes

Hashes for adb_shell-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39234371c70446bd31ba91a18ace60b2a5ae77ec833cec1b7c655f722a6b3702
MD5 1d1e54cfa2d5fdd9cc12d193ba048c46
BLAKE2b-256 3e09eec182ff8a0d4983fb1355c94bb869716b86acf345bc250b59c7779b9477

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 Pingdom Monitoring Sentry Error logging StatusPage Status page