Apktool is a tool used for Android application reverse engineering, and for creating malware by infecting legitimate apps.
Apktool is one of the most important tools that must be included in an Android penetration tester's arsenal.
Install and Configure for Apktool
Features
- Disassembling resources to their 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
Requirements
- Java
- Basic knowledge of Android SDK, AAPT, and Smali
Apktool for Windows
2. Download apktool-2 (find the newest here). Move the downloaded file to the C:\apktool\ folder. Rename the downloaded jar to apktool.jar.
3. If you do not have access to Apktool, then you have to add that directory to your Environment Variables System PATH variable.
Right-Click on This PC > Click Properties > Advanced System Settings > Environment Varibale.
4. Double click on Path and paste the path of the system variable. Put a semicolon (;) and paste the path C:\apktool. For Windows 10 users just paste no need semicolon.
5. To Run Apktool, open Command Prompt (Press CTRL + R and type cmd) and type apktool.
Apktool for Linux
Apktool comes pre-installed with Kali Linux. If you have any other Linux just follow my steps:
1. Download the Linux wrapper script and paste it into any text editor. Save it as apktool.
2. Download apktool-2 (find the newest here). Rename downloaded jar to apktool.jar.
3. Create a new directory and move both files (apktool.jar & apktool), and make sure both files are executable (chmod +x).
3. Move apktool directory to /usr/local/bin (root needed).
4. Try running apktool via cli.
If you are a Kali Linux user no need to worry just go to Application > Reverse Engineering > Apktool.
Usage of Apktool
Use debug mode (d) to decode the given apk file (/Desktop/test.apk):
It will create a new directory on your desktop.
Using Apktool, you inject malicious code inside this application and many more. You learn them in my upcoming article, so stay connected with us.
Use build mode (b) to build the apk again (/Desktop/test):