|
66 | 66 | from pwnlib.context import LocalContext |
67 | 67 | from pwnlib.context import context |
68 | 68 | from pwnlib.device import Device |
| 69 | +from pwnlib.exception import PwnlibException |
69 | 70 | from pwnlib.log import getLogger |
70 | 71 | from pwnlib.protocols.adb import AdbClient |
71 | 72 | from pwnlib.util.packing import _decode |
@@ -122,7 +123,7 @@ def current_device(any=False): |
122 | 123 |
|
123 | 124 | >>> device = adb.current_device(any=True) |
124 | 125 | >>> device # doctest: +ELLIPSIS |
125 | | - AdbDevice(serial='emulator-5554', type='device', port='emulator', product='sdk_...phone_armv7', model='sdk ...phone armv7', device='generic') |
| 126 | + AdbDevice(serial='emulator-5554', type='device', port='emulator', product='sdk_...phone_...', model='...', device='generic...') |
126 | 127 | >>> device.port |
127 | 128 | 'emulator' |
128 | 129 | """ |
@@ -252,13 +253,13 @@ class AdbDevice(Device): |
252 | 253 |
|
253 | 254 | >>> device = adb.wait_for_device() |
254 | 255 | >>> device.arch |
255 | | - 'arm' |
| 256 | + 'amd64' |
256 | 257 | >>> device.bits |
257 | | - 32 |
| 258 | + 64 |
258 | 259 | >>> device.os |
259 | 260 | 'android' |
260 | 261 | >>> device.product # doctest: +ELLIPSIS |
261 | | - 'sdk_...phone_armv7' |
| 262 | + 'sdk_...phone_...' |
262 | 263 | >>> device.serial |
263 | 264 | 'emulator-5554' |
264 | 265 | """ |
@@ -1364,7 +1365,7 @@ def compile(source): |
1364 | 1365 | >>> filename = adb.compile(temp) |
1365 | 1366 | >>> sent = adb.push(filename, "/data/local/tmp") |
1366 | 1367 | >>> adb.process(sent).recvall() # doctest: +ELLIPSIS |
1367 | | - b'... /system/bin/linker\n...' |
| 1368 | + b'... /system/lib64/libc.so\n...' |
1368 | 1369 | """ |
1369 | 1370 |
|
1370 | 1371 | ndk_build = misc.which('ndk-build') |
@@ -1490,8 +1491,9 @@ class Partitions(object): |
1490 | 1491 | @context.quietfunc |
1491 | 1492 | def by_name_dir(self): |
1492 | 1493 | try: |
1493 | | - return next(find('/dev/block/platform','by-name')) |
1494 | | - except StopIteration: |
| 1494 | + with context.local(log_level=logging.FATAL): |
| 1495 | + return next(find('/dev/block/platform','by-name')) |
| 1496 | + except (StopIteration, PwnlibException): |
1495 | 1497 | return '/dev/block' |
1496 | 1498 |
|
1497 | 1499 | @context.quietfunc |
|
0 commit comments