leanrea
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseleanrea: fast path
leanrea:快速路径
You already know these tools. This file only lists the fastest command for each target, and the traps.
你已经了解这些工具。本文件只列出每种 target 最快的命令,以及相关陷阱。
Rules
规则
- Work on a copy (on APFS is instant). Put each extraction in a new dir under
cp -c. Reuse an extraction if one exists.$TMPDIR/re/<name> - Route by and the magic bytes first. Run the cheapest inventory next. Only then decompile or read code.
file -b T - skips hidden and ignored files, and bundlers hide code (Electron:
rg,.webpack/). Always search extracted trees with.vite/.rg -uu - Never a big or minified file. Slice it:
cat. Dump a disassembly once to a file, then grep that file.rg -o '.{0,200}NEEDLE.{0,200}' F | head - Batch independent probes into ONE shell call with and
;markers (quoted: zsh expands a bareecho '--- name'). Cap every output with==xorhead.-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 if the user allows it.
brew install <x> - 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.
- 在副本上工作(APFS 上 可即时完成)。将每次 extraction 放入
cp -c下的新目录。如果已有 extraction,则复用。$TMPDIR/re/<name> - 先根据 和 magic bytes 路由,再运行成本最低的 inventory。只有完成这些后才 decompile 或读取代码。
file -b T - 会跳过 hidden 和 ignored 文件,bundler 还会隐藏代码(Electron:
rg、.webpack/)。搜索 extraction 后的目录树时始终使用.vite/。rg -uu - 永远不要 大型或 minified 文件。应进行切片:
cat。将 disassembly dump 到文件一次,然后 grep 该文件。rg -o '.{0,200}NEEDLE.{0,200}' F | head - 将彼此独立的 probe 批处理到一次 shell call,使用 和
;marker(marker 要加引号:zsh 会展开未加引号的echo '--- name')。用==x或head限制每段输出。-m - 以证据为依据。在答案中,将每项 claim 标为 seen(引用 file:offset,或 symbol/string)或 inferred。未找到的事实是 unknown,而不是“不存在”。静态阅读不等同于实际观察到的执行。
- 缺少工具并不是 blocker。使用同一行中的 fallback,或在用户允许时执行 。
brew install <x> - 相比处理更多 byte,应尽量减少 Turn 次数。目标是 2–4 次 tool call:一次批量 recon call、一到两次定向 slice,然后作答。每个被问到的项目都有证据后即可停止。不要重复验证已经看到的内容。
First move: one call each, paste and run
第一步:每种目标调用一次,粘贴并运行
Native (Mach-O):
sh
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 -150Then 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'Electron:
sh
A=./app.asar; X=$TMPDIR/re/asar; rm -rf $X; npx -y @electron/asar extract $A $X && jq '{name,version,main}' $X/package.json; find $X -path '*/node_modules' -prune -o -type f \( -name '*.js' -o -name '*.node' \) -print | head -60; ls ${A}.unpacked/node_modules 2>/dev/null; rg -uu -l --glob '!node_modules' 'exposeInMainWorld' $XThen slice the needle across the bundle: .
rg -uu -o --glob '!node_modules' '.{0,250}NEEDLE.{0,250}' $X | head -20Go: alone usually answers the question.
go version -m T原生程序(Mach-O):
sh
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然后读取一个 function:。
awk '/^FUNC_LABEL:$/{p=1;next} p&&/^[_a-zA-Z].*:$/{exit} p' $D/dis.txt | rg 'bl|b\.|cmp|literal|mov\s+w2'Electron:
sh
A=./app.asar; X=$TMPDIR/re/asar; rm -rf $X; npx -y @electron/asar extract $A $X && jq '{name,version,main}' $X/package.json; find $X -path '*/node_modules' -prune -o -type f \( -name '*.js' -o -name '*.node' \) -print | head -60; ls ${A}.unpacked/node_modules 2>/dev/null; rg -uu -l --glob '!node_modules' 'exposeInMainWorld' $X然后在 bundle 中切取 needle 附近内容:。
rg -uu -o --glob '!node_modules' '.{0,250}NEEDLE.{0,250}' $X | head -20Go:通常仅运行 就能回答问题。
go version -m TRouter
路由表
| Target (detect) | Fastest path |
|---|---|
Electron app ( | |
| Web bundle / minified JS | Find |
| Hermes / bytenode / V8 snapshot | Hermes magic is |
Mach-O ( | |
| Native code logic | |
| ELF / PE | |
Go ( | |
| Rust | Deps (cargo-auditable): |
.NET ( | |
| Android APK | |
| Flutter snapshot hash | In |
| WASM | |
| SQLite | Copy the db, plus the |
| plist / nib / car | |
| pcap / HAR | |
| Firmware | |
| Website | |
| Running app / runtime | macOS: |
| 目标(检测方式) | 最快路径 |
|---|---|
Electron app( | |
| Web bundle / minified JS | 查找 |
| Hermes / bytenode / V8 snapshot | Hermes magic 为 |
Mach-O( | |
| 原生代码逻辑 | |
| ELF / PE | |
Go( | |
| Rust | Deps(cargo-auditable): |
.NET( | |
| Android APK | |
| Flutter snapshot hash | 在 |
| WASM | |
| SQLite | 复制 db;如果存在 |
| plist / nib / car | |
| pcap / HAR | |
| Firmware | |
| Website | 使用 |
| Running app / runtime | macOS: |
Speed patterns
速度模式
- Strings and imports first. On a small binary, +
nm -u+ the export list usually answer "what does it do" with no disassembly.strings - To find who uses a string: get its address from "literal pool for" comments, or
otool -tV. Then find the enclosing function label above that line.rg -n 'literal pool for: "X' - A C++ name in a target already tells you the protocol (for example
bl,getpeereid,write). Read the call sequence, not every instruction.std::hash - For JS, go from the native/JS boundary inward: find the native call, then its caller class, then the IPC registration, then the renderer/preload.
- Comparing versions: diff the inventories (, the module list,
nm) before you diff any code.go version -m - Rebuilding: write the minimal reimplementation, then test it against the original (same inputs, same outputs).
- 先查看 strings 和 imports。对于小型 binary,+
nm -u+ export list 通常无需 disassembly 就能回答“它做什么”。strings - 查找 string 的使用者:先从 的“literal pool for”comment 中获取 address,或运行
otool -tV。然后找到该行上方的 enclosing function label。rg -n 'literal pool for: "X' - target 中的 C++ name 已经能说明 protocol(例如
bl、getpeereid、write)。读取 call sequence,而不是每条 instruction。std::hash - 对 JS,从 native/JS boundary 向内追踪:先找到 native call,然后是 caller class,再找到 IPC registration,最后是 renderer/preload。
- 比较 version:先 diff inventory(、module list、
nm),再 diff code。go version -m - 重建:编写最小 reimplementation,然后使用相同输入和输出与 original 进行对比测试。
Install (only on request)
安装(仅在用户要求时)
brew install jadx apktool radare2 binwalk wabt wireshark ghidranpm i -g @electron/asardotnet tool install -g ilspycmdcargo install cargo-auditbrew install jadx apktool radare2 binwalk wabt wireshark ghidranpm i -g @electron/asardotnet tool install -g ilspycmdcargo install cargo-audit