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.5.0.tar.gz (24.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.5.0-py3-none-any.whl (38.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apk_analyzer-1.5.0.tar.gz
  • Upload date:
  • Size: 24.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.5.0.tar.gz
Algorithm Hash digest
SHA256 4ccdcded7c6c43c7530bc7884f85cceab4be9cc18ccc50f50c8df187ed668efa
MD5 ff657807f0b55c606b53a171b7b306d2
BLAKE2b-256 bc3dd7f06094f097a99cfa62bc188fe8d74bfcdebc13574580bab80e576aacdb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apk_analyzer-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 38.0 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac91b7d7ce79afb8d1f06b6775ccc246e0546799f511798ee6fe4821bb051db8
MD5 160f12ea6439f673efa43568c0c289c7
BLAKE2b-256 a215c41b5a200a5e430b4eb232c275f547b8d743f942b20d2469f853e11f9095

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