apk-info
A full-featured apk parser.
Features
- A malware-friendly zip extractor. Great article about
BadPacktechnique; - A malware-friendly axml and arsc extractor;
- A full AXML (Android Binary XML) implementation;
- A full ARSC (Android Resource) implementation;
- Support for extracting information contained in the
APK Signature Block 42:- APK Signature scheme v1;
- APK Signature scheme v2;
- APK Signature scheme v3;
- APK Signature scheme v3.1;
- Stamp Block v1 & v2;
- Apk Channel Block;
- Packer NG v2;
- Vasdolly v2
- Google Play Frosting (there are plans, but there is critically little information about it);
- Correct extraction of the MainActivity based on how the Android OS does it;
- Bindings for python 3.10+ with typings - no more
# type: ignore; - And of course just a fast parser - 🙃
Getting started
cli
Installation
Help
)
Python
Installation
Get basic information about APK
=
=
=
=
Get information about signatures
=
=
=
:
| | | :
:
:
# For `xapk`/`apkm` containers, `get_container_signatures()` returns the
# distributor's signature on the outer archive, separate from the app.
=
Performance Analysis
Environment:
- OS: macOS Tahoe 26.6.1 arm64
- CPU: Apple M3 Pro (12) @ 4.06 GHz
The script:
- Extract all available signatures from a file;
- Extract the package name;
- Extract the minimum sdk version;
- Get a list of all Main Activities;
- Get the application name;
apk-info library:
- Build -
release-lto; - Python bindings (honest comparison);
test case (clean collection):
- 152 apk files;
- Total size - 20GB;
- Logging mode - warning;
| # | apk-info | androguard |
|---|---|---|
| 1 | 0.98s user 4.32s system 80% cpu 6.584 total | 57.39s user 4.88s system 97% cpu 1:03.85 total |
| 2 | 0.96s user 4.23s system 79% cpu 6.486 total | 57.98s user 5.04s system 97% cpu 1:04.80 total |
| 3 | 0.95s user 4.15s system 79% cpu 6.422 total | 55.56s user 4.48s system 97% cpu 1:01.55 total |
test case (malware collection):
- 13374 apk files (from the VirusShare Android APK collection);
- Total size - 68GB;
- Logging mode - warning;
[!NOTE] The collection has 14026 downloaded samples. 652 of them are completely broken (not valid ZIP/APK archives) and rejected by both tools, so they are excluded from the benchmark — leaving 13374.
| # | apk-info | androguard |
|---|---|---|
| 1 | 5.15s user 12.53s system 66% cpu 26.990 total | 152.85s user 15.56s system 95% cpu 2:58.01 total |
| 2 | 5.41s user 13.08s system 69% cpu 27.010 total | 151.84s user 15.08s system 95% cpu 2:56.74 total |
| 3 | 5.25s user 12.76s system 68% cpu 26.610 total | 152.26s user 15.26s system 95% cpu 2:57.20 total |
On average, the speed gain is about x6.6 on this corpus.
FAQ
- Why not just use androguard?
Almost all of my projects are born from something that is inconvenient to use. Androguard is a great tool in itself, but it is simply not possible to maintain it (in my opinion) and it is not suitable for production-ready code. It is also not suitable for analyzing a large number of files due to the fact that all the logic is written in not very optimized way.
- I want to modify the apk, how do I do it using this library?
The library is designed for read-only mode only, because i need a good tool with which i can easily and quickly extract information from the apk. There are many other good tools out there.
- I repacked an apk, how do I sign it?
The repack command produces an unsigned apk. To re-sign it, we recommend uber-apk-signer — a simple one-command tool that signs with v1/v2/v3 and zipaligns in a single pass: