Re rust

From dslsdzc/rev-skills · View interactive version

Re rust is an AI agent skill from the GitHub repository dslsdzc/rev-skills. Rust 二进制逆向:符号、monomorphization、所有权模式。触发词:Rust、rust、Rust二进制、cargo

How to use this skill

Skill file

Rust 二进制逆向(符号解译 / monomorphization / 所有权)

何时使用 / 何时不用

工具准备

参考 [[re-analyze/platform-tips]]——反编译/符号为静态步骤,免沙箱;Rust 二进制通常 1-10MB+,静态定位先行。

Rust 工具链(rustc/cargo——装符号工具用,可选)

rustfilt(Rust 符号 demangle,v0 新式 `_RNv` 必用)

c++filt(legacy `_ZN` 可解;v0 不行)

Ghidra / IDA(反编译底座,装法见对应技能)

nm / readelf(符号表与节,binutils)

rustc --emit(编译产物理解,可选)

bloaty(体积分析,坑 2 用;安装见 [[re-go]] 工具准备)

操作步骤

按顺序执行,每步记录证据(路径 + sha256,见 [[re-triage]])。

  1. 识别 Rust:

```sh

file sample

nm sample | head -20 # 出现 _ZN...(legacy)或 _RNv...(v0)即 Rust

strings sample | grep -iE 'rustc|rust_begin_unwind|panicking|__rust_alloc'

```

  1. 符号解译(demangle):

```sh

nm -C sample | grep main # 内置 demangle(仅 legacy _ZN 可解)

nm sample | rustfilt > symbols.txt # 全量 demangle(v0/legacy 通吃)

grep -iE 'main|tokio|serde' symbols.txt

```

  1. monomorphization 识别:

```sh

grep -oE '::[a-z_]+<[^>]*>' symbols.txt | sort | uniq -c | sort -rn | head

```

  1. 所有权/借用模式:
  1. 常见库模式:

跨域联合

常见坑与陷阱

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.