Sunday 11 September 2016

ProGuard: Code Obfuscation tool

ProGuard is a Java class file shrinker and code obfuscator.

What is Obfuscation?
Obfuscation is the process of converting programming code to some other form, so it is difficult to perform reverse engineering (Difficult to understand by humans). Now a days, sophisticated Java decompilers are available, which convert Java class files to source code. By using any good decompiler, one can reverse engineer the code, which is a security threat, by using obfuscation, we can make this reverse engineering process hard.

How ProGuard helps to my project?
a.   It detect and remove unused classes, method and attributes.
b.   List the dead code, so you can remove it from the source code.
c.    Rename the classes, fields, methods with meaning less names, so it is difficult to reverse engineer.

Where can I download Proguard?
You can download ProGuard from following location.

License
GNU General Public License (GPL)

User Interface
Provides both command line and graphical user interface.

How ProGuard perform Obfuscation?
The process is divided into 4 steps.

a.   Shrink: Detects and removes unused classes, fields, methods, and attributes.
b.   Optimize: Analyzes and optimizes the bytecode of the methods.
c.    Obfuscate: Renames the remaining classes, fields, and methods using short meaningless names.
d.   Preverify: Adds preverification information to Java classes, it is required for Java Micro Edition and for Java 6 and higher.

How to use Progard in command line mode?
java -jar proguard.jar –injars inputJarFilesLocation –outjars outputJarFilesLocation

Ex:
java -jar proguard.jar -injars input.jar -outjars out.jar

For full command line options usage, refer following link.

How to use ProGuard in GUI mode?
Use following command to open ProGuard in GUI mode.
java -jar proguardgui.jar

For more information about ProGuard in GUI mode, refer following link.

What is the current stable version?
At the time of writing this article, the stable version is Version 5.2, released in January 2015.

Useful resources       
Available Java Obfuscators

Proguard Obfuscation Metrics


No comments:

Post a Comment