- Rust 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| tests | ||
| .gitignore | ||
| AGENTS.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| clippy.toml | ||
| LICENSE | ||
| README.md | ||
| rust-toolchain.toml | ||
| rustfmt.toml | ||
rex
A command line and MCP server for reading Android apps with the Reseam engine. Point it at an APK, APKM or XAPK and it answers questions about the code: what runs the app, where a string is used, who calls a method, and whether a patch's targets still resolve.
Runs on Unix and Windows.
Requirements
- The Rust toolchain in
rust-toolchain.toml(rustup installs it on first build). - JDK 17, in
JAVA_HOMEor asjavaonPATH. The build needs it for the runtime jar, andeval,resolveand target expressions need it at run time. - The BoltFFI CLI at the version in
../reseam/.boltffi-version. - The engine checked out next to rex:
reseam/
├── reseam/ engine
└── rex/ this repo
Install
mkdir reseam && cd reseam
git clone https://git.reseam.app/reseam/reseam.git
git clone https://git.reseam.app/reseam/rex.git
cd reseam
cargo xtask regen patch-api # generate the Kotlin bridge
cargo xtask runtime # build the runtime jar the engine embeds
cd ../rex
cargo install --locked --path .
rex --version
cargo install puts rex in ~/.cargo/bin.
Updating
rex builds against the engine source in ../reseam, so update both together:
git -C ../reseam pull && git pull
(cd ../reseam && cargo xtask regen patch-api && cargo xtask runtime)
cargo install --locked --path .
If the build fails with no field ... on type ..., rex is behind the engine. Pull rex too.
Quick start
Create a project folder with the app in it:
rex init lumen --apk ~/Downloads/lumen-4.2.0.apkm
cd lumen
This copies the APK to apks/ as <package>-<version>, creates bundle/ from the patch
template, out/ and notes/, and writes rex.toml and agent files (AGENTS.md, CLAUDE.md,
skills). Run rex init with no arguments to set up the current folder. It is safe to run again.
Then read the app:
rex overview # runtime, code map, SDKs, entry points
rex find "Export as PDF" # text you see in the app
rex show @2 # a listed method as smali
rex refs @2 --depth 3 # who calls it, three levels up
rex resolve # check every target of bundle/ on each APK
Every listed item gets a handle like @12. Pass handles to other commands. They persist across
sessions. Each command ends with a next: line suggesting what to run after it.
With several APKs in apks/, pick one with --apk <name>. Every analysis command also takes
--json, --fields a,b, -n <count> and --cursor <n> for paging.
Use with an agent
rex init --mcp writes a .mcp.json that runs rex mcp, which agents such as Claude Code pick
up when started in the project folder. To add it by hand:
claude mcp add rex -- rex mcp
The agent files rex init writes explain the commands, so an agent can also call the CLI
directly.
Commands
| Command | Does |
|---|---|
init |
creates a project folder: apks/, out/, bundle/, notes/, agent files |
overview |
runtime, code map, SDKs, entry points |
find |
text in resources and DEX strings, or a target expression |
refs |
references to a member, package, resource, number or string |
show |
a method as smali, a class, field, resource, the manifest or the APK |
diff |
one method in two APKs |
eval |
Kotlin run against the APK with the patch runtime |
resolve |
every target of a built bundle, on each APK |
status, stop |
the session |
mcp |
the analysis commands as MCP tools on stdio |
rex <command> --help explains a command. rex <command> --help --json prints its arguments
and result as JSON Schema.
Session
The first command starts a background session that keeps up to four APKs open. It exits after
30 idle minutes. Target expressions, eval and resolve start a JVM child process, which exits
after 10 idle minutes. The first one downloads the Kotlin compiler from Maven Central.
rex status shows open APKs, memory, whether the JVM runs, and the log path. rex stop ends
the session.
State lives in $REX_STATE_DIR, else $XDG_STATE_HOME/rex, else .local/state/rex in the
home folder. The socket is in $XDG_RUNTIME_DIR when it is set. On Windows the session listens
on a named pipe instead.
Development
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test
Try changes on APKs from ../test-apks/ with REX_STATE_DIR set to a scratch folder. Layout and
rules are in AGENTS.md.