Search code examples
javaandroidjardeobfuscation

How to get sources from obfuscated JAR


Decided to decompile .apk file

dex2jar helped me to get a JAR file

and I can open sources with JD GUI

But all the code is obfuscated

Is there any way (maybe some tool) to decrypt sources and get real code ??


Solution

  • Obfuscation is used for

    • decreasing the size of compiled code
    • performance improvements
    • preventing from unauthorized persons to take a look on the source code

    The last usage is like usage of door lock, so your question can be re-phrased as "how to enter locked door if I do not have keys?" :)

    So, if we forget the justice side and concentrate on technical aspects we can say that obfesactor actually just changes names of variables, classes, methods to something short and meaningless. If you are able to see this code and can understand meaning of specific variable, change its name using regular IDE re-factoring feature. Then move to other variable/method. Etc, etc. I do not believe that there can be more automatic tool, because only human can understand and decide what is the role of specific variable or method and rename it.

    I really hope that you are not going against the law and really do not want to be the helper of criminal. Again, I concentrated on technical issues only.