附录 A 命令速查表
从全部章节浓缩的"现场救命卡"。按使用频率排序。
A.1 侦察三连
file binary # 类型/架构
strings binary | grep -iE "flag|secret|key|http|password" # 字符串捡漏
rabin2 -I binary # 基本信息(入口点/架构)
A.2 静态分析(radare2)
r2 -A binary # 打开+分析
aaa; afl; iz; iS; is # 分析/函数/字符串/节区/符号
afl~main; iz~http # 过滤
axt <addr> # 交叉引用
s main; pdf # 跳转+反汇编
r2 -A -q -c "afl;iz;q" binary # 一次性自动化
rabin2 -z/-i/-E/-S binary # 字符串/导入/导出/节区
A.3 静态分析(ELF 工具链)
readelf -h/-l/-S/-d binary
objdump -d/-T binary
nm binary
A.4 动态分析(GDB)
gdb ./binary
b *main+0xca # PIE 相对断点
r / run
s / si / n / c # 单步进/过/继续
x/s $rsi; x/20gx $rsp; x/i $rip
info proc mappings # 内存布局
p/x $rax
set follow-fork-mode child
# pwndbg: vmmap / heap / bins / telescope $rsp / got
A.5 快速动态(不调试器)
ltrace ./binary
strace -f -s 500 ./binary
LD_PRELOAD=./hook.so ./binary # 侧信道/替换函数
A.6 Frida
frida -U -f com.app -l hook.js # spawn 注入
frida -U -n com.app # attach
frida-trace -U -f com.app -j '*!*certificate*'
frida-ps -U # 进程列表
objection -g "com.app" explore # 免脚本层
android sslpinning disable / android root disable
ios jailbreak disable / ios keychain dump
A.7 符号执行 / 模拟
# angr(Python)
python3 -c "
import angr
p=angr.Project('./x',auto_load_libs=False)
s=p.factory.entry_state()
sm=p.factory.simulation_manager(s)
sm.explore(find=0x401234,avoid=0x401111)
print(sm.found[0].posix.dumps(0))"
# Qiling(Python)
python3 -c "
from qiling import Qiling
ql=Qiling(['./x'],rootfs='./rootfs')
ql.set_syscall('ptrace',lambda q,*a:0)
ql.run()"
# Unicorn / Z3 见第 7 章
A.8 Android
jadx -d out app.apk # Java 反编译
apktool d app.apk -o out # smali/资源
apktool b out -o rebuilt.apk # 重建
adb devices; adb install -r x.apk; adb logcat
frida -U -f com.app -l hook.js
A.9 iOS / Mach-O
class-dump -H App -o headers/
otool -l/-L/-tV App
codesign -dvv App; codesign -f -s - App
xcrun swift-demangle < mangled
frida-ios-dump -u com.example.app
A.10 .NET
de4dot input.dll
de4dot input.dll -strtyp emulate
# dnSpyEx GUI: 反编译/Edit IL/调试
A.11 固件
binwalk -Me firmware.bin
unblob firmware.bin
unsquashfs rootfs.squashfs
qemu-arm-static ./busybox
qemu-aarch64-static -L rootfs ./prog
vmlinux-to-elf zImage
A.12 Pwn
checksec --file=./vuln
ROPgadget --binary ./libc.so.6 --only "pop|ret"
one_gadget ./libc.so.6
python3 libc-database/find puts 0x6f0
patchelf --set-interpreter ./ld.so --set-rpath . ./vuln
A.13 编码/加密识别
ciphey -t "密文"
haiti <hash>
RsaCtfTool --publickey pub.pem --private
# CyberChef: https://gchq.github.io/CyberChef/
A.14 二进制对比
radiff2 old new
radiff2 -C old new
# BinDiff / Diaphora(GUI 深度对比)
A.15 危险操作提醒
写模式: r2 -w / IDA patch / 修改样本 → 永远先备份
运行未知样本: 隔离环境