在Debian系统上进行反汇编时,可以采用以下技巧:
objdump -d <binary_file>
-d 选项表示反汇编整个二进制文件。objdump -t <binary_file> # 查看符号表
objdump -r <binary_file> # 查看重定位信息
r2 <binary_file>
pdf(disassemble function)、pd(disassemble current function)、s main(跳转到main函数)等。gdb进行调试:gdb <binary_file>
strings命令查找二进制文件中的可打印字符串:strings <binary_file>
假设你有一个名为hello.c的C程序,编译后生成了hello可执行文件。
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
编译:
gcc -o hello hello.c
反汇编:
objdump -d hello
输出可能类似于:
hello: file format elf64-x86-64
Disassembly of section .text:
0000000000401136 <main>:
401136: 55 push %rbp
401137: 48 89 e5 mov %rsp,%rbp
40113a: 48 83 ec 10 sub $0x10,%rsp
40113e: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
401145: bf 00 60 40 00 mov $0x406000,%edi
40114a: e8 d0 fe ff ff callq 40101f <printf@plt>
40114f: b8 00 00 00 00 mov $0x0,%eax
401154: c9 leaveq
401155: c3 retq
通过这些技巧和工具,你可以在Debian系统上有效地进行反汇编和分析工作。