2个版本
使用旧的Rust 2015
0.1.1 | 2018年5月12日 |
---|---|
0.1.0 | 2018年5月11日 |
#9 in #disassemble
56KB
1.5K SLoC
binutils-rs
一个Rust库,通过高级API简化与binutils反汇编引擎的交互。其主要目标是简化将原始缓冲区反汇编成指令。
使用方法
您需要将以下行添加到您的 Cargo.toml
[dependencies]
binutils = "0.1.1"
并确保在代码中使用它
extern crate binutils;
注意: 默认情况下,cargo将构建binutils支持的所有架构。生成的库将超过60MB。当大小是一个问题,可以将
TARGETS
环境变量设置为仅构建特定的架构(例如TARGETS=arm-linux,mep
),如bfd/config.bfd
中定义。
示例
以下是如何以错误处理方式反汇编包含x86指令的缓冲区的方法
extern crate binutils;
use binutils::utils::disassemble_buffer;
use binutils::opcodes::DisassembleInfo;
// Prepare the disassembler
let mut info = disassemble_buffer("i386", &[0xc3, 0x90, 0x66, 0x90], 0x2800)
.unwrap_or(DisassembleInfo::empty());
// Iterate over the instructions
loop {
match info.disassemble()
.ok_or(2807)
.map(|i| Some(i.unwrap()))
.unwrap_or(None)
{
Some(instruction) => println!("{}", instruction),
None => break,
}
}
其他示例位于 examples/ 目录中,并使用 cargo run --example
运行。
资源
C语言示例和存档文档位于 resources/ 目录中。
路线图
- 添加Travis支持:测试和rustfmt
- 使用tarpaulin进行代码覆盖率测试
- 编写更多测试
- 研究剥离库
- 将check_null_pointer()转换为宏以添加文件和行号到Error
- 模糊反汇编器
- 使用build.rs生成mach.rs
- 从注释生成文档
- 使用error_chain crate
- 研究info->stop_vma
- 在Rust中重写copy_buffer
依赖关系
~0.4–270KB