Skip to main content

Static SDK detection for Android APK files — 5-layer analysis engine

Project description

APK SDK Analyzer

Static third-party SDK detection tool for Android APK files.

PyPI Python License: MIT

Features

  • Zero-dependency on decompilers — pure Python static analysis
  • 5-layer detection engine: DEX class names · AndroidManifest components · Native .so libs · META-INF version files · DEX BuildConfig static fields
  • Structured output: JSON + interactive single-file HTML report
  • Extensible signature database: YAML files in sdk_signatures/ — update without recompiling
  • Cross-platform: Windows / macOS / Linux

Installation

Using pip:

pip install apk-analyzer

Using uv (recommended):

# As a project dependency
uv add apk-analyzer

# As a standalone CLI tool
uv tool install apk-analyzer

Usage

# Basic analysis — generates <apk>_report.json and <apk>_report.html
apk-analyzer target.apk

# Analyze specific categories only
apk-analyzer target.apk --categories push,ads,analytics

# Custom output paths
apk-analyzer target.apk --output-json report.json --output-html report.html

# JSON output only
apk-analyzer target.apk --format json

# Verbose mode
apk-analyzer target.apk --verbose

# Use a custom signatures directory
apk-analyzer target.apk --signatures-dir ./my_signatures

Output

Two files are generated next to the APK by default:

File Description
<apk>_report.json Structured data — suitable for scripting and CI integration
<apk>_report.html Interactive single-file report — open in any browser

Detection Methods

Layer Method Coverage
L1 DEX class name prefix matching ~90% of SDKs
L2 AndroidManifest service/receiver/activity Confirms presence
L3 Native .so library names Native SDKs
L4 META-INF .version files AndroidX / Google libs
L5 DEX BuildConfig.VERSION_NAME static fields Exact versions

Output JSON Structure

{
  "meta": { "tool_version": "1.5.0", "analysis_time": "...", "analysis_duration_seconds": 0.33 },
  "apk_info": { "package_name": "com.example.app", "version_name": "1.2.3", "min_sdk": 21, ... },
  "detected_sdks": [
    {
      "id": "xiaomi_mipush",
      "name": "小米推送 MiPush",
      "version": "5.9.6",
      "confidence": "high",
      "detection_evidence": { "matched_packages": ["com.xiaomi.push"], ... },
      "risk": { "privacy_risk": "low" }
    }
  ],
  "summary": { "total_detected": 12, "by_category": { "push": 3, "ads": 2 } }
}

SDK Signature Format

Add signatures by dropping a YAML file into sdk_signatures/<category>/. No code changes required.

id: xiaomi_mipush
name: 小米推送 MiPush
category: push
vendor: Xiaomi
description: "小米厂商推送通道"

detection:
  package_prefixes:
    - "com.xiaomi.push"
  native_libs:
    - "libmipush.so"
  manifest_services:
    - "com.xiaomi.push.service.XMPushService"

version_extraction:
  buildconfig:
    class_pattern: "com.xiaomi.push.BuildConfig"
    field: "VERSION_NAME"

risk:
  privacy_risk: low   # low / medium / high
  notes: "..."

Build from Source

git clone https://github.com/1PersonLtd/apk-analyzer.git
cd apk-analyzer
uv sync
uv run apk-analyzer target.apk

Release Pipeline

PR merge (feature-* or fix-*)
   ↓ auto-tag.yml
Creates v1.y.z tag
   ↓ publish.yml
Publishes to PyPI → pip install apk-analyzer

License

MIT

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

apk_analyzer-1.10.0.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

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

apk_analyzer-1.10.0-py3-none-any.whl (41.4 kB view details)

Uploaded Python 3

File details

Details for the file apk_analyzer-1.10.0.tar.gz.

File metadata

  • Download URL: apk_analyzer-1.10.0.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for apk_analyzer-1.10.0.tar.gz
Algorithm Hash digest
SHA256 c0f34d72c0f2d3644928d966382f99eca68a3977d875b4b3bb1d42dcf814b22a
MD5 58031ca043d3dcc061593a8114edf78e
BLAKE2b-256 afcf442ce7b8fd2da262c4f1dd2dfda9e9bce8bb519316e6e088a494bcf43c46

See more details on using hashes here.

File details

Details for the file apk_analyzer-1.10.0-py3-none-any.whl.

File metadata

  • Download URL: apk_analyzer-1.10.0-py3-none-any.whl
  • Upload date:
  • Size: 41.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for apk_analyzer-1.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6486e8c3985cefd6225f0c2d811b8d1ee3c5a79206471481434015893b793a0
MD5 deaccb0e99016a4974a8b73b8040bcc4
BLAKE2b-256 45b503c185579317e90644edf884a36859b176156b5f084bd73e8dba5737ef46

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