Skip to content

Commit 5589e15

Browse files
authored
Decoded data from recv_all in packages to a string (Gallopsled#2237)
* Decoded data from recv_all in packages to a string * Added sources for UTF-8 usage in Android * Updated adb source
1 parent 40c1ef5 commit 5589e15

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pwnlib/adb/adb.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,10 @@ def uninstall(package, *arguments):
15911591
@context.quietfunc
15921592
def packages():
15931593
"""Returns a list of packages installed on the system"""
1594-
packages = process(['pm', 'list', 'packages']).recvall()
1594+
# Decodes the received bytes as UTF-8 per:
1595+
# https://developer.android.com/reference/java/nio/charset/Charset#defaultCharset()
1596+
# where it is specified that UTF-8 is the default charset for Android.
1597+
packages = process(['pm', 'list', 'packages']).recvall().decode('utf-8')
15951598
return [line.split('package:', 1)[-1] for line in packages.splitlines()]
15961599

15971600
@context.quietfunc

0 commit comments

Comments
 (0)