Metadata-Version: 2.4
Name: erek
Version: 0.1.0a1
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Rust
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Compilers
Classifier: Topic :: Software Development :: Disassemblers
Summary: EREK (ECMAScript Reverse Engineering Kit) — Python bindings for mobile JS/TS/ArkTS bytecode & package inspection
Keywords: bytecode,decompiler,reverse-engineering,taint-analysis,arkcompiler,hermes
License: Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/erek-rs/erek
Project-URL: Issues, https://github.com/erek-rs/erek/issues
Project-URL: Repository, https://github.com/erek-rs/erek

# `erek` — Python Bindings for EREK

**EREK** (**E**CMAScript **R**everse **E**ngineering **K**it) is a memory-safe, zero-recursion Rust framework for inspecting, lifting, analyzing, and decompiling precompiled mobile JavaScript / TypeScript / ArkTS bytecodes (`.abc` and `.hbc`) and application packages (`.hap`, `.hsp`, `.app`, `.apk`, `.ipa`).

## Installation

```bash
pip install erek
```

## Quick Start

```python
import erek

# 1. Classify raw payload bytes by wire magic (never relies on file extensions)
info = erek.classify_payload(b"PANDA\x00\x00\x00\x11\x22\x33\x44\x0c\x00\x06\x00")
# -> {'kind': 'abc', 'version': '12.0.6.0'}

# 2. Inspect a .hap / .hsp / .app archive in memory (with IEEE CRC-32 & bomb limits)
with open("entry.hap", "rb") as f:
    modules = erek.extract_abc_modules(f.read())
for mod in modules:
    print(mod["container_path"], mod["entry_name"], len(mod["data"]))

# 3. Decode an ArkCompiler (.abc) method instruction stream
insns = erek.decode_abc_bytecode(bytes([0x64, 0x65]))  # ldundefined; returnundefined
for insn in insns:
    print(f"{insn['offset']:#06x}: {insn['text']}")
```

## Links

- **Repository**: <https://github.com/erek-rs/erek>
- **License**: Apache-2.0

