5个版本
0.2.3 | 2023年5月30日 |
---|---|
0.2.1 | 2022年12月25日 |
0.2.0 | 2022年12月25日 |
0.1.1 | 2022年12月5日 |
0.1.0 | 2022年12月5日 |
#19 in #pe
41 每月下载次数
11MB
1K SLoC
包含 (DOS可执行文件, 11MB) etc/exe/ntoskrnl.exe
peview
针对PE32+文件格式的一个最小化且快速的零拷贝解析器。
目标
该项目旨在为解析PE32+文件格式提供一种更轻量级、更易于使用的替代方案,适用于功能齐全的二进制解析库。它通过以下方式实现:
- 采用零拷贝方法。一切都是对原始数据的引用
- 按需解析。基本解析在开始时进行,其余为可选
- 不关注字节序。假设解析的缓冲区为小端
- 根据官方规范严格验证原生结构
- 作为一个无外部依赖的
no-std
库
使用方法
打印导入符号的RVA和名称的示例
use peview::{dir::Import, file::PeView};
use std::{error::Error, fs::File, io::Read};
fn main() -> Result<(), Box<dyn Error>> {
// Read file into buffer and parse it
let mut buf = Vec::new();
File::open("etc/exe/ntoskrnl.exe")?.read_to_end(&mut buf)?;
let pe = PeView::parse(&buf)?;
// Iterate over modules in the import table
for m in pe.imports()? {
// Print the current modules name
let module = m?;
println!("{}", module.name()?);
// Iterate over symbols within the module
for i in module {
// Check if the symbol is imported by name
if let Import::Name(h, n) = i? {
// Print out both the hint and its name
println!("> {:#04x}: {}", h, n);
}
}
}
Ok(())
}
更多使用示例可以在这里找到。
安装
将以下行添加到您的Cargo.toml文件中
[dependencies]
# ...
peview = "0.2.3"