APKnife β The Double-Edged Blade of APK Analysis πͺ
Fear the Blade, Trust the Power!
APKnife is an advanced tool for APK analysis, modification, and security auditing. Whether you're a security researcher, penetration tester, or Android developer, APKnife provides powerful features for reverse engineering, decompiling, modifying, and analyzing APK files.
- β Extract & decompile APKs into readable formats
- β Modify & repackage APKs effortlessly
- β Analyze APKs for security vulnerabilities
- β Edit AndroidManifest.xml & Smali code
- β Extract Java source code from an APK
- β Detect Remote Access Trojans (RATs) & malware
- β Decode binary XML files & scan for API calls
- β Change APK metadata (icon, name, package name)
- β Identify security risks like excessive permissions
- β Sign APKs for smooth installation
Ensure you have the following installed on your system:
- Python 3.12
- Java (JDK 8 or later)
- apktool
- zipalign
- keytool
Before installing APKnife, it's recommended to set up a Python virtual environment to avoid package conflicts.
1οΈβ£ Create a Python Virtual Environment:
python3 -m venv venv
source venv/bin/activate # On Linux/macOS
venv\Scripts\activate # On Windows
2οΈβ£ Install Required Packages
Once the virtual environment is activated, install APKnife:
pip install apknife
APKnife requires Rust for building. Follow the installation steps based on your OS:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Then follow the on-screen instructions.
brew install rust
- Visit rustup.rs and install Rust.
- Verify installation:
rustc --version
Ensure Termux is up to date:
pkg update && pkg upgrade
Install required build tools:
pkg install clang make python rust
- Rust not installed properly? Ensure it's correctly installed via rustup or your package manager.
- Python conflicts? If there are issues with virtual environments, reset it:
rm -rf venv
python3 -m venv venv
source venv/bin/activate
python --version
rustc --version
nano ~/.bashrc # For bash
nano ~/.zshrc # For zsh
Add this line at the end:
export PATH="$HOME/.cargo/bin:$PATH"
Apply changes:
source ~/.bashrc # For bash
source ~/.zshrc # For zsh
- Open "Environment Variables" from the Start menu.
- Edit Path under System Variables and add:
C:\Users\<YourUsername>\.cargo\bin
- Click OK and restart your terminal.
Verify the setup:
cargo --version
rustc --version
pip install apknife
To enter interactive mode, run:
python3 apknife.py interactive
This will launch a command-line interface for executing APKnife commands.
python3 apknife.py extract -i target.apk -o extracted/
python3 apknife.py build -i extracted/ -o modified.apk
apknife sign -i modified.apk
apknife scan_vulnerabilities -i target.apk
apknife catch_rat -i malicious.apk
apknife extract-java -i target.apk -o src_folder
apknife modify-apk --name -i app.apk
apknife modify-apk --icon new_icon.png -i app.apk
apknife modify-apk --package com.example.example -i app.apk
apknife modify-apk --name new_name --package new.package.name --icon anysize.any -o modified_apk.apk
apknife scan_permissions -i target.apk
Extract the contents of an APK file.
python3 apknife.py extract -i target.apk -o extracted/
-i
: Path to the input APK file.-o
: Directory to save the extracted files.
Rebuild an APK from extracted files.
python3 apknife.py build -i extracted/ -o modified.apk
-i
: Directory containing the extracted files.-o
: Path to save the rebuilt APK.
Sign an APK file.
apknife sign -i modified.apk
-i
: Path to the APK file to sign.
Analyze an APK for security vulnerabilities.
apknife analyze -i target.apk
-i
: Path to the APK file to analyze.
Edit the AndroidManifest.xml
of an APK.
apknife edit-manifest -i target.apk
-i
: Path to the APK file.
Decompile an APK to Smali code.
apknife smali -i target.apk -o smali_output/
-i
: Path to the APK file.-o
: Directory to save the decompiled Smali code.
Decode the AndroidManifest.xml
of an APK.
apknife decode_manifest -i target.apk -o output_dir/
-i
: Path to the APK file.-o
: Directory to save the decoded manifest.
Find onCreate
methods in an APK.
apknife find-oncreate -i target.apk
-i
: Path to the APK file.
Find API calls in an APK.
apknife find-api -i target.apk
-i
: Path to the APK file.
Scan an APK for vulnerabilities.
apknife scan-vulnerabilities -i target.apk
-i
: Path to the APK file.
Scan and list permissions used by an APK.
apknife scan-permissions -i target.apk
-i
: Path to the APK file.
Analyze an APK for Remote Access Trojan (RAT) indicators.
apknife catch_rat -i malicious.apk
-i
: Path to the APK file.
Extract Java source code from an APK.
apknife extract-java -i target.apk -o src_folder/
-i
: Path to the APK file.-o
: Directory to save the extracted Java source code.
Extract sensitive data from an APK.
apknife extract-sensitive -i target.apk -o sensitive_data.json
-i
: Path to the APK file.-o
: Path to save the extracted sensitive data (JSON format).
Modify an APK's metadata (name, icon, package name).
apknife modify-apk -i target.apk --name "New App Name" --icon new_icon.png --package com.new.package
-i
: Path to the APK file.--name
: New app name.--icon
: Path to the new icon (any size/format).--package
: New package name.
Extract DEX files from an APK.
apknife extract-dex -i target.apk -o dex_output/
-i
: Path to the APK file.-o
: Directory to save the extracted DEX files.
Scan an APK for protection mechanisms (e.g., Firewall, ProGuard).
apknife waf -i target.apk
-i
: Path to the APK file.
Launch APKnife in interactive mode.
python3 apknife.py interactive
Display the help menu with all available commands.
apknife -h
Reload the commands from the external file.
apknife update-commands
Display the current list of available commands.
apknife list-commands
Exit the interactive shell.
exit
This tool is designed for educational and security research purposes only. Unauthorized use of APKnife on third-party applications without permission is illegal. The developers are not responsible for any misuse.
APKnife is released under the MIT License β You are free to modify and distribute it for legal use.
π Contributions are welcome! Fork the repo, submit pull requests, and report issues. Let's make APKnife even better!
APKnife β The Double-Edged Blade of APK Analysis πͺπ§Έ
All rights reserved to MR_nightmare.