Monday, 11 November 2013

Reverse Engineering of Android applications



I happy share my answer from Stack Overflow regarding to reverse engineered the android application (.apk). 

Procedure for decoding .apk files, step-by-step method:
Step 1:
Make a new folder and put .apk file in it (which you want to decode). Now rename the extension of this .apk file to .zip (eg.: rename from filename.apk to filename.apk.zip) and save it.
If problems in the converting into .zip please refers below link
After getting .zip now you get classes.dex files, etc. At this stage you are able to see 
drawable but not xml and java files, so continue.
If you don’t see the extensions go through check the configuration 
Step 2:
Now extract this zip apk file in the same folder. Now download dex2jar from this link http://code.google.com/p/dex2jar/ and extract it to the same folder. Now open command prompt and change directory to that folder.

Then write dex2jar classes.dex and press enter. Now you get classes.dex.dex2jar file in the same folder.

Then download java de-compiler from http://java.decompiler.free.fr/?q=jdgui and now double click on jd-gui and click on open file. Then open classes.dex.dex2jar file from that folder. Now you get class files and save all these class files (click on file then click "save all sources" in jd-gui) by src name. Extract that zip file (classes_dex2jar.src.zip) and you will get all java files of the application.

At this stage you get java source but the xml files are still unreadable, so continue.

Step 3:
Now open another new folder and put these files
1.    put .apk file which you want to decode
2.    download
install window using google and put in the same folder
3.    download framework-res.apk file using google and put in the same folder (Not all apk file need framework-res.apk file)
4.    Open a command window
5.    Navigate to the root directory of APKtool and type the following command: 
apktool if framework-res.apk.
Above command should result in "Framework installed ...".

6.    apktool d "appName".apk ("appName" denotes application which you want to decode) now you get a file folder in that folder and now you can easily read xml files also.

Step 4:
Finally we got the res/ as well as java code of project which is our target at starting. Enjoys the coding

Src –

  1.     http://comptech-blogger.blogspot.in/2012/09/how-to-get-source-code-from-apk-file.html
  2.     http://stackoverflow.com/questions/3593420/android-getting-source-code-from-an-apk-file

1 comment: