4 ms·
Maybe times have changed and these things are now included in the dex file, but that doesn't seem to be a verbatim decompiler output to me. Local variable name
by JosephRedfern 11y ago
Maybe times have changed and these things are now included in the dex file, but that doesn't seem to be a verbatim decompiler output to me.
Local variable names aren't normally stored in an APK, they're just refereed to by register numbers. For instance, I wouldn't expect to see "for(Pattern badHost : BAD_HOSTS)" (specifically the badHost) - last time I checked, this information would be lost during compilation.
I'm not suggesting that the code is falsified - the person that decompiled it probably just guessed at some variable names and re-factored to make it more readable. It just stood out to me, so I thought it was worth mentioning.
- bathory 11y agoThat's only true if you choose to obfuscate your code on android. I recently decompiled an apk and all variables/function names were perfectly readable
- JosephRedfern 11y agoEven variable names? I know that class/method/field names are visible, but I didn't think that local variable names were. I can't see a reason for them to be, aside from debugging... and presumably they're not shipping a debug build.
- mmebane 11y agoIt used to be incredibly common for production APKs to contain Java debug info (line numbers and variable names). IIRC, Android Studio now sets up the Release builds to strip this out and do basic ProGuard optimizations, but if WhatsApp was migrated from an old build system or something, it could easily be missing this step.
- JosephRedfern 11y agoThose were the days ;) I was under the impression that it's now no longer possible to upload an APK that has been built in Debug Mode to Google Play. I don't know if other app stores (i.e. Amazon App store) are enforcing this.
- Nutomic 11y agoDebug mode and obfuscation are completely seperate concepts. You can have a debug build with obfuscation or a release build without. Google Play doesn't care if an apk is obfuscated or not.
- toyg 11y agoI don't work with Android, but java code is usually visible after decompilation. Unless there is specific obfuscation tech being used, you should assume all your java code can be seen by others.
- JosephRedfern 11y agoYes, the "code" is - it has to be in order for it to be executed. My point is that method variable names are not normally visible.
- toyg 11y agoI'm not sure I follow -- this is what comes up from a random commercial project (I don't believe it's a debug build): http://i.imgur.com/OhdNC5A.png http://i.imgur.com/OhdNC5A.png What part would you refer to as "method variable name"?
- JosephRedfern 11y agoThat's weird. By "method variable names" I mean local variables, i.e. those declared inside a method. I'm not getting the same results as you with a little sample program I wrote - see: https://gist.github.com/JosephRedfern/662131ceb2119abf3e83 https://gist.github.com/JosephRedfern/662131ceb2119abf3e83. Field names and method names are preserved (which make sense), but local variable names are lost (which also makes sense to me!) Are you sure that your example code doesn't include debug information?
- toyg 11y agoYou're looking at the bytecode. If you want full decompilation, use one of the tools mentioned here: http://stackoverflow.com/questions/272535/how-do-i-decompile-java-class-files http://stackoverflow.com/questions/272535/how-do-i-decompile...
- JosephRedfern 11y ago
- sk5t 11y agoLocal variables no, but a method name like isBadHost, and the field BAD_HOSTS, would be preserved in the absence of an obfuscator (and then, its job would not be trivial as isBadHost is scoped public).