Commit Graph

284 Commits

Author SHA1 Message Date
Romain Thomas 274d887e17 Update PE parser interface 2022-02-14 06:40:06 +01:00
Romain Thomas 50986fcaf1 Use a span interface 2022-02-13 10:39:38 +01:00
Romain Thomas 05e3c6eb7c Fix memory issues 2022-02-12 17:10:23 +01:00
Romain Thomas 77328b0071 Bump year 2022-02-08 21:16:25 +01:00
Romain Thomas e9782c5927 Clean & modernize LIEF code base
This commit (obviously non-atomic) cleans LIEF's code base by:
  - Using pointer semantics (`std::unique_ptr<>`)
  - Using LEAF boost error in the binary stream
  - Reducing the scope of the iterators (`it_section`, ...)
  - Removing `Structures.hpp` from the public headers
  - etc
2022-02-05 06:09:06 +01:00
Romain Thomas b730ec068d Hide the JSON implementation of LIEF
This commit removes the public include of nlohmann/json
as it is a *detail of implementation*. Instead, the public
API exposes:

```cpp
std::string to_json(...);
```

In addition, it enables to externally provide nlohmann/json using
the cmake option ``-DLIEF_OPT_NLOHMANN_JSON_EXTERNAL=on``.
For instance, this option can be used as follows:

```bash
$ cmake -DLIEF_OPT_NLOHMANN_JSON_EXTERNAL=on \
        -Dnlohmann_json_DIR=<PATH>/lib/cmake/nlohmann_json
```

Related to #605
2022-01-29 09:51:03 +01:00
rthomas a615adbee4 This commit cleans and modernizes the code base of LIEF.
Among the changes:

- It removes the ``and, or, not`` keywords
- It updates the Documentation
- It moves the internal structures in the ``details::`` namespace
2022-01-27 20:18:54 +01:00
Nicolas Iooss bb7faf3e72 Support setting ELF header identity from bytes
The following Python code currently fails with Python 3.9:

    import lief
    elf = lief.ELF.Binary("test", lief.ELF.ELF_CLASS.CLASS32)
    elf.header.identity = bytes.fromhex("7f454c46010101000000000000000000")

The reported error is:

    TypeError: b'\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00' is not supported!

It is possible to use `.decode()` to convert the bytes to string, or to
use `list(...)` to convert them to a list of integers. Both these
solutions work, but they are not as elegant as directly using `bytes`.

Modify the `identity` setter to support bytes. As `Header::identity_t`
is directly an array of `uint8_t`, casting it from `py::bytes` is
straightforward.
2022-01-24 23:18:20 +01:00
Romain Thomas 72ebe0d89e Refector the ELF builder 2022-01-22 13:23:52 +01:00
Romain Thomas 076bd5cd23 Resolve #644 2022-01-16 17:04:47 +01:00
hypervis0r e12dafbfc0 Add reserved PE data directory 2022-01-02 10:48:07 +01:00
Romain Thomas 47b8495973 Bump Pybind11 2021-12-24 12:04:13 +01:00
fanquake f080d582b6 Add RISCV architecture 2021-12-21 06:54:46 +01:00
Romain Thomas 92812dfe2e Redesign the configuration of the MachO parser 2021-12-18 12:05:30 +01:00
Romain Thomas b2fc5ba9be Update fields in PE::LoadConfiguration
It seems that on recent version on the SDK, Microsoft renamed the
field LoadConfiguration::reserved1 into DependentLoadFlags.

This commit create an alias on this field

