Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust API missing Binary Modification Documentation #1123

Open
a1rb0rn3 opened this issue Nov 4, 2024 · 0 comments
Open

Rust API missing Binary Modification Documentation #1123

a1rb0rn3 opened this issue Nov 4, 2024 · 0 comments
Assignees

Comments

@a1rb0rn3
Copy link

a1rb0rn3 commented Nov 4, 2024

Describe the bug
The rust API lacks documentation on how it can be utilized to modify or write PE files: e.g. lief::pe::Section to modify a binary by adding custom sections. I am not sure whether this is simply not documented or not implemented yet.

To Reproduce
I didn't get it to work on rust but for C++ the implementation would be (as described in the docs https://lief.re/doc/latest/formats/pe/index.html):

std::unique_ptr<LIEF::PE::Binary> pe;

LIEF::PE::Section section(".hello");
section.content = std::vector<uint8_t>(0x100, 0xCC);
pe->add_section(section);

pe->write("new.exe");

Expected behavior
A simple way to construct a new lief::pe:Section or a clear and concise description on how to utilize the Rust API (including the lief_ffi package???) to modify and write PE files by adding new sections.

I would expect something similar to this:

let mut pe: lief::pe::Binary;

let mut section = lief::pe::Section::new(".hello");
section.content = vec![0xCC; 0x100];
pe.add_section(section);

pe.write("new.exe");

Environment (please complete the following information):

  • System and Version : Ubuntu 22.04
  • Target format: PE
  • LIEF version: 0.15.1

Additional context
The Problem could still be layer 8 as I'm relatively new to rust :D

NOTICE

If the issue does not contain enough information to be reproduced,
it will be flagged as incomplete
and closed.

/NOTICE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants