Re zig

From dslsdzc/rev-skills · View interactive version

Re zig is an AI agent skill from the GitHub repository dslsdzc/rev-skills. Zig 编译产物逆向:产物识别、comptime 展开、panic/错误处理路径、C ABI 边界。 触发词:Zig逆向、zig、comptime、zig 产物、panic。

How to use this skill

Skill file

Zig 逆向

何时使用 / 何时不用

工具准备

readelf / llvm-nm(符号与节分析)

llvm-objdump / objdump(反汇编)

Ghidra / IDA(反编译底座)

strings(字符串池/错误名)

zig 编译器(可选,对照编译)

操作步骤

按顺序执行,每步产物存档(路径 + sha256,见 [[re-triage]])。

  1. 产物识别:

```sh

readelf -s sample | grep -iE 'panicking|panicExtra|defaultPanic|zig' | head

readelf -S sample | grep gcc_except_table # 应无输出(Zig 产物常带 .eh_frame,不能作判别)

readelf -s sample | grep __gxx_personality_v0 # 应无匹配

readelf -s sample | grep -wE '_start|main' # 启动形态

```

  1. 符号可见性与启动路径:

```sh

readelf -s sample | grep -E 'GLOBAL|LOCAL' | grep -cE 'FUNC'

readelf -s sample | grep -wE '_start|main' | head

```

  1. panic/错误处理路径:

```sh

readelf -s sample | grep -iE 'panic' | head # panic 链符号(版本相关命名)

```

  1. 常量与字符串定位(行为分析入口):

```sh

strings -n 5 sample | head -30 # 格式串/错误名/panic 消息

readelf -S sample | grep -E 'rodata|data' # 常量区

```

  1. comptime 与泛型展开:
  1. C ABI 边界:
  1. stripped/ReleaseFast 兜底:

```sh

strings -n 6 sample | grep -iE 'panic|error' | head # panic 消息/错误名(@errorName 字符串池)

```

跨域联合

常见坑与陷阱

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.