Skip to main content
Glama

re-code-mode

A layered reverse-engineering toolbox for AI agents, served through UTCP Code Mode so that big outputs are filtered inside a sandbox instead of flooding your model's context window.

Disassembling a binary, listing imports or dumping strings can easily produce tens of thousands of lines. Classic MCP tool-calling pushes all of that into the model. With Code Mode the agent writes a few lines of TypeScript, the filtering happens locally, and only the answer comes back.

// one round-trip: triage + capability filter + selective strings
const t = await re.re_triage_binary({ path: "/samples/app" });
const imps = await re.re_imports_exports({ path: "/samples/app", filter: "socket|ssl|crypt", kind: "imports" });
const urls = await re.re_extract_strings({ path: "/samples/app", preset: "urls", limit: 10 });
return { arch: t.binary_info.arch, hardening: t.binary_info.security,
         net_imports: imps.imports.map(i => i.name), urls: urls.strings.map(s => s.string) };

Responsible use. This project is for analysing software you own or are authorised to analyse: security research, malware triage, interoperability, CTFs, education. See DISCLAIMER and SECURITY.md.

Architecture

flowchart LR
  A[AI agent] -->|TypeScript| B[UTCP Code Mode sandbox]
  B -->|MCP stdio| C[re-code-mode server]
  C --> L1[Layer 1: local engines<br/>radare2 · rabin2 · binwalk · upx · unzip]
  C --> L2[Layer 2: catalog<br/>300+ community tools, clone on demand]
  C --> L3[Layer 3: playbooks and agent skills]
  C -.optional.-> R[REA engine<br/>200+ tools]

Layer

What it gives you

1 – Engines

triage_binary, imports_exports, extract_strings, list_functions, disassemble_function, apk_inspect, firmware_scan — all filtering happens server-side/in the sandbox.

2 – Catalog

catalog_search, catalog_categories, fetch_tool: a searchable index built from two public awesome lists, plus shallow clone of any entry on demand.

3 – Playbooks & skills

get_playbook (per target type), skill_list / skill_read over community agent skills you clone locally.

Inside Code Mode every tool is prefixed with the manual name, so triage_binary is called as re.re_triage_binary(...).

Related MCP server: Antardrishti

Requirements

  • Node.js ≥ 18, Python 3, git

  • radare2 (provides r2/rabin2), binwalk, upx, unzip, file

  • Optional: jadx, apktool, gdb, frida

Quick start

git clone https://github.com/sosiman/re-code-mode.git
cd re-code-mode
bash scripts/setup.sh --install-system-deps   # Debian/Ubuntu; on macOS: brew install radare2 binwalk upx
# optional extras
bash scripts/setup.sh --with-skills           # clone third-party agent skills into ./skills-repos
bash scripts/setup.sh --with-rea              # install the optional REA engine
npm test                                      # smoke + security regression tests

bin/re-run.sh list
bin/re-run.sh triage ./some-binary

setup.sh writes machine-local .utcp_config.json (git-ignored). If your npm blocks install scripts, approve isolated-vm (the V8 sandbox used by Code Mode) with npm install-scripts approve.

CLI cheat-sheet (bin/re-run.sh)

bin/re-run.sh catalog "ghidra" 5          # search the tool catalog
bin/re-run.sh playbook android_apk        # methodology for a target type
bin/re-run.sh triage   ./bin              # arch, hardening, libs, SHA-256 (<1s)
bin/re-run.sh imports  ./bin "socket|ssl" # filtered imports/exports
bin/re-run.sh strings  ./bin "https?://"  # filtered strings
bin/re-run.sh funcs    ./bin "main|auth"  # functions (radare2 analysis)
bin/re-run.sh decompile ./bin main        # pdf + pdc for one function
bin/re-run.sh apk      ./app.apk apis     # framework fingerprint + endpoints from DEX
bin/re-run.sh firmware ./fw.bin           # embedded files + UPX check
bin/re-run.sh fetch    radareorg/radare2-mcp   # shallow clone into ./tools-cache
bin/re-run.sh skills android; bin/re-run.sh skill-read leanrea
bin/re-run.sh run 'return await re.re_catalog_categories({});'

All arguments are JSON-encoded before being placed in the generated TypeScript, so file names and patterns cannot inject code.

Use it from an agent

Copy skills/re-code-mode into your agent's skills directory (Claude Code, Gemini CLI, Codex, Hermes, … — anything that reads SKILL.md) and set RE_CODE_MODE_HOME to this checkout. The skill teaches the agent the workflow and the Code Mode idioms.

Configuration (environment variables)

Variable

Effect

RE_CODE_MODE_HOME

Override the project root (default: auto-detected).

RE_ALLOWED_DIRS

:-separated allow-list; analysed files must live under these directories.

RE_ENABLE_REA_EXEC=1

Expose the free-form rea_exec tool (off by default — REA can drive debuggers and devices).

RE_KEEP_ALL_SKILLS=1

Keep the offensive-security modules when cloning reverse-skill.

