Thursday January 31, 2008
Obfuscation
Today I was asked about obfuscation. In fact, the question was "how to obfuscate code in NetBeans". Well, code in NetBeans is like any other Java code anywhere else. And others have had the same need. I looked into it and came up with the following:
- Download ProGuard.
- In your build.xml, add the target outlined in this handy FAQ: Can I obfuscate a module? Just make sure to replace ${proguard.jar.path} with the full path to the proguard.jar, which can be anywhere. Also remove the dependency on init target, in the obfuscate target outlined in the above FAQ.
- Build your application. When you do so, the Output window shows that ProGuard writes a new folder with your own module's obfuscated classes:
- Look in the folder indicated above and there's the 'obfuscated' folder with the obfuscated classes:
Next I tried to decompile the classes, but all 3 of the decompiler plugins in the Plugin Portal failed me. But, if one wanted to decompile, there are many decompilers out there that could be used. The point is that obfuscation is not difficult to achieve, via the handy Ant target above. And, it's clear that if you have some top secret code that you need to obfuscate, there's a well trodden path that you can follow.
Jan 31 2008, 06:07:59 PM PST Permalink
I used ProGuard, with JDK6 code, some time ago and all decompilers I used failed. It seems a problem about JDK6 bytecodes and the decompilers.
Posted by asantiago on January 31, 2008 at 10:57 PM PST #
surely that's a good thing?
Posted by 204.79.90.30 on February 01, 2008 at 12:24 AM PST #
You're a funny man, 204.79.90.30. :-) Or maybe you're a woman. Woo... you obfuscated your gender. :-)
As for me, and asantiago, we'd like to decompile our code so that we can see that we've obfuscated it correctly. But, you're right, if we're able to decompile it, then the obfuscation is less obfuscated than now that we've failed to do so.
Posted by Geertjan on February 01, 2008 at 01:43 AM PST #
Nice post Geertjan ..thanx!
Posted by Paris Apostolopoulos on February 01, 2008 at 06:17 AM PST #


