Skip to main content

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.

Project description

APKnife: The Cyber Blade of APK Domination ๐Ÿ”ช๐Ÿงธ

APKnife Cover

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.


๐Ÿš€ Features & Capabilities

  • โœ… 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

๐Ÿ”ง Installation

๐Ÿ“Œ Prerequisites

Ensure you have the following installed on your system:

  • Python 3.12
  • Java (JDK 8 or later)
  • apktool
  • zipalign
  • keytool

๐Ÿ›  Setting Up a Python Virtual Environment

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

๐Ÿ“ฅ Installing Rust (Required for APKnife)

APKnife requires Rust for building. Follow the installation steps based on your OS:

๐Ÿง On Linux:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then follow the on-screen instructions.

๐Ÿ On macOS (Using Homebrew):

brew install rust

๐Ÿ–ฅ๏ธ On Windows:

  1. Visit rustup.rs and install Rust.
  2. Verify installation:
rustc --version

โš ๏ธ Troubleshooting Common Issues

โŒ Issue Installing Rust on Termux

Ensure Termux is up to date:

pkg update && pkg upgrade

Install required build tools:

pkg install clang make python rust

โŒ Issues Installing APKnife

  • 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

โœ… Verifying Installed Versions

python --version
rustc --version

๐ŸŒ Setting Up Rust Environment Variables

๐Ÿง On Linux/macOS

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

๐Ÿ–ฅ๏ธ On Windows

  1. Open "Environment Variables" from the Start menu.
  2. Edit Path under System Variables and add:
C:\Users\<YourUsername>\.cargo\bin
  1. Click OK and restart your terminal.

Verify the setup:

cargo --version
rustc --version

๐Ÿ“ฅ Installing APKnife

pip install apknife

๐Ÿ“œ Usage

๐Ÿ–ฅ๏ธ Interactive Mode

To enter interactive mode, run:

python3 apknife.py interactive

This will launch a command-line interface for executing APKnife commands.


๐Ÿ› ๏ธ Available Commands

๐ŸŸข Extract APK Contents

python3 apknife.py extract -i target.apk -o extracted/

๐ŸŸข Modify & Rebuild APK

python3 apknife.py build -i extracted/ -o modified.apk

๐ŸŸข Sign APK

apknife sign -i modified.apk

๐ŸŸข Analyze APK for Vulnerabilities

apknife scan_vulnerabilities -i target.apk

๐ŸŸข Detect Remote Access Trojans (RATs)

apknife catch_rat -i malicious.apk

๐ŸŸข Extract Java Source Code

apknife extract-java -i target.apk -o src_folder

๐ŸŸข Change APK Name

apknife modify-apk --name -i app.apk

๐ŸŸข Change APK Icon

apknife modify-apk --icon new_icon.png -i app.apk

๐ŸŸข Modify Package Name

apknife modify-apk --package com.example.example -i app.apk

๐ŸŸข Modify Multiple APK Attributes

apknife modify-apk --name new_name --package new.package.name --icon anysize.any -o modified_apk.apk

๐ŸŸข Scan APK Permissions

apknife scan_permissions -i target.apk

๐Ÿ‘‡ Help Menu

๐ŸŸข Extract APK Contents

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.

๐ŸŸข Build APK

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 APK

Sign an APK file.

apknife sign -i modified.apk
  • -i: Path to the APK file to sign.

๐ŸŸข Analyze APK

Analyze an APK for security vulnerabilities.

apknife analyze -i target.apk
  • -i: Path to the APK file to analyze.

๐ŸŸข Edit Manifest

Edit the AndroidManifest.xml of an APK.

apknife edit-manifest -i target.apk
  • -i: Path to the APK file.

๐ŸŸข Decompile to Smali

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 Manifest

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

Find onCreate methods in an APK.

apknife find-oncreate -i target.apk
  • -i: Path to the APK file.

๐ŸŸข Find API Calls

Find API calls in an APK.

apknife find-api -i target.apk
  • -i: Path to the APK file.

๐ŸŸข Scan for Vulnerabilities

Scan an APK for vulnerabilities.

apknife scan-vulnerabilities -i target.apk
  • -i: Path to the APK file.

๐ŸŸข Scan Permissions

Scan and list permissions used by an APK.

apknife scan-permissions -i target.apk
  • -i: Path to the APK file.

๐ŸŸข Catch RAT

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

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

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 APK Metadata

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

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 for Protection Mechanisms

Scan an APK for protection mechanisms (e.g., Firewall, ProGuard).

apknife waf -i target.apk
  • -i: Path to the APK file.

๐ŸŸข Interactive Mode

Launch APKnife in interactive mode.

python3 apknife.py interactive

๐ŸŸข Help Menu

Display the help menu with all available commands.

apknife -h

๐ŸŸข Update Commands

Reload the commands from the external file.

apknife update-commands

๐ŸŸข List Commands

Display the current list of available commands.

apknife list-commands

๐ŸŸข Exit Interactive Mode

Exit the interactive shell.

exit

โš ๏ธ Legal Disclaimer

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.


๐Ÿ“œ License

APKnife is released under the MIT License โ€“ You are free to modify and distribute it for legal use.


๐Ÿ’ก Contributions & Support

๐Ÿš€ 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apknife-1.1.10.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apknife-1.1.10-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file apknife-1.1.10.tar.gz.

File metadata

  • Download URL: apknife-1.1.10.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for apknife-1.1.10.tar.gz
Algorithm Hash digest
SHA256 cde38f25fb569974e7e93e0c51f77f386aba4d8b34f12b77337afef91100dcbd
MD5 98f932ca60dd7f881bf5b723a9f0db06
BLAKE2b-256 d5a01c477c1c7587faace10f07694dee1aa5b8a106534c99c211658fff07751f

See more details on using hashes here.

File details

Details for the file apknife-1.1.10-py3-none-any.whl.

File metadata

  • Download URL: apknife-1.1.10-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for apknife-1.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 d6a36380fcc38591619ef539605cb22d244a95a495492c65fe5039733a733b69
MD5 5c89dd3465bb4e68749712af49c2d520
BLAKE2b-256 86bafbc3b2f161e68cdc94e56557251372065957cf36940f13614106285b3df6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page