ASC

MG1937Apache-2.0活跃维护

轻量级 Android 反编译器,专为 Agent 和移动安全研究场景设计,能快速把 DEX 还原成 Java 代码,适合批量逆向分析。

ASC is a super FAST and lightweight Android decompiler designed for Agents/Mobile Researchers.

dev-0.1.2-post4发布于 2026-10-30 03:26 UTC2,680star +12 / 7 天383fork同步于 2026-11-10 11:43 UTC

怎么上手

由 README 提炼,执行前请确认
pip install droidasc
droidasc getclass app.apk Lcom/poc/Main; -o Main.java
硬件要求按 README 说明

README 未说明 GPU 或显存要求;基准测试在 10 线程下运行,最大 352MB APK 的 CLI 内存占用为 141MB,可在弱机器上并行分析多个 APK。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把 APK 当只读数据库按需查询的轻量 Android 反编译器,秒级完成搜索与反编译

轻量级 Android 反编译器,专为 Agent 和移动安全研究场景设计,能快速把 DEX 还原成 Java 代码,适合批量逆向分析。

核心能力

  • 直接探测 Deflate 位流,跳过全量解压
  • 用 O(1) 指令定位原语把字节码偏移映射回方法
  • 命中目标后仅在内存重建最小自洽 DEX 再反编译
  • 跨全部 DEX 搜索字符串/类型/方法/字段引用
  • 提供 getclass、disassemble、listclass、getmanifest、findrefs 子命令

容易踩的坑

