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.1.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.1-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apk_analyzer-1.10.1.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.1.tar.gz
Algorithm Hash digest
SHA256 375d9929823a0b5e2f78345c9b111e85109a1b87b8fe6ef9e4cbf4c1860cb789
MD5 2983a63cffc900219bd209e2fe143c5e
BLAKE2b-256 b075352b83f98ca6853227c244fc863c57877cb97baa4f246be7b4faeaec488f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apk_analyzer-1.10.1-py3-none-any.whl
  • Upload date:
  • Size: 41.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3dd40e249110af3054f96b179230e3ce07034f0db708ad117444546ba913c0ec
MD5 56020850d654358c8b4ea3a27779a217
BLAKE2b-256 4e86fa36d1e1cee71a5a22321130a33d0310fff628395b9f1bcfd0647792f915

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