Crate object_rewrite
source ·Expand description
A library for rewriting object and executable files.
Use the Rewriter
struct to read a file, modify it, and write it back.
Modifications can be performed using methods on the Rewriter
struct, or
by passing an Options
struct to the Rewriter::modify
method.
Currently, only ELF files are supported, and not many modifications are possible yet.
§Example
use object_rewrite::{Options, Rewriter};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = Options::default();
options.delete_symbols.insert(b"main".to_vec());
let input = std::fs::read("path/to/input")?;
let mut rewriter = Rewriter::read(&input)?;
rewriter.modify(options)?;
let mut output = std::fs::File::create("path/to/output")?;
rewriter.write(&mut output)?;
Ok(())
}
Structs§
- Options for modifying an ELF file.
- An error that occurred while rewriting a file.
- Options for modifying a file.
- A rewriter for object and executable files.
Enums§
- The kind of error.
Type Aliases§
- The
Result
type for this library.