Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Snippet for when you decompile an Android APK in JD-GUI and some of the strings are integer arrays instead of strings. This will convert the array to a string and print it.
# For when you decompile an Android APK and some of the strings are static integer arrays instead of strings,
# this snippet will print them out as strings. I've re-written this a few times so I figured I'd just
# post it here so I can find it when I need it.
strArray = []
# Drop your "private static final short[] a = { 65, 66, 67, 68, 69, 70, 71, 72, 73 ... }"" here, but replace [] w/ {}
strArray.append(
[65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57]
)
strArray.append(
[65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57]
)
strFinal = ''
for arr in strArray:
for elem in arr:
strFinal += chr(elem)
print(strFinal)
strFinal = ''
# OUTPUT:
# ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
# ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.