lief-project / LIEF

LIEF - Library to Instrument Executable Formats
https://lief-project.github.io/
Apache License 2.0
4.28k stars 599 forks source link

Python API missing `set_resources()` #1048

Open iler-dev opened 2 months ago

iler-dev commented 2 months ago

Describe the bug The python API lacks a binding for the C++ method Binary::set_resources() in regards to the PE binary. As such, it is not possible to add a resource tree to a PE binary that does not already have one.

To Reproduce

import lief
binary = lief.parse("exe-with-no-resources.exe")

assert not binary.has_resources

binary.set_resources(lief.PE.ResourceDirectory()) # AttributeError

assert binary.has_resources

Expected behavior A way to invoke Binary::set_resources() through the python API to add a resource tree to a binary without one.

Environment (please complete the following information):

NOTICE

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

/NOTICE

romainthomas commented 2 months ago

Hi @iler-dev Yes this api is not exposed in Python because it is not enough stable.

iler-dev commented 2 months ago

Thanks for the quick response @romainthomas! Just for clarification, is just set_responses() that is considered unstable or the resources API's in general?

If it helps, I having been experimenting with set_resources() and I have not observed any bugs or issues with set_resources() or Lief in general in my testing so far.

romainthomas commented 2 months ago

The resource API for modification should be considered as unstable