Skip to content

Releases: GrandpaEJ/Agent-EJ

v0.9.0 — XML → ARSC compiler: decoded res/values reaches the rebuilt APK

Choose a tag to compare

@GrandpaEJ GrandpaEJ released this 28 Oct 15:23

[0.9.0] - 2026-10-27

Added

  • The decoded res/values tree is compiled back into resources.arsc — an edit made after decode_apk now reaches the rebuilt APK. decode_apk turned every resource value into a res/values XML file, but build_apk packed whatever resources.arsc was on disk, so those files were documentation only: change a string, rebuild, and the APK still had the old value. The new arsc_compile_xml() walks the values directories, patches the matching entries of the original table and re-encodes it, and build_apk runs it ahead of the pack step (apk_recompile_resources()); a table it cannot compile is left in place rather than failing the build.
  • arsc_compile tool — arsc=<table> res_dir=<res> out=<table> compiles a decoded tree without a build, reporting how many values changed and how many were left alone.

Fixed

  • Resource values are never silently dropped or corrupted while recompiling. Entries are patched in place and an entry whose value already equals what the text says is not touched at all, so decoding and recompiling an untouched tree reproduces the original table byte for byte — verified on 16 real APKs. Configuration resolution shares apk_build_config_str() with the decoder, so a value in values-land reaches the land entry and leaves the default one alone; the entry's own data type decides how its text is read, so a number-shaped string such as gcm_defaultSenderId stays a string instead of becoming an integer, colours keep their own type, and values with no text form (dimensions, fractions, dynamic references) are skipped rather than rewritten. Duplicate keys are matched in entry order — one test APK gives every entry of a type the same name, and mapping them all onto the first would have overwritten six of them.

Verification

7 test suites                 → 159 assertions, 0 failures
39 smali fixtures assemble    → 39 OK, 0 FAIL
baksmali on all outputs       → all OK
DEX invariants                → 0 failures
ASan/UBSan/LSan               → no report
cold build                    → 53 warnings (unchanged baseline)
byte-identity                 → 16/16 real APKs re-encode byte for byte

Artifacts

  • agent-x — 344,456 bytes, stripped static binary, x86_64-linux-musl.
  • SHA-256: 091612cc78d18b434a72784981d1a5e1acecee77f5bdd6492cf4e73e9164d30f

The binary is named agent-x because the project was renamed to Agent-EJ immediately after this release; builds from later commits are agent-ej.

v0.8.1 — 15× memory reduction for smali_assemble

Choose a tag to compare

@GrandpaEJ GrandpaEJ released this 24 Jun 05:27

[0.8.1] - 2026-06-24