disassemble 依赖 dadguard 重建 DEX 后反汇编;--method 必须给完整签名如 'run(I)V',只写方法名会被拒绝;README 称 Rust 版 rust_ASC 快 10 倍且支持完整 APK 反编译,只要二进制应改用 rust_ASC。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本dev-0.1.2-post4
  1. dev-0.1.2-post4最新正式版2026-10-30 · 2026-10-30 03:26 UTC

    v0.1.2-post4

    Fixed

    • findrefs returned wrong or missing matches on DEX files whose string data is not written in string_ids order. StringLocator assumed the string data items were laid out in index order and mapped a match through the offset of the following item, then subtracted one. The DEX format does not require that order, and layout passes such as dexlayout (used when repackaging system APKs) permute the items. As a result:

      • a reversed layout collapsed the search region to start > end, so every string was missed;
      • a partial permutation returned neighbouring indexes, producing false hits such as a getDeviceId query reporting Display.getDeviceProductInfo.

      Method and field lookups that resolve names through the same locator were affected too, not only findrefs string.

      The locator now takes the region from the smallest and largest string_data_off and resolves each match with a binary search over the physical offsets, returning the index of the item that actually holds the match. This matches the rust_ASC implementation and makes no assumption about item order.

    • getclass slowdown introduced by smali formatting. Method descriptor normalization moved out of the decompiler hot path and into the smali formatter only, removing repeated string rewriting on every invoke.

    Performance

    Measured against the previous baseline on the same workload:

    MetricChange
    unit/string_locator-32.5%
    unit/type_locator-56.1%
    unit/field_locator-11.2%
    unit/method_locator-9.3%
    unit/field_locator_fuzzy_class_only-40.5%
    unit/field_locator_fuzzy_class_field-18.8%

    No gated metric regressed. The new lookup costs one bisect plus one dict hit per match; it needs no terminator scan, which matters on DEX files that embed multi-hundred-kilobyte string payloads (a backwards \x00 scan across such an item was measured ~5x slower on Windows, where memrchr is unavailable).

    Tests

    • Added coverage for the ordered layout, a full reversal, and a middle permutation, plus findrefs output equality across layouts.
    • Full suite: 146 tests pass.

    Upgrade

    No API changes. droidasc is on PyPI; pip install -U droidasc.

  2. dev-0.1.2-post32026-10-21 · 2026-10-21 09:18 UTC
    查看更新说明

    Summary

    This update improves Python ASC's smali disassembly quality, fixes missing method parameters in code-less methods, and reduces class lookup latency through prefix-only DEX inflation.

    Python and Rust implementations will continue to be maintained in parallel so users can choose the integration style that fits their workflow.

    Key Changes

    Smali disassembly

    • Added complete smali rendering for:
      • .class, .super, .implements
      • fields and annotations
      • methods and .locals
      • branch labels
      • try/catch blocks
      • optional .line and local-variable debug directives
    • Added --debuginfo to enable DEX debug metadata output.
    • Added --method 'run(I)V' to render one exact method by full signature.
    • Fixed smali syntax:
      • field references now use ->field:Type
      • invoke instructions now use {v0, v1}
      • range invokes now use {v0 .. v3}
      • method descriptors no longer contain invalid spaces
    • Fixed abstract/native methods whose parameter list was incorrectly rendered as empty when no code_item existed.

    DEX rebuild correctness

    • Fixed rebuilt code_item.debug_info_off so debug metadata remains addressable after DEX reconstruction.
    • Added fallback handling for stored entries, malformed prefixes, and DEX 041 containers.

    Prefix-only DEX inflation

    Class lookup now:

    1. Inflates only the DEX prefix needed to inspect string_ids, type_ids, class_defs, and the target descriptor.
    2. Rejects unrelated DEX files without full inflation.
    3. Fully inflates only the candidate DEX that contains the requested class.
    4. Falls back to the original full-inflate path when prefix parsing is unsafe.

    Performance

    Measured on:

    • Same command and workload before/after the prefix-inflate change
    MetricBeforeAfterImprovement
    APK class lookup median727 ms307 ms-57.8%
    Internal total median769 ms342 ms-55.6%
    Wall-clock median1007 ms523 ms-48.0%

    The previous cli_getclass regression was also traced to method descriptor normalization in the decompiler hot path. Descriptor normalization is now performed only by the smali formatter, avoiding repeated string processing during decompilation.

    Validation

    • Full test suite: 139 tests passed.
    • Prefix inflate tests cover:
      • deflated DEX entries
      • stored DEX entries
      • partial prefix parsing
      • full-inflate fallback
    • Disassembly tests cover:
      • annotations
      • debug info
      • fields
      • invoke/range invoke syntax
      • exact method filtering
      • try/catch and branch labels

    Release

    • Python package version: 0.1.2-post3
    • Target branch: dev-0.1.0
    • Latest commit: b9cba55
  3. dev-0.1.2-post22026-10-14 · 2026-10-14 14:41 UTC
    查看更新说明
    1. Refactor the asc client to enhance code robustness and break up the god class.
    2. Add support for finding extends and implements to findrefs.
    3. Enhance the GUI capabilities to support holding Ctrl and clicking an element to navigate to a method/field, and pressing x on a method name/field to find references.
    4. Update the benchmark.
  4. dev-0.1.1-post42026-10-10 · 2026-10-10 04:16 UTC
    查看更新说明
    1. Remove the androguard dependency and extract the dad engine to reduce the package size and the performance overhead caused by dummy classes.
    2. Adopt axml.
  5. dev-0.1.1-post22026-09-21 · 2026-09-21 05:24 UTC
    查看更新说明
    1. Optimized code scan item speed using byte.translate, improving it by ~30%
    2. Fixed the static field offset issue
    3. Enhanced the GUI xrefs feature to support finding references to methods/fields by x, as well as long-pressing Ctrl to jump to the next method/field
    4. Added the getmanifest/listclass subcommands

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Droid ASC: R8 Compiler Optimization as a DeCompiler Primitive

    Rust version: This project has been rewritten 1:1 in Rust as rust_ASC. The Rust version is 10× faster and supports full APK decompilation: with 16 threads, it decompiles a 383 MB APK in just 4 seconds.

    If your workflow is written in Python, you can continue integrating with this project; it remains the fastest Python Android decompiler available. If you only need a binary, please use rust_ASC.

    ASC and rust_ASC will be maintained in parallel, so users can choose the integration style that best fits their workflow.

    https://blackhat.com/europe/arsenal/schedule/index.html#droid-asc-r8-compiler-optimization-as-a-decompiler-primitive-54834

    When decompiling massive Android APKs, the standard procedure is to wait. We wait for tools to eat gigabytes of RAM, fully inflate the artifacts, and spend tens of minutes building heavy global indexes and cross references... All of this is just to guarantee fast code searches later, but here is the contradiction. A compiled artifact is already highly structured, modern decompilers never utilize this, they waste massive amounts of time and memory reconstructing a bloated database of code relationships over already structured data. This engineering approach defies common sense. When I can directly extract any code relationship from the APK in milliseconds, does this preprocessing still hold any value?

    Instead of forcing decompilers into heavy preprocessing, we choose to query the compiled artifact directly as a database. We built a stateless, zero-overhead engine that extracts and searches code on demand in milliseconds. In this briefing, we will explore the underlying engineering required to bypass traditional bottlenecks. We will demonstrate how to abandon full inflate by probing directly within the Deflate bitstream, building dense Huffman lookup tables to extract core metadata without touching irrelevant data blocks. Furthermore, we will explain optimization details of the R8 compiler, especially how deterministic constant relocation and instruction deduplication leave behind highly concentrated physical layouts, we weaponize this compiler behavior to execute lightning-fast cross DEX code searches. To map these raw bytecode offsets back to methods, we engineered an O(1) instruction locating primitive, achieving constant-time method resolution without building heavy mapping tables. Finally, upon hitting a target, Droid ASC extracts only the specific bytecodes and its dependencies, dynamically reconstructing a minimal and self consistent DEX entirely in memory for instant decompilation.

    We will demonstrate this architecture live against a 352MB commercial APK. Droid ASC executes global cross reference searches in 1.79 seconds and decompiles target classes in 177 milliseconds using only 141MB of RAM. By treating the artifact as a read only database and operating with zero preprocessing, we return the decompiler to its core essence. It is no longer a bloated indexing tool, but a lightning fast, on demand decompilation engine that fundamentally redefines how we analyze compiled code.

    Benchmark

    Benchmark

    https://github.com/user-attachments/assets/4c4a6813-8561-490c-a573-ef113da861b6

    Raw absolute values, measured with 10 threads across four APK targets of increasing size:

    Global string xref search

    ToolTelegramX (59MB)WhatsApp (130MB)Grab (228MB)Lark (352MB)
    ASC322ms418ms806ms1.597s
    JADX20s32s2m14s8m2s

    ASC is 62x to 302x faster than JADX for global string xref search.

    Single-class decompile

    ToolTelegramX (59MB)WhatsApp (130MB)Grab (228MB)Lark (352MB)
    ASC157ms141ms165ms303ms
    JADX6s15s37s1m32s

    ASC is 38x to 304x faster than JADX for single-class decompile.

    CLI memory usage

    ToolTelegramX (59MB)WhatsApp (130MB)Grab (228MB)Lark (352MB)
    ASC36MB36MB58MB141MB
    JADX1,016MB2.1GB7.1GB13.2GB

    ASC uses 28x to 125x less memory than JADX for CLI operation.

    Disk cache usage

    ToolTelegramX (59MB)WhatsApp (130MB)Grab (228MB)Lark (352MB)
    ASC0MB0MB0MB0MB
    JADX119MB30MB127MB322MB

    ASC stays fully in memory with zero disk cache, while JADX writes up to 322MB.

    Note: JADX runs out of memory on the largest target (Lark) during the global search (~49% searched), while ASC completes every target.

    As the benchmark shows, ASC is 62x faster than JADX on ~50MB APKs, and 302x faster on ~300MB APKs, with a tiny memory footprint. Agents can pair with ASC to analyze dozens or even hundreds of APKs at once, even on weak machines. The JADX MCP has a harder time here: JADX alone uses several GB just to preload, which makes switching between hundreds of APKs impractical.

    Install

    # from PyPI
    pip install droidasc
    
    # or from source
    pip install .
    

    After installation, the droidasc CLI command is available globally:

    usage: droidasc [-h] {getclass,disassemble,listclass,getmanifest,findrefs} ...
    
    ASC tooling entry (v0.1.2.post1).
    
    positional arguments:
      {getclass,disassemble,listclass,getmanifest,findrefs}
        getclass            Locate the target class in APK, extract one DEX in
                            memory, then decompile.
        disassemble         Extract a class, rebuild a small DEX, then disassemble
                            it with dadguard.
        listclass           List classes across all DEX entries; use --prefix to
                            filter by package/class prefix.
        getmanifest         Decode AndroidManifest.xml from APK and print it as
                            XML.
        findrefs            Find code references for string/type/method/field
                            across all DEX entries in APK.
    
    options:
      -h, --help            show this help message and exit
    
    examples:
      droidasc app.apk --gui
      droidasc getclass app.apk Lcom/poc/Main; -o Main.java
      droidasc getclass app.apk com.poc.Main --threads 16
      droidasc disassemble app.apk Lcom/poc/Main; -o Main.smali
      droidasc disassemble app.apk com.poc.Main --debug
      droidasc disassemble app.apk com.poc.Main --debuginfo
      droidasc disassemble app.apk com.poc.Main --method 'run(I)V'
      droidasc listclass app.apk
      droidasc listclass app.apk -o classes.txt
      droidasc listclass app.apk --prefix com.poc
      droidasc getmanifest app.apk
      droidasc getmanifest app.apk -o AndroidManifest.xml
      droidasc findrefs app.apk string token -o string_refs.txt
      droidasc findrefs app.apk type com.poc.Main
      droidasc findrefs app.apk method onCreate --class com.poc.Main
      droidasc findrefs app.apk method notify --class MainActivity --fuzzy-class -o method_refs.txt
      droidasc findrefs app.apk field apiKey -o field_refs.txt
      droidasc findrefs app.apk extends java.lang.Object
      droidasc findrefs app.apk extends android.app.Activity -o subclasses.txt
      droidasc findrefs app.apk impl android.os.IInterface -o impls.txt
    

    -V/--version prints the installed package version.

    findrefs searches for code references (string/type/method/field) across all DEX entries; -o writes results to the selected file instead of stdout, and --threads N controls the worker pool. extends/impl locate classes that extend a target class or implement a target interface, respectively.

    listclass prints Dalvik class descriptors in APK/DEX definition order, one per line. With -o, output is written to the selected file instead of stdout. --prefix com.poc filters by Lcom/poc; an already normalized prefix such as Lcom/poc is kept unchanged.

    disassemble accepts the same dotted or Dalvik class formats as getclass. It extracts the target class from the APK, rebuilds a small DEX in memory, and disassembles the rebuilt DEX with dadguard. --debug enables timing output and instruction offset comments; --debuginfo enables DEX .line and local variable directives. --method 'run(I)V' restricts output to one exact method signature; a bare method name is rejected. All commands that support -o write to stdout when -o is omitted.

    You can also use python main.py as before — it delegates to the same entry point.

    Sponsors

    SponsorAmount
    HTTChina5000¥
    c01ns11.9¥
    gguowang AND cococount2¥
    Ylarod50.11¥

    Thank you to all sponsors for your support!

    ASC is built with the hope that it can genuinely help everyone improve their reverse engineering workflow — from speeding up the tedious parts to making the impossible feel routine.

    Acknowledgements

    Thanks to the Androguard project for providing the Android reverse-engineering and DEX analysis foundation used by Droid ASC.