Crates.io | coffeeldr |
lib.rs | coffeeldr |
version | |
source | src |
created_at | 2024-10-08 14:20:23.59324 |
updated_at | 2024-10-08 23:16:31.185039 |
description | A COFF (Common Object File Format) loader written in Rust |
homepage | https://github.com/joaoviictorti/coffeeldr |
repository | https://github.com/joaoviictorti/coffeeldr |
max_upload_size | |
id | 1401255 |
Cargo.toml error: | TOML parse error at line 23, column 1 | 23 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
coffeeldr
is a modern and lightweight COFF (Common Object File Format) loader for Windows written in Rust, designed to run COFF files on Windows. It supports both 32-bit and 64-bit architectures and allows you to load and execute COFF files from files or memory buffers with Rust’s safety and performance guarantees.
Add coffeeldr
to your project by updating your Cargo.toml
:
cargo add coffeeldr
To load a COFF file from the filesystem:
use coffeeldr::CoffeeLdr;
let loader = CoffeeLdr::new("path/to/coff_file.o");
match loader {
Ok(ldr) => {
println!("COFF successfully loaded from file!");
// Execute the entry point or manipulate the COFF as needed
},
Err(e) => println!("Error loading COFF: {:?}", e),
}
To load a COFF from an in-memory buffer:
use coffeeldr::CoffeeLdr;
let coff_data = include_bytes!("path/to/coff_file.o");
let loader = CoffeeLdr::new(coff_data);
match loader {
Ok(ldr) => {
println!("COFF successfully loaded from buffer!");
// Execute the entry point or manipulate the COFF as needed
},
Err(e) => println!("Error loading COFF: {:?}", e),
}
Once the COFF file is loaded, you can execute it by specifying the entry point:
let coffee = CoffeeLdr::new("path/to/coff_file.o").unwrap();
coffee.run("entry_point_function_name", None, None).unwrap();
This method will search for the specified entry point and execute it.
coffeeldr
also provides a convenient CLI tool for interacting with COFF files directly from the command line.
Example Command:
coffee.exe --bof path/to/coff_file.o --entrypoint go
These are the types of parameters that the tool accepts for processing:
/short:<value>
: Adds a short (i16
) value./int:<value>
: Adds an integer (i32
) value./str:<value>
: Adds a string./wstr:<value>
: Adds a wide string./bin:<base64-data>
: Adds binary data decoded from base64
.Example command using ntcreatethread.o
:
coffee.exe --bof ntcreatethread.o --entrypoint go /int:4732 /bin:Y29mZmVlbGRy..
Another example using dir.o
:
coffee.exe --bof dir.o --entrypoint go /str:C:\
To contribute to coffeeldr, follow these steps:
git checkout -b <branch_name>
.git commit -m '<commit_message>'
.git push origin <branch_name>
.Alternatively, consult the GitHub documentation on how to create a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.