MCPcopy Index your code
hub / github.com/delvinru/apk-info

github.com/delvinru/apk-info @v1.0.11

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.11 ↗ · + Follow
361 symbols 632 edges 42 files 43 documented · 12% updated 28d agov1.0.11 · 2026-02-25★ 1321 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

apk-info

Crates.io Version docs.rs PyPI - Version

A full-featured apk parser.

Features

  • A malware-friendly zip extractor. Great article about BadPack technique;
  • 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

cargo install apk-info-cli

Help

A command-line tool to inspect and extract APK files

Usage: apk-info [COMMAND]

Commands:
  show        Show basic information about apk file
  extract     Unpack apk files as zip archive [aliases: x]
  axml        Read and pretty-print binary AndroidManifest.xml
  completion  Generate shell completion
  help        Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Python

Installation

uv pip install apk-info

Get basic information about APK

from apk_info import APK

apk = APK("./path-to-file.apk")
package_name = apk.get_package_name()
main_activities = apk.get_main_activities()
min_sdk = apk.get_min_sdk_version()

print(f"Package Name: {package_name}")
print(f"Minimal SDK: {min_sdk}")

if not main_activities:
    print("apk is not launchable!")
    exit()

print(f"Main Activity: {package_name}/{main_activities[0]}")

Get information about signatures

import sys

from apk_info import APK, Signature

if len(sys.argv) < 2:
    print(f"usage: {sys.argv[0]} <apk>")
    sys.exit(1)

file = sys.argv[1]
apk = APK(file)

signatures = apk.get_signatures()
for signature in signatures:
    match signature:
        case Signature.V1() | Signature.V2() | Signature.V3() | Signature.V31():
            for cert in signature.certificates:
                print(f"{cert.subject=} {cert.issuer=} {cert.valid_from=} {cert.valid_until=}")
        case Signature.ApkChannelBlock():
            print(f"got apk channel block: {signature.value}")
        case _:
            print(f"oh, cool, library added some new feature - {signature}")

Performance Analysis

Environment:

  • OS: macOS Tahoe 26.0.1 arm64
  • CPU: Apple M3 Pro (12) @ 4.06 GHz

The script:

  1. Extract all available signatures from a file;
  2. Extract the package name;
  3. Extract the minimum sdk version;
  4. Get a list of all Main Activities;
  5. 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):

  • 3084 apk files;
  • Total size - 23GB;
  • Logging mode - warning;

[!IMPORTANT] There are a lot of malicious samples in this set that androguard simply cannot parse.

# apk-info androguard
1 2.49s user 4.74s system 73% cpu 9.840 total 141.29s user 6.86s system 98% cpu 2:31.09 total
2 2.50s user 4.77s system 75% cpu 9.641 total 138.04s user 6.32s system 97% cpu 2:27.33 total
3 2.49s user 4.78s system 75% cpu 9.650 total 139.33s user 6.65s system 98% cpu 2:28.87 total

On average, the speed gain is about x10.

The main advantage is that apk-info can parse many more malicious files than androguard.

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.

Credits

Extension points exported contracts — how you extend this code

XmlParse (Interface)
(no doc) [4 implementers]
crates/axml/src/structs/xml_elements.rs

Core symbols most depended-on inside this repo

attr
called by 65
crates/xml/src/lib.rs
to_string
called by 42
crates/axml/src/structs/common.rs
get
called by 31
crates/axml/src/structs/res_string_pool.rs
get_attribute_value
called by 24
core/src/apk.rs
name
called by 16
crates/axml/src/structs/resource_table.rs
name
called by 12
crates/xml/src/lib.rs
childrens
called by 9
crates/xml/src/lib.rs
read
called by 7
core/src/apk.rs

Shape

Method 213
Class 63
Function 54
Enum 30
Interface 1

Languages

Rust100%
Python1%

Modules by API surface

python/src/lib.rs67 symbols
core/src/apk.rs55 symbols
crates/axml/src/structs/res_table_config.rs44 symbols
crates/axml/src/structs/resource_table.rs32 symbols
crates/xml/src/lib.rs17 symbols
crates/zip/src/entry.rs16 symbols
crates/zip/src/structs/eocd.rs13 symbols
crates/axml/src/structs/xml_elements.rs11 symbols
crates/axml/src/structs/common.rs11 symbols
crates/zip/src/structs/central_directory.rs10 symbols
crates/axml/src/structs/res_string_pool.rs10 symbols
crates/zip/src/structs/local_file_header.rs9 symbols

For agents

$ claude mcp add apk-info \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page