re-source
Recursive bottom-up annotation of a radare2 binary via r2xsql — walk from strings/imports up through callers, naming and commenting each layer until the…
от radareorg★ 23 звезды на GitHub
Установить re-source в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
When to use
Pick this skill when the user wants to incrementally rebuild
meaning in a binary: turn sub_401000 into aes_init, write what
each function does, and persist that across sessions so the next pass
starts from a richer baseline.
For one-off analysis or open-ended triage, use the analysis skill.
For the mechanics of writing comments/flags, use annotations.
Required: write + project
Persistence is required. Always:
radare2 -w -A <binary> # then `sql <SQL>` / `sqlj <SQL>` at the prompt
so every comment/flag you add gets saved to the project on exit.
The re-source loop
- Anchor — pick an unambiguous data leaf:
- a unique string (
'license check failed') - a unique import (
CryptDecryptif it appears once) - a known constant (PE magic, RC4 sbox, …)
- a unique string (
- Walk back —
xrefsto find the first caller, then the caller's caller, … up to a function that's identifiable from its own surface (a public DLL export, an exception handler, a top-level dispatcher). - Name and comment — every named anchor becomes a
UPDATE flags SET name = …andUPDATE comments SET text = …. - Repeat with the next un-named anchor.
Walked example
-- (1) the anchor: a unique error string
SELECT addr FROM strings WHERE content = 'license check failed';
-- → addr = 0x412ab0
-- (2) one hop back: who references the string? from_func is the owning
-- function's ADDRESS, which is exactly what step (3) renames.
SELECT from_addr, from_func FROM xrefs WHERE to_addr = 0x412ab0;
-- → from_func = 0x401a10 (sub_401a10), from_addr = 0x401b34
-- (3) annotate that function
UPDATE flags SET name = 'license_fail_log' WHERE addr = 0x401a10;
UPDATE comments SET text = 'logs license-check failure' WHERE addr = 0x401a10;
INSERT INTO comments(addr, text) VALUES (0x401b34, 'msg = license check failed');
-- (4) two hops back: who calls license_fail_log?
SELECT cf.name FROM xrefs x
JOIN funcs f ON f.addr = x.to_addr
JOIN funcs cf ON cf.addr = x.from_func
WHERE f.name = 'license_fail_log' AND x.type = 'CALL';
-- → license_check_v2
-- (5) annotate, repeat
UPDATE comments SET text = 'top-level license check; calls license_fail_log on failure'
WHERE addr = (SELECT addr FROM funcs WHERE name = 'license_check_v2');
Multi-pass workflow
Each pass over the binary makes the next pass cheaper:
- Pass 1: name 20-50 leaf functions from strings/imports.
- Pass 2: use the named functions as your new anchors — every
xrefswalk lands on a meaningful name instead ofsub_*. - Pass 3: start naming dispatchers and state machines based on what their callees do.
Persist explicitly with Ps NAME before exiting; the plugin does not save
automatically. Reopen with -p NAME to
skip re-analysis and keep building.
Type reconstruction
types and types_members surface r2's type database — useful when
the binary uses well-known struct shapes (Windows headers, Linux
kernel structs). Apply types to memory with tl <TYPENAME> @ <addr>
through the r2js skill (a raw r2 command, not a SQL write).
Caveats
- Renames stick only if you opened with
-w; otherwise they vanish on exit and the next pass starts fromsub_*again. - The
xrefstable only sees what the analysis found. Runaaaa(with -AA) for deeper static analysis before serious re-sourcing. - Anchors degrade — a string like
'error'is too common to follow. Pick unique anchors first; the rare ones give straight chains.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Bash - 02
Read
FAQ
Что делает скилл re-source?
Recursive bottom-up annotation of a radare2 binary via r2xsql — walk from strings/imports up through callers, naming and commenting each layer until the binary reads like source. Use for reverse engineering campaigns that span multiple sessions.
Как установить скилл re-source?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл re-source запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…