Git Product home page Git Product logo

adb_shell's Introduction

adb_shell

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

# 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')

adb_shell's People

Contributors

atti92 avatar cyanogen avatar fnzr avatar halastra avatar jefflirion avatar matthieuxyz avatar zeibou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.