Need help with adb_shell?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

JeffLIrion
221 Stars 32 Forks Apache License 2.0 171 Commits 8 Opened issues

Description

A Python implementation of ADB with shell and FileSync functionality.

Services available

!
?

Need anything else?

Contributors list

# 9,359
Python
TeX
path-pl...
Raspber...
156 commits
# 28,274
Python
Kuberne...
python3
Redis
4 commits
# 329,383
Python
Shell
adb
2 commits
# 140,264
slack
stegano...
data-ex...
CSS
1 commit
# 159,941
Shell
C
Racket
adb
1 commit

adb_shell

.. image:: https://travis-ci.com/JeffLIrion/adbshell.svg?branch=master :target: https://travis-ci.com/JeffLIrion/adbshell

.. image:: https://coveralls.io/repos/github/JeffLIrion/adbshell/badge.svg?branch=master :target: https://coveralls.io/github/JeffLIrion/adbshell?branch=master

.. image:: https://pepy.tech/badge/adb-shell :target: https://pepy.tech/project/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

.. code-block::

pip install adb-shell

Async


To utilize the async version of this code, you must install into a Python 3.7+ environment via:

.. code-block::

pip install adb-shell[async]

USB Support (Experimental)


To connect to a device via USB, install this package via:

.. code-block::

pip install adb-shell[usb]

Example Usage

(Based on

androidtv/adb_manager.py 
_)

.. code-block:: python

from adbshell.adbdevice import AdbDeviceTcp, AdbDeviceUsb from adbshell.auth.signpythonrsa 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, defaulttransporttimeouts=9.) device1.connect(rsakeys=[signer], authtimeouts=0.1)

# Connect via USB (package must be installed via

pip install adb-shell[usb])
device2 = AdbDeviceUsb() device2.connect(rsakeys=[signer], authtimeout_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.

.. code-block:: python

from adb_shell.auth.keygen import keygen

keygen('path/to/adbkey')

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.