adb-shell


Nameadb-shell JSON
Version 0.4.4 PyPI version JSON
download
home_pagehttps://github.com/JeffLIrion/adb_shell
SummaryA Python implementation of ADB with shell and FileSync functionality.
upload_time2023-09-01 03:48:40
maintainer
docs_urlNone
authorJeff Irion
requires_python
license
keywords adb android
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            adb\_shell
==========

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

.. image:: https://coveralls.io/repos/github/JeffLIrion/adb_shell/badge.svg?branch=master
   :target: https://coveralls.io/github/JeffLIrion/adb_shell?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/.

Prebuilt wheel can be downloaded from `nightly.link <https://nightly.link/JeffLIrion/adb_shell/workflows/python-package/master/wheel.zip>`_.

This Python package implements ADB shell and FileSync functionality.  It originated from `python-adb <https://github.com/google/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 <https://github.com/JeffLIrion/python-androidtv/blob/133063c8d6793a88259af405d6a69ceb301a0ca0/androidtv/adb_manager.py#L67>`_)

.. code-block:: python

   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.

.. code-block:: python

  from adb_shell.auth.keygen import keygen

  keygen('path/to/adbkey')

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/JeffLIrion/adb_shell",
    "name": "adb-shell",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "adb,android",
    "author": "Jeff Irion",
    "author_email": "jefflirion@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/8f/73/d246034db6f3e374dad9a35ee3f61345a6b239d4febd2a41ab69df9936fe/adb_shell-0.4.4.tar.gz",
    "platform": null,
    "description": "adb\\_shell\n==========\n\n.. image:: https://travis-ci.com/JeffLIrion/adb_shell.svg?branch=master\n   :target: https://travis-ci.com/JeffLIrion/adb_shell\n\n.. image:: https://coveralls.io/repos/github/JeffLIrion/adb_shell/badge.svg?branch=master\n   :target: https://coveralls.io/github/JeffLIrion/adb_shell?branch=master\n\n.. image:: https://pepy.tech/badge/adb-shell\n   :target: https://pepy.tech/project/adb-shell\n\n\nDocumentation for this package can be found at https://adb-shell.readthedocs.io/.\n\nPrebuilt wheel can be downloaded from `nightly.link <https://nightly.link/JeffLIrion/adb_shell/workflows/python-package/master/wheel.zip>`_.\n\nThis Python package implements ADB shell and FileSync functionality.  It originated from `python-adb <https://github.com/google/python-adb>`_.\n\nInstallation\n------------\n\n.. code-block::\n\n   pip install adb-shell\n\n\nAsync\n*****\n\nTo utilize the async version of this code, you must install into a Python 3.7+ environment via:\n\n.. code-block::\n\n   pip install adb-shell[async]\n\n\nUSB Support (Experimental)\n**************************\n\nTo connect to a device via USB, install this package via:\n\n.. code-block::\n\n   pip install adb-shell[usb]\n\n\nExample Usage\n-------------\n\n(Based on `androidtv/adb_manager.py <https://github.com/JeffLIrion/python-androidtv/blob/133063c8d6793a88259af405d6a69ceb301a0ca0/androidtv/adb_manager.py#L67>`_)\n\n.. code-block:: python\n\n   from adb_shell.adb_device import AdbDeviceTcp, AdbDeviceUsb\n   from adb_shell.auth.sign_pythonrsa import PythonRSASigner\n\n   # Load the public and private keys\n   adbkey = 'path/to/adbkey'\n   with open(adbkey) as f:\n       priv = f.read()\n   with open(adbkey + '.pub') as f:\n        pub = f.read()\n   signer = PythonRSASigner(pub, priv)\n\n   # Connect\n   device1 = AdbDeviceTcp('192.168.0.222', 5555, default_transport_timeout_s=9.)\n   device1.connect(rsa_keys=[signer], auth_timeout_s=0.1)\n\n   # Connect via USB (package must be installed via `pip install adb-shell[usb])`\n   device2 = AdbDeviceUsb()\n   device2.connect(rsa_keys=[signer], auth_timeout_s=0.1)\n\n   # Send a shell command\n   response1 = device1.shell('echo TEST1')\n   response2 = device2.shell('echo TEST2')\n\n\nGenerate ADB Key Files\n**********************\n\nIf you need to generate a key, you can do so as follows.\n\n.. code-block:: python\n\n  from adb_shell.auth.keygen import keygen\n\n  keygen('path/to/adbkey')\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A Python implementation of ADB with shell and FileSync functionality.",
    "version": "0.4.4",
    "project_urls": {
        "Homepage": "https://github.com/JeffLIrion/adb_shell"
    },
    "split_keywords": [
        "adb",
        "android"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f73d246034db6f3e374dad9a35ee3f61345a6b239d4febd2a41ab69df9936fe",
                "md5": "9874352aa4ac7a9060c1c01d382c0993",
                "sha256": "04c305f30a2ca25d5c54b3cd6ce9bb64c36e5f07967b23b3fb6aaecc851b90b6"
            },
            "downloads": -1,
            "filename": "adb_shell-0.4.4.tar.gz",
            "has_sig": false,
            "md5_digest": "9874352aa4ac7a9060c1c01d382c0993",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 61822,
            "upload_time": "2023-09-01T03:48:40",
            "upload_time_iso_8601": "2023-09-01T03:48:40.348620Z",
            "url": "https://files.pythonhosted.org/packages/8f/73/d246034db6f3e374dad9a35ee3f61345a6b239d4febd2a41ab69df9936fe/adb_shell-0.4.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-01 03:48:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JeffLIrion",
    "github_project": "adb_shell",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "adb-shell"
}
        
Elapsed time: 0.23536s