Repository navigation
Releases: GrandpaEJ/Agent-EJ
Releases · GrandpaEJ/Agent-EJ
Release list
v0.9.0 — XML → ARSC compiler: decoded res/values reaches the rebuilt APK
[0.9.0] - 2026-10-27
Added
- The decoded
res/valuestree is compiled back intoresources.arsc— an edit made afterdecode_apknow reaches the rebuilt APK.decode_apkturned every resource value into ares/valuesXML file, butbuild_apkpacked whateverresources.arscwas on disk, so those files were documentation only: change a string, rebuild, and the APK still had the old value. The newarsc_compile_xml()walks the values directories, patches the matching entries of the original table and re-encodes it, andbuild_apkruns it ahead of the pack step (apk_recompile_resources()); a table it cannot compile is left in place rather than failing the build. arsc_compiletool —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 invalues-landreaches 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 asgcm_defaultSenderIdstays 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
[0.8.1] - 2026-06-24
Fixed
- Memory bloat from inline annotation arrays (#25) —
smali_*_def_tstructs embeddedsmali_annotation_t annots[32]inline (99 KB per struct), so every class/method/field paid 99 KB even with 0 annotations. Converted to heap-allocatedannots*with lazy grow. Addedsmali_ctx_free()for proper recursive cleanup at end ofsmali_assembleandsmali_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
[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.
- 3 modes:
Fixed (carried from Unreleased)
repack_apkno longer includes smali source files in ZIP (#19).smali_assemblepool memory leak — frees all 5 pools, ~87 MB reclaimed (#21).apk_analyzesupports multidex (classes2.dex+) (#18).apk_buildcleans up compiled DEX files (#20).smali_codeguards 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
Added
smali_flowtool: 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
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 completeresources.arscchunk tree (packages, types, entries). - Resource XML Generation:
decode_apknow generatesres/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 viaarsc_lookup_id()andarsc_get_type_name(), withaxml_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 theresources.arsccontext 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_parentlayout 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()staticbufwas overwritten by nested calls; type names are nowstrdup/d during parsing. - Shift overflow crash:
arsc_r32()cast touint32_tbefore 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/keyreferences back to binaryTYPE_REFERENCEduring 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_apknow 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_mapentries 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_mapparsing (12-byte entries with typedRes_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 methodstderr messages during APK extraction. Non-critical extraction failures are now silently skipped.
Release v0.5.0
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
zipalignintegration and full APK decode/build orchestration logic. - Docs & Licenses: Added
CONTRIBUTING.mdand 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 toAGENTS.mdand the Small File Rule. - Android Separation: Extracted all Android-specific modules (
adb,apk,axml,dex,smali) fromsrc/formats/to a dedicatedsrc/android/directory. - Documentation: Renamed
AGENT.mdtoAGENTS.mdand movedREVERSE_ENGINEERING.mdtodocs/RE_ARCHITECTURE.md. - Build System: Updated
Makefileto reflect the new directory structure, maintaining full compatibility withpicoandnanotargets. - Security: Enabled GitHub branch protection on
mainto 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
Initial release of the Smali to DEX assembler (smali_assemble tool) with full round-trip parity and fixes for DEX verification crashes.