Skip to content

Commit

Permalink
Add a bit more docs to the ADB module
Browse files Browse the repository at this point in the history
  • Loading branch information
zachriggle committed Nov 10, 2016
1 parent dc297e1 commit 6c304d3
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions pwnlib/adb/adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,38 @@
over the devices.
First and most important is the ``context.device`` property, which declares the "currently"
seelcted device in any scope. It can be set manually to a serial number, or to a ``Device``
selected device in any scope. It can be set manually to a serial number, or to a ``Device``
instance.
.. code-block:: python
>>> context.device = ''
# Take the first available device
context.device = adb.wait_for_device()
# Set a device by serial number
context.device = 'ZX1G22LH8S'
# Set a device by its product name
for device in adb.devices():
if device.product == 'shamu':
break
else:
error("Could not find any shamus!")
Once a device is selected, you can operate on it with any of the functions in
the ``pwnlib.adb`` module.
.. code-block:: python
# Get a process listing
print adb.process(['ps']).recvall()
# Fetch properties
print adb.properties.ro.build.fingerprint
# Read and write files
print adb.read('/proc/version')
adb.write('/data/local/tmp/foo', 'my data')
"""
import functools
Expand Down

0 comments on commit 6c304d3

Please sign in to comment.