Fixed

  • Memory bloat from inline annotation arrays (#25) — smali_*_def_t structs embedded smali_annotation_t annots[32] inline (99 KB per struct), so every class/method/field paid 99 KB even with 0 annotations. Converted to heap-allocated annots* with lazy grow. Added smali_ctx_free() for proper recursive cleanup at end of smali_assemble and smali_flow.

Impact (11330-class / 2.3 GB smali corpus)

Tool v0.8.0 v0.8.1 Reduction
smali_assemble peak RSS 7.5 GB 506 MB 15×
smali_flow method peak 445 MB 36 MB 12×
smali.jar (Java) baseline 1.55 GB 1.55 GB —

agent-x now uses 3× less RAM than smali.jar on the same corpus. Roundtrip integrity preserved (11330 → 11330 classes via baksmali).

Artifacts

  • agent-x — 295 KB stripped static binary, x86_64-linux-musl.
  • SHA-256: 3f1182e188d0c4a8482f3cc05fa3d2c3e6edd45a6085be340f77eaf1efd3dda5

v0.8.0 — smali_flow 3-mode upgrade

Choose a tag to compare

@GrandpaEJ GrandpaEJ released this 24 Jun 04:48

[0.8.0] - 2026-06-24

Added

  • smali_flow 3-mode upgrade (#24) — split into focused modules (smali_flow_block.c / smali_flow_edge.c / smali_flow_mermaid.c / smali_flow_class.c).
    • 3 modes: basic (control flow only), advance (default, all insns), full (all insns with source line numbers).
    • 3 scopes: method (per-method), class (this class → methods → callees), file (full cross-class call graph).
    • 6 color-coded Mermaid shapes: stadium entry, circle return, hexagon throw, asymmetric switch, diamond cond, rectangle normal.
    • Dashed edges for try/catch handlers with exception-type labels.
    • Explicit edge labels: false / case / goto / branch mnemonic.

Fixed (carried from Unreleased)

  • repack_apk no longer includes smali source files in ZIP (#19).
  • smali_assemble pool memory leak — frees all 5 pools, ~87 MB reclaimed (#21).
  • apk_analyze supports multidex (classes2.dex+) (#18).
  • apk_build cleans up compiled DEX files (#20).
  • smali_code guards abstract/native methods → code_off=0 (#23).

Artifacts

  • agent-x — 293 KB stripped static binary, x86_64-linux-musl.
  • SHA-256: 6bfe39e61f6248ec0339477f5599b3beeeded173f1a4c407535c9be74c2d66ce

Usage

```bash

single method, control-flow only

./agent-x tool smali_flow path=app/smali method=onCreate mode=basic scope=method

full class call graph

./agent-x tool smali_flow path=app/smali/MyClass.smali mode=advance scope=class

cross-class call graph for the whole APK

./agent-x tool smali_flow path=app/smali mode=basic scope=file
```

v0.7.0 — smali_flow: Mermaid flowchart generator

Choose a tag to compare

@GrandpaEJ GrandpaEJ released this 23 Jun 16:43

Added

  • smali_flow tool: Generates Mermaid flowcharts from smali source code, showing method control flow graphs with conditional branches, switch statements, try/catch handlers, and fallthrough edges. Supports single file or directory input with optional method name filter.

v0.6.4 — Full apktool-compatible APK decompilation pipeline

Choose a tag to compare

@GrandpaEJ GrandpaEJ released this 23 Jun 14:34

v0.6.0 — 2026-06-23 — ARSC-Aware AXML Decoder

Added

  • ARSC-Aware AXML Decoder: Full resource ID resolution (@ref/0x7f090004 → @string/show_window) by parsing the complete resources.arsc chunk tree (packages, types, entries).
  • Resource XML Generation: decode_apk now generates res/values/strings.xml, public.xml, colors.xml, ids.xml, bools.xml, styles.xml, and per-type resource files matching apktool output structure.
  • Android Enum/Flag Resolution: Hardcoded lookup table for common attributes (orientation, gravity, visibility, scrollbars, layout_gravity) producing human-readable enum names instead of raw hex integers.
  • Extended arsc_parse(): Full package/type/entry resolution API via arsc_lookup_id() and arsc_get_type_name(), with axml_set_arsc() to attach resource context to the AXML decoder.

Changed

  • apk_decode() pipeline: Now decodes all AXML files (AndroidManifest.xml, res/layout/*.xml) using the resources.arsc context for resolved references.
  • AXML type formatting: Added TYPE_DIMENSION (0x05) and TYPE_FRACTION (0x06) decoding with human-readable unit suffixes (dp, sp, px, pt, in, mm, %, %p).
  • AXML enum values: match_parent/wrap_content/fill_parent layout constants now decoded from raw INT_DEC values.
  • Color types: INT_COLOR_ARGB8/ARGB4/RGB8/RGB4 (types 0x13-0x16) now output as hex #aarrggbb.

Fixed

  • String pool static buffer corruption: arsc_sp_string() static buf was overwritten by nested calls; type names are now strdup/d during parsing.
  • Shift overflow crash: arsc_r32() cast to uint32_t before left shifting to prevent undefined behavior on bytes with high-bit set.

v0.6.1 — 2026-06-23

Fixed

  • AXML encoder reverse lookup: Added arsc_reverse_lookup() + axml_assemble_set_arsc() to resolve @type/key references back to binary TYPE_REFERENCE during re-encoding, enabling lossless round-trip (decode → encode → build).

v0.6.2 — 2026-06-23

Fixed

  • AXML enum resolution: Added launchMode (standard/singleTop/singleTask/singleInstance), screenOrientation (portrait/landscape/sensor/user/etc.), configChanges (proper bitmask decomposition).
  • Gravity/layout_gravity decomposition: Replaced broken bitwise matching with correct nibble-pair encoding (top|center_horizontal etc.). No more false positives from overlapping bit positions.
  • AXML namespace placement: xmlns: declarations now emitted after regular attributes on a separate indented line, matching apktool output style.
  • AXML indent: Changed from 2-space to 4-space indent to match apktool.
  • Static buffer reuse: Fixed fmt_flags() buffer not being cleared between calls, causing compounded flag strings across multiple attribute values.

v0.6.3 — 2026-06-23

Added

  • Config-specific resource XMLs: decode_apk now generates per-qualifier resource directories matching apktool output structure (values-v21/, drawable-xhdpi-v4/, values-night-v8/, drawable-night-v25/, etc.).
  • ResTable_config qualifier parsing: Reads density, uiMode (night), and sdkVersion from ARSC type chunk configs, building correct Android resource directory qualifiers.
  • Dynamic attr enum resolution: Parses ResTable_map entries from ARSC type 0x01 complex bag entries — covers all app-defined custom attrs automatically.

Fixed

  • Static buffer overwrite in arsc_sp_string: Type name (tn) was a dangling pointer after subsequent calls; now copied to stack buffer.
  • Resource value XMLs kept as text: Files in res/values* directories are no longer AXML-encoded, preserving human-readable resource definitions.
  • Style/complex entry rendering: Proper ResTable_map parsing (12-byte entries with typed Res_value), resolved item attribute/value references, parent style references.
  • Color type range: Extended to handle ARGB8/RGB8 types (0x1C-0x1F) in addition to ARGB4 (0x13-0x16).

v0.6.4 — 2026-06-23

Fixed

  • Removed noisy zip_inflate/unsupported method stderr messages during APK extraction. Non-critical extraction failures are now silently skipped.

Release v0.5.0

Choose a tag to compare

@GrandpaEJ GrandpaEJ released this 13 Jun 17:38

Added

  • Native APK Signer: Full implementation of APK Signature Scheme v1, v2, and v3 including chunked hashing, native SHA-256 and RSA-SHA256, PKCS#7/PKCS#8 DER parsing, and dynamic custom certificates.
  • AXML Encoder: Complete native AXML encoder with 100% AAPT compliance, supporting Resource Maps, namespace URIs, and attribute sorting.
  • Smali Assembler: Implemented Phase 2 Annotation System (Class, Field, Method, Parameter) and added rigorous validation & error reporting (register limits, type list deduplication).
  • ZipAlign & APK Pipeline: Lossless native zipalign integration and full APK decode/build orchestration logic.
  • Docs & Licenses: Added CONTRIBUTING.md and GNU General Public License v3.0 (LICENSE), alongside comprehensive internals documentation for AXML, ARSC, APK Signer, and DEX/Smali.
  • Project Tracking: Created GitHub issues tracking the remaining native implementation phases (APK Signer, AXML/ARSC Encoders, ZipAlign, Debug Info).

Changed

  • Architectural Restructure: Moved source files into a strict semantic layout (src/core, src/net, src/tools) adhering to AGENTS.md and the Small File Rule.
  • Android Separation: Extracted all Android-specific modules (adb, apk, axml, dex, smali) from src/formats/ to a dedicated src/android/ directory.
  • Documentation: Renamed AGENT.md to AGENTS.md and moved REVERSE_ENGINEERING.md to docs/RE_ARCHITECTURE.md.
  • Build System: Updated Makefile to reflect the new directory structure, maintaining full compatibility with pico and nano targets.
  • Security: Enabled GitHub branch protection on main to prevent force pushes and deletions.

Fixed

  • Smali: Corrected MUTF-8 surrogate pair encoding for 4-byte UTF-8 chars.
  • DEX: Fixed DEX verifier crash and string pool bloat issues.
  • AXML: Fixed boolean encoding, integer types, and sorted attributes by resource ID.
  • Crypto: Corrected CERT.RSA signature offset injection length in V1 PKCS#7 template.

Agent X v0.4.0

Choose a tag to compare

@GrandpaEJ GrandpaEJ released this 13 Jun 03:48

Initial release of the Smali to DEX assembler (smali_assemble tool) with full round-trip parity and fixes for DEX verification crashes.