Skip to content

dev-0.1.2-post3

Choose a tag to compare

@MG1937 MG1937 released this 21 Oct 09:18
· 5 commits to main since this release
9216fe2

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
Metric Before After Improvement
APK class lookup median 727 ms 307 ms -57.8%
Internal total median 769 ms 342 ms -55.6%
Wall-clock median 1007 ms 523 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