Resolve #621
2021-10-19 05:27:33 +02:00
Dongdong Zhang 89ea7a12c6 Fix iterator performance issue 2021-10-12 11:24:37 +08:00
Dongdong Zhang f619864eca Fix broken python API doc for Android formats 2021-09-23 13:29:01 +00:00
lucam 9c70f05db9 MachO: add support for LC_FILESET_ENTRY by parsing fileset_entry_command and exporting them via sub Macho::Binary::filesets_ 2021-08-02 20:14:24 +02:00
Jasper Lievisse Adriaanse 5a4c94cbba Fix a few small textual mistakes 2021-06-22 17:50:57 +02:00
Romain Thomas 009306cedd Update section_from_{offset,va} to enable skipping SHT_NOBITS 2021-06-13 06:56:32 +02:00
Romain Thomas ddf5f4b82d Add PE imports/exports as abstracted symbols 2021-06-06 08:18:27 +02:00
Romain Thomas 1d63c60ee8 Add missing functions 2021-05-31 05:34:18 +02:00
Romain Thomas 672d73f1cb Add crashpad note 2021-05-30 20:38:30 +02:00
Romain Thomas d9303f682c Enable to add object relocations 2021-05-30 20:17:13 +02:00
Romain Thomas 8d5e3a0e82 Use PLATFORM::ANDROID_PLAT instead of PLATFORM::ANDROID 2021-04-01 16:27:08 +02:00
Romain Thomas 06aa75c085 Fix error 2021-03-29 08:00:46 +02:00
fanquake e83f812e5d add RISC-V machine type
Similar to #486, add the RISCV machine type to the ELF_ARCH enums.

EM_RISCV 243 RISC-V
2021-03-29 07:07:20 +02:00
Romain Thomas df653a6331 Add API to get the underlying platform 2021-02-27 10:11:40 +01:00
Romain Thomas 56f503ade0 Add an 'index' field for segment commands.
This new field aims to optimize the reconstruction of binding/rebase
opcodes.
2021-02-26 15:52:37 +01:00
Romain Thomas d0c30970eb Resolve #551 2021-02-24 07:00:17 +01:00
Romain Thomas d79b9f4e1f Return a pointer instead of a reference 2021-02-21 18:00:33 +01:00
Romain Thomas ae7b3436b3 Enhance the abstract layer 2021-02-16 06:56:10 +01:00
Daniel Firer b43d3fd6c8 Add support for DEX fields 2021-02-15 18:33:31 +01:00
Romain Thomas fda42077c4 Resolve #524 2021-02-04 18:21:44 +01:00
Romain Thomas 97ae54f6e1 Add api to select a Mach-O file from its architecture 2021-02-04 04:00:57 +01:00
Romain Thomas 7831e6113c add missing includes 2021-01-31 21:12:27 +01:00
Romain Thomas bb7a898eee Improve the way we access the list of flags 2021-01-31 16:00:41 +01:00
Romain Thomas e453b535a3 Add more information than just BAD_SIGNATURE 2021-01-30 21:34:29 +01:00
Romain Thomas fa423b7e0f Resolve #533 2021-01-23 20:07:22 +01:00
Romain Thomas a479b6ee6e Fix MacOS rpath 2021-01-18 16:58:13 +01:00
Romain Thomas 45263af2ce Enhance get_imphash function to compute the same imphash value as pefile
close #299
2021-01-17 17:54:35 +01:00
Romain Thomas 6720ed2385 Update copyright 2021-01-16 18:17:17 +01:00
Romain Thomas d29a74996b Process PKCS #9 counter signature and enhance signature verification 2021-01-16 09:44:51 +01:00
Romain Thomas bdf1264df9 Update doc & tests 2021-01-16 09:44:51 +01:00
Romain Thomas 53ce0cd7d4 Fix Windows issues 2021-01-16 09:44:51 +01:00
rthomas 634c2fc98e Enhance PE Authenticode 2021-01-16 09:44:51 +01:00
Romain Thomas 13222b6974 Fix #515 2021-01-04 09:56:19 +01:00
Romain Thomas 022ec6e998 Update strip 2020-12-23 09:46:09 +01:00
Romain Thomas 197b699951 Update strip command 2020-12-23 08:00:54 +01:00
Romain Thomas c365a533bc Update links 2020-12-20 14:19:04 +01:00