Skip to content

Commit

Permalink
Use print() function in both Python 2 and Python 3 (#1387)
Browse files Browse the repository at this point in the history
$ __pip install black future isort__
$ __futurize -f libfuturize.fixes.fix_print_with_import -w android.py__
$ __isort android.py__
$ __black android.py__
  • Loading branch information
cclauss authored and Arusekk committed Dec 8, 2019
1 parent dbf0549 commit 0491972
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions examples/android.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
from pwn import *
from __future__ import print_function

import gdb
from pwn import adb, context

# Tell pwntools that the target is an Android device
context.os='android'
context.arch='aarch64' # or 'arm'
context.os = "android"
context.arch = "aarch64" # or 'arm'

# Optionally, set the remote ADB server address
context.adb_host='172.16.110.1'
context.adb_host = "172.16.110.1"

# Wait for a device to become available
print adb.wait_for_device()
print(adb.wait_for_device())

# Who am I?
print adb.process('id').recvall().strip()
print(adb.process("id").recvall().strip())

# Interactive sessions!
io = adb.shell()
io.sendline('echo Hello, world; exit')
print io.recvall().replace('\r\n', '\n').strip()
io.sendline("echo Hello, world; exit")
print(io.recvall().replace("\r\n", "\n").strip())

# Debugging!
gdb.debug('sh').interactive()
gdb.debug("sh").interactive()

0 comments on commit 0491972

Please sign in to comment.