Leanrea
Reverse engineer shipped software with plain local CLI tools, no MCP needed.
Install
npx skills add aicodeking/leanrea --skill leanrea -g -a claude-code -y- Repository
- aicodeking/leanrea3.8k
- Category
- AI and agents
- Updated
- 16d ago
- License
- MIT
- Context cost
- Mediumabout 2,007 tokens
- Runs scripts
- No, instructions only
What it does
Reverse engineer shipped software with plain local CLI tools, no MCP needed. Covers Electron/JS bundles, native Mach-O/ELF/PE, Go/Rust/.NET/Flutter/WASM binaries, APKs, SQLite, pcaps, firmware and websites. Use to explain how a feature works, extract versions/deps, compare builds, or rebuild a feature.
leanrea: fast path
You already know these tools. This file only lists the fastest command for each target, and the traps.
Rules
- Work on a copy (
cp -con APFS is instant). Put each extraction in a new dir under$TMPDIR/re/<name>. Reuse an extraction if one exists. - Route by
file -b Tand the magic bytes first. Run the cheapest inventory next. Only then decompile or read code. rgskips hidden and ignored files, and bundlers hide code (Electron:.webpack/,.vite/). Always search extracted trees withrg -uu.- Never
cata big or minified file. Slice it:rg -o '.{0,200}NEEDLE.{0,200}' F | head. Dump a disassembly once to a file, then grep that file. - Batch independent probes into ONE shell call with
;andecho '--- name'markers (quoted: zsh expands a bare==x). Cap every output withheador-m. - Answer from evidence. In the answer, mark each claim as seen (cite file:offset, or a symbol/string) or inferred. A fact you did not find is unknown, not "absent". Static reading is not observed execution.
- A missing tool is not a blocker. Use the fallback in the same row, or
brew install <x>if the user allows it. - Turns cost more than bytes. Aim for 2, 4 tool calls: one batched recon call, one or two targeted slices, then answer. Stop when every item you were asked has evidence. Do not re-verify what you already saw.
First move: one call each, paste and run
Native (Mach-O):
T=./bin; D=$TMPDIR/re/$(basename $T); mkdir -p $D; file $T; lipo -info $T; otool -L $T; echo '--- EXPORTS'; nm -gU $T | head -150; echo '--- IMPORTS'; nm -u $T | rg -v '^__Z|napi_' | tr '\n' ' '; echo; echo '--- STRINGS'; strings -a -n 6 $T | rg -v '^[_$.]' | head -400; otool -tV $T > $D/dis.txt; echo '--- FUNCS'; rg '^[_a-zA-Z].*:$' $D/dis.txt | rg -v '^_?_?Z?N?St3' | head -150
Then read one function: awk '/^FUNC_LABEL:$/{p=1;next} p&&/^[_a-zA-Z].*:$/{exit} p' $D/dis.txt | rg 'bl|b\.|cmp|literal|mov\s+w2'.

