Crates.io | peview |
lib.rs | peview |
version | 0.2.3 |
source | src |
created_at | 2022-12-05 08:51:37.664005 |
updated_at | 2023-05-30 11:36:43.873148 |
description | A minimal and fast zero-copy parser for the PE32+ file format. |
homepage | |
repository | https://github.com/kedom1337/peview |
max_upload_size | |
id | 730102 |
size | 10,901,609 |
A minimal and fast zero-copy parser for the PE32+ file format.
This project aims to offer a more light weight and easier to use alternative to fully featured binary parsing libraries when it comes to parsing the PE32+ file format. It does so by:
no-std
libraryExample of printing the RVA's and names of imported symbols:
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(())
}
More usage examples can be found here.
Add the following line to your Cargo.toml file:
[dependencies]
# ...
peview = "0.2.3"