Tuesday, October 11, 2011

Obfuscated Android Code

How to Obfuscated Android Code

Obfuscated code is source or machine code that has been made difficult to understand for humans. Programmers may deliberately obfuscate code to conceal its purpose or its logic to prevent tampering, deter reverse engineering, or as a puzzle or recreational challenge for someone reading the source code.
Programs known as obfuscators transform readable code into obfuscated code using various techniques. Code obfuscation is different in essence from hardware obfuscation, where description and/or structure of a circuit is modified to hide its functionality.


The following steps to describe the android obfuscation


1) Setup the obfuscated environment Download the follwing file before you starts

ProGuard

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it preverifies the processed code for Java 6 or for Java Micro Edition.

Download From Sourceforge : http://sourceforge.net/projects/proguard/files/

Reference : http://proguard.sourceforge.net/


Download files from internet

  • add-proguard-release.xml
  • procfg.txt

1) To update an existing Android project, open a command-line and navigate to the tools/ directory of your SDK. Now run:

android update project --name --target --path

2) So, now you have a signed build from the command line, but still no obfuscated build.

To make things easy, you’re going to want to get two helper files:


add-proguard-release.xml and procfg.txt

Copy these files into your root directory (where the build.xml file found).

3) To add Proguard to your build, you first need to edit your local properties file to add the location of the directory that Proguard is installed in:


proguard.dir=/Directory/Proguard/Is/Installed/In

3) Finally... you need to add our script to your build file and have it override a few targets. To do this, we use the XML “entity” construct. At the top of your build.xml file, add an entity that references our script file:

]

>

4) By default ADT creates a proguard.cfg file with every new project, so if you have an existing project just copy it over from a new dummy project. The next step is to enableProGuard, you do this by adding the following to your default.properties file:

proguard.config=proguard.cfg

(assuming proguard.cfg is the ProGuard configuration file created for you, or copied from a new project, into the project root folder.)



No comments:

Post a Comment