Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging java obfuscated code

Tags:

We are going to obfuscate our project but don't want to lose the ability of remote debugging and hotswapping.

Is it possible? Which tools can handle this? I'd be happy with simple obfuscation - just renaming classes/methods/variables.

[Edited] We're using Intellij IDEA but wasn't able to find any plugin for this task.

like image 392
Vitaly Avatar asked Sep 03 '09 06:09

Vitaly


1 Answers

We have the same kind of needs (simple obfuscation, need to debug later) and we use ProGuard. It's a Java app, which can be integrated in an Ant task.

It can do a lot of things, but it's also fully tuneable. So you can keep your obfuscation simple. One of the options is to generate a "Symbol Correspondance Table", which allows you to retrive the non-obfucated code from the obfuscated one. (it keeps track that the variable xyz in the class qksdnqd is in fact myCuteVarName in the class MeaningfulClassName)

Edit: Obfuscation can be tricky. Some examples:

  • You can't change the name of your main method.
  • Do you use a classloader? Can it still retrieve the class after the obfuscation?
  • What about your ORM Mapping? Your Spring Context? (if any)

Edit2: You can also see:

  • Do you obfuscate your commercial Java code?
like image 173
Antoine Claval Avatar answered Oct 06 '22 00:10

Antoine Claval