How To Reverse Engineer Using Advanced Apk Tool

Introduction

 
Reverse engineering, aka, back engineering is the process of extracting knowledge or design information from anything man-made and then, reproducing it or reproducing anything based on the extracted information.
 
 
To decompile any Android application, you can take help from reverse engineerin tools. To make that, there are many software and applications which can deal with such work – one of my favourites is IDA Pro.
 
In this experiment, we are using Whatsapp application and Apktool to reverse engineer the source code of the application. The main goal of reverse engineering is to get the information that it holds in the forward engineering, because as someone gets the source code of any file, he/she can reverse it to formulate a new innovative thing.
 
So, in here, we are having only the whatsapp.apk file. We don’t have any source code but our ultimate goal is to find the source code.
 
Prerequisite for reverse engineering
  • Java 7 installed
  • Advanced Apktool
  • Any .apk file
  • framework-res.apk
Download
Apktool -> Apktool is a tool for reverse engineering the 3rd party, closed, and binary Android apps. It can decode resources to nearly original form and rebuild them after making some modifications; which makes it possible to debug a small code step by step. Also, it makes working with app easier because of project-like file structure and automation of some of the repetitive tasks, like building apk, etc.
 
Features
  • Disassembling resources to nearly original form (including resources.arsc, classes.dex, 9.png. and XMLs).
  • Rebuilding decoded resources back to binary APK/JAR.
  • Organizing and handling APKs that depend on framework resources.
  • Smali Debugging (Removed in 2.1.0 in favor of IdeaSmali)
  • Helping with repetitive tasks
After downloading Apktool, extract it and match the file as below image. You should have these files to make complete decompilation of any apk. After that, you have to put your Whatsapp apk file and framework-res apk in 2-In folder.
 
 
Run Advanced ApkTool and you will get nice options to load your apk file. It looks something like the below image.
 
 
Here, you have to choose your Decompile file. For that, you have to give option as 2, but before that, you have to install the framework.res apk; so hit 1. Now, that starts decompiling your apk by 2. There you will see your apk. Once you select your apk, it will start decompiling.
 
If you go ahead without reverse engineering, there will definitely be the files of source code of apk, but it is in encrypted form. You cannot analyse them properly and that is why we are using a proper channel to decompiled the code.
 
 
 
You can check your Java source in the 3-Out Folder. You will see all your source code for the particular apk and can go through all of them to make certain changes- like changing version, changing name of the app, change the UI of the app and many more.
 
 
After making your changes in the code, you can save your work; and now, you have recompiled and signed it, without signed apk – it will not work in any device. It will throw parsing error while installing, so make sure you have signed your apk after recompilation.
 
For that, you have to open Apktool again and choose "3 – Recompile Files", choose your apk, and choose Recompile and then Signed. Press Enter finally. Your apk will be recompiled and the new apk will be located at 4-Done folder.
 
 
Hope you liked it. Thank you for reading. Have a good day.