Security notes (short version)

  • Run it locally for a user you trust; it is not a multi-tenant service.

  • Analysing hostile samples with any disassembler is risky — use a VM/container.

  • radare2 command injection, option injection in git clone, code injection through shell arguments and ReDoS are covered by tests in test/smoke.mjs.

Full details and reporting instructions: SECURITY.md.

Third-party material

Nothing from the projects below is redistributed here. They are fetched on your machine, under their licences:

Contributing

See CONTRIBUTING.md. New engines, playbooks and fixes are welcome.

Disclaimer

This software is provided for lawful, authorised security research, education and interoperability work. You are solely responsible for complying with applicable laws, licences and terms of service. The authors accept no liability for misuse. Do not use it to analyse systems or software you are not permitted to analyse.

License

MIT

Available Tools

13 tools
apk_inspectC

Fingerprint an APK/AAR (Flutter, React Native, Hermes, Unity IL2CPP, Kotlin, native libs) and optionally harvest URLs / API routes from its DEX files.

Inputs: path (required), mode.

catalog_categoriesB

List catalog categories and counts.

Inputs: no named parameters.

disassemble_functionC

Disassemble (pdf) and/or pseudo-decompile (pdc) one function by name or 0x address using radare2.

Inputs: path (required), target (required), mode, max_lines.

extract_stringsC

Extract strings from a binary (rabin2 -zzj) and filter by regex or preset before returning them.

Inputs: path (required), limit, regex, preset, +1 more.

fetch_toolA

Shallow-clone a GitHub repository (from the catalog, 'owner/repo' or a github.com URL) into ./tools-cache. Clone only: nothing is built or executed.

Inputs: repo_or_query (required), mode.

firmware_scanC

Scan a firmware image or packed binary for embedded files/filesystems (binwalk) and UPX packing.

Inputs: path (required).

get_playbookB

Get the step-by-step triage playbook for a target type.

Inputs: scenario.

imports_exportsB

List imports/exports of a binary, filtered with a regex (done in-process so only matches reach the caller).

Inputs: path (required), kind, limit, filter.

list_functionsB

Run radare2 analysis (aa; aflj) and return a filtered function list. only_leaf=true gives call-graph leaves for bottom-up review.

Inputs: path (required), limit, filter, min_size, +1 more.

skill_listB

List markdown/scripts of the agent-skill repositories cloned into ./skills-repos (see scripts/fetch-skills.sh).

Inputs: filter.

skill_readC

Read a file from ./skills-repos by (partial) relative path, optionally filtering lines with a regex.

Inputs: target (required), grep, max_lines.

triage_binaryA

Fast static triage of ELF/PE/Mach-O/DEX: arch, bits, language, hardening flags, linked libs, sections, SHA-256.

Inputs: path (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 13 tools

    Disambiguation4/5

    The tools split into a discovery tier (catalog_*, get_playbook, skill_*, fetch_tool) and an analysis tier (triage_binary, imports_exports, extract_strings, list_functions, disassemble_function, apk_inspect, firmware_scan), each targeting a distinct artifact or action. Minor overlap: apk_inspect's URL harvesting duplicates extract_strings territory, and triage_binary overlaps with apk_inspect for Android binaries, but descriptions make the intended split clear.

    Naming Consistency3/5

    All names are snake_case, but verb placement is inconsistent: verb_noun (list_functions, extract_strings, fetch_tool, triage_binary, disassemble_function) mixed with noun_verb (skill_list, skill_read, apk_inspect, firmware_scan) and noun_noun (catalog_categories, imports_exports). Still readable, but an agent can't predict the prefix from the resource.

    Tool Count5/5

    13 tools sits comfortably in the well-scoped range, forming a coherent pipeline from catalog discovery through skill reading and repo fetching to binary triage and function-level analysis. Each tool covers a distinct stage or artifact type without filler.

    Completeness4/5

    The surface covers the full workflow: find a tool, fetch it, fingerprint it, list imports/strings/functions, and disassemble. Gaps are minor but real: no cross-reference/xref tool (only leaf detection in list_functions), no raw byte read or byte-pattern search, and no way to inspect a function not reachable by name or address.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A headless Ghidra server that enables AI agents to perform deep reverse-engineering tasks such as disassembly, decompilation, and patching via the Model Context Protocol. It supports extensive automation of analysis workflows in sandboxed environments through a catalog of over 200 specialized tools.
      200
      GPL 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to locally analyze and reverse engineer binaries through a compact 12-tool MCP interface for triage, function discovery, disassembly/decompilation, cross-references, strings/imports, call graphs, memory reads, annotations, and binary diffs.
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to run read-only static reverse-engineering tasks — binary triage, symbol and import inventory, per-function decompilation, and Android native-lib analysis — with untrusted samples confined to a no-network bubblewrap chamber that never executes the target.
      7
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to reverse-engineer binaries they own or are authorized to test, exposing static analysis through Ghidra or IDA (functions, strings, xrefs, decompilation, disassembly, raw bytes) plus controlled Windows Sandbox runs. Every recorded claim must cite quoted evidence and addresses, which a verifier checks, and unexamined areas are reported as unknown rather than clean.
      26 PyPI
      Apache 2.0