/r2sql:r2jsfrom r2sql
Execute arbitrary radare2 commands and r2js scripts via r2sql when SQL surfaces are insufficient. Use for custom analysis passes, ESIL emulation, anything r2's tables don't expose, or to bridge SQL queries with r2 SDK behavior.
Ships in r2sql. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Pick this skill when SQL alone can't answer the question:
aae*,
agC call-graph dump, p8 raw-byte read at an address, wx to
patch bytes, …)#!js) — typed JS that runs
inside r2 with full SDK accessr2sql holds a Backend (either LibrBackend or R2PipeBackend) and
forwards arbitrary commands through Session::raw_cmd(std::string).
From the CLI, raw r2 commands are reachable via:
| transport | syntax |
|---|---|
r2sql -q/REPL | a line starting with . runs a raw r2 command (the leading . is stripped), e.g. r2sql -s a.bin -q ".pdf @ entry0" |
r2sql --http | POST /query body .r2cmd <command> → {"success":true,"output":"…"} |
| in-r2 plugin | the host RCore * is the r2 shell already |
| r2js inside r2 | r2cmd("aflj") returns JSON; round-trip via SQL |
| temp flags bridge | r2js writes flags, SQL reads them via flags table |
Recommended pattern: do the analysis pass in r2js, persist its results as r2 flags / comments, then query those from SQL.
// my_emulate.r2.js
const target = 0x401000;
r2cmd(`s ${target}`); // seek
r2cmd("aei; aeim; aeip"); // init ESIL, mem, ip
for (let i = 0; i < 50; i++) r2cmd("aes"); // step 50 instructions
const regs = r2cmd("arj"); // dump registers as JSON
const rax = JSON.parse(regs).rax;
r2cmd(`CC ESIL: rax=${rax.toString(16)} after 50 steps @ ${target}`);
Then SQL-side:
SELECT text FROM comments WHERE text LIKE 'ESIL:%';
SQL: find candidate addresses.
SELECT addr FROM funcs WHERE cc > 25;
r2js: feed each address into a custom pass that doesn't fit SQL:
const addrs = [0x401000, 0x402000]; // from step 1
addrs.forEach(a => {
r2cmd(`s ${a}`);
const summary = r2cmd("agCd"); // some non-tabular output
r2cmd(`f sym.complex_${a.toString(16)} 1 ${a}`); // tag it
});
SQL: re-query and the tags are visible:
SELECT name, addr FROM flags WHERE name LIKE 'sym.complex_%';
Opening -w lets r2 write back to the file. r2js gives you precise
byte control:
r2cmd("wx 90909090 @ 0x401234"); // 4 NOPs at the address
r2cmd("Ps"); // persist via project
r2sql exposes no patches write surface in SQL, so r2js is the path for
byte patching.
Session::raw_cmd bypasses the table layer entirely — there's no
parsing, no schema, no pushdown. You're responsible for parsing
whatever r2 prints.-q "."/REPL from
the CLI, .r2cmd <command> over HTTP, and the host shell in the in-r2
plugin. The raw path bypasses the table layer (no schema, no pushdown).What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub 0xeb/r2sql-skills --plugin r2sql11 skills in this plugin
/analysisTriage and audit radare2 binaries via r2sql — find suspicious behavior, surface crypto/network/persistence APIs, hunt high-complexity functions, and run multi-table queries that combine code, data, and xrefs./annotationsEdit radare2 annotations — comments, flag/function names, local variables, bookmarks — via r2sql. Use when asked to add comments, rename functions/flags, rename or retype locals, or persist analysis state./connectConnect to radare2 sessions via r2sql and bootstrap analysis. Use when starting a new SQL session, routing to other skills, or setting up CLI/HTTP/MCP connections.Other plugins' skills for the same job