| Crates.io | arkts |
| lib.rs | arkts |
| version | 0.1.0 |
| created_at | 2025-11-03 16:30:56.529915+00 |
| updated_at | 2025-11-03 16:30:56.529915+00 |
| description | A rust crate for reversing HarmonyOS Arkts bytecode files. |
| homepage | |
| repository | https://github.com/azw413/ark-rs |
| max_upload_size | |
| id | 1914953 |
| size | 1,750,422 |
Rust tooling for exploring HarmonyOS Ark (ArkTS) .abc bytecode files. The
crate mirrors the textual disassembly format while incrementally reverse
engineering the binary container.
modules.txt) into high-level Rust structs
and emit byte-identical output for round-trip testing..abc modules: headers, index tables, string table, class
metadata, method index stubs, and the literal array region.specs/literals.md and
specs/abc-combined.md) including module request/import/export blocks,
affiliate tags, getter/setter references, and nested literal arrays.ArkFunction structures ready for
rendering or inspection.ArkModule and render their textual disassembly
directly (ArkModule::to_string()), including resolved function names and
string operands.test-data/modules.abc, test-data/wechat.abc) and tests
(cargo test) that exercise both textual and binary pipelines.Load a binary .abc file and list the decoded functions together with their
disassembly:
use ark_rs::{format_function, AbcFile};
fn main() -> anyhow::Result<()> {
let bytes = std::fs::read("test-data/modules.abc")?;
let module = AbcFile::parse(&bytes)?.to_ark_module();
for (idx, entry) in module.functions.iter().enumerate() {
let name = entry
.parsed
.as_ref()
.and_then(|func| func.name.clone())
.unwrap_or_else(|| format!("function#{idx}"));
println!("=== {} ===", name);
if let Some(func) = &entry.parsed {
print!("{}", format_function(func)?);
} else {
print!("{}", entry.raw_text);
}
}
Ok(())
}
ArkModule (and low-level structures) back to .abc bytes while preserving
layout and checksums.any payloads but still truncates binary data. Validate size limits and
format differences across Ark versions, and expose friendly views.ark_disasm, set up
cargo fmt/Clippy gates, and wire CI once the repository is public.cargo test
The test suite will read fixtures from test-data/. Disassembly previews are
written to target/disassembly/ by the binary parsing tests.
specs/literals.md, specs/abc-combined.md — current understanding of the
literal and constant pool layouts.test-data/ — sample .abc binaries and their textual dumps.any/bigint values is summarised (len=…) rather than a
full decode.type#…/field#… placeholders until their metadata is fully resolved.