In this article Suneet Singh, is going to explain with an example what is reverse engineering and how you can do it!.
What is Reverse Engineering?
Reverse Engineering or sometimes called as backwards engineering, is a process used to understand the working and/or construction of a closed or intrinsically unknown system, process or a software.
APK stands for Androird Application Package, and as the name suggests it is a package of different types of files which collectively makes an .apk. An apk file is similar to a software installer but for android smartphones. An apk file can be opened using an archive viewer and its files can be extracted but some files are in .dex format which can only be read and understood after converting them into a readable format.
So we use Reverse Engineering techniques and tools to convert these .dex files into jar format to understand and look into the working and construction of a particular android application. We focus on .dex files as these file contains the info and logic for major working of an android application.
To get the APK of any application you can either download its apk from websites like apkpure.com or you can use applications available in playstore to make apk of pre-installed application.
Tools and Softwares Required:
- Win rar
- D2J (dex2jar)
* apk-tool (For 2nd method)
*I am using all above mentioned tools on a windows 10 PC.
Step1. First, open the .apk file in win-rar and extract the classes.dex file from your .apk file.
Step 2. Now paste the classes.dex file in dex2jar folder.
Then open cmd inside dex2jar folde and run command “ d2j-dex2jar.bat classes.dex” inside cmd.
After hitting enter a file name “classes-dex2jar.jar” will be created inside this folder.
Step3. Now copy this “ classes-dex2jar.jar” file into your jd-gui folder.
Open jd-gui.exe and drag & drop the “classes-dex2jar.jar” over the jd-gui window.
Here you have now reverse engineered the .dex file and can read the source code of your android application.
Method 2nd: Using apk-tool
Step1. First you need to install apktool, you can install apk tool by watching youtube tutorial.
Step2. Now after you have configured apk tool and added it to your root path, open the folder in which your apk file is located.
Here open cmd inside that folder and type “apktool name_of_apk”
(For example: in my case my android apk is named “test.apk”, so I will type command “apktool test.apk” and hit enter).
Step2. After step1, a folder with the same name as that of apk file will be created.
Inside this folder you can view any film using a simple text viewer or .xml file in a browser.
Thank you for your time (Suneet Singh).
Contact Suneet Singh
¡Read more of his work here! (Medium profile)