Last active
March 1, 2019 16:45
-
-
Save decidedlygray/f465a6f546ba3e930abe52f7f8cd3391 to your computer and use it in GitHub Desktop.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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