/r2sql:connectfrom r2sql
Connect 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.
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.
Read when SKILL.md points to them.
r2sql --help)r2sql 0.0.2 — SQL interface for radare2 (pipe-only)
Copyright (c) 2024-2026 Elias Bachaalany
Usage: r2sql [options]
-s <file> open the given binary or r2 project
-q "<sql>" run a single SQL statement (".<cmd>" runs a raw r2 command)
-f <file.sql> run a SQL script file
-i interactive REPL
-w, --write open in write mode (persist with `Ps` on exit)
--no-analyze skip the implicit `aaa` at startup
--project NAME r2 project name (reuses cached analysis; saves on exit if -w)
--r2pipe use the r2pipe backend (spawn radare2)
--r2-exe PATH path to radare2 executable for r2pipe
--http [port] start HTTP REST server (default: random 8100-8999)
--mcp [port] start MCP SSE server (default: random 9000-9999)
--bind <addr> bind address for --http / --mcp (default: 127.0.0.1)
--token <tok> require Bearer token on HTTP endpoints
--version print version and exit
-h, --help print this help and exit
r2sql comes in two binaries with an identical CLI. The default r2sql
(pipe-only, portable) prints r2sql 0.0.2 — SQL interface for radare2 (pipe-only); r2sql-full (in-process libr, ships the plugin) prints
r2sql-full 0.0.2 — … (embedded radare2 / libr). Everything else is identical.
Key takeaway: -s accepts any path radare2 itself would accept — a
raw binary, an r2 project (.r2/<name>), or a debugger/emulator URI
(dbg://, frida://). r2sql does not create the radare2 session
type; it just speaks the same -s you would pass to radare2 itself.
r2sql / r2sql-full and core_r2sql.dll go): references/deployment.md| Backend | When to use |
|---|---|
libr (r2sql-full) | In-process, fastest. Links the radare2 C libraries directly and runs commands via r_core_cmd_str. This is the backend used by the r2sql-full binary (built with -DR2SQL_BUILD_FULL=ON). |
r2pipe (r2sql, or --r2pipe) | Spawns radare2 -q0 <path> and talks to it over stdio. The only backend in the default portable r2sql binary; also forceable in r2sql-full with --r2pipe (e.g. ABI mismatch, or to attach to an externally-launched r2). |
in-r2 plugin (core_r2sql.dll) | Already inside radare2 and want SQL access to this core. Load with L core_r2sql.dll, then sql <SQL> / sql.<SQL> (shorthand; bare sql or sql. prints help) / sql.http [port] / sql.mcp [port]. The plugin reuses the host RCore * — no second core is created. |
| mock | MockBackend (public, in <r2sql/backend_mock.hpp>) accepts canned {cmd → response} and records every issued command — handy for embedding r2sql without a live radare2. |
r2sql -s <file> -i
sql> SELECT name FROM funcs LIMIT 5;
sql> .quit
The REPL is a thin wrapper around Session::query. Statements are
terminated by newline; multi-statement scripts go through -f or
-q "...; ...; ..." instead. A line that starts with . (other than
.quit/.exit) runs a raw r2 command — e.g. sql> .pdf @ entry0
prints disassembly straight from r2 (same as -q ".<cmd>").
SELECT key, value FROM binary ORDER BY key;
Gives you bintype, arch, bits, os, plus the func_count,
string_count, import_count, section_count quick-counts before
drilling in.
Per-session runtime controls (query timeout, hints, a scoped-timeout stack) live
in the writable runtime_settings table — read with SELECT, change with
UPDATE:
SELECT key, value, type, scope FROM runtime_settings; -- discover the surface
UPDATE runtime_settings SET value='5000' WHERE key='query_timeout_ms'; -- raise the per-query timeout
Full key list and semantics in references/cli-reference.md and the schema catalog.
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./dataQuery radare2 data and memory — bytes, defined data, byte patterns, strings, imports, entry points, and binary metadata — via r2sql.Other plugins' skills for the same job