Compare commits

..
Author SHA1 Message Date
Romain Thomas 1623cdd47e WIP 2021-05-22 09:38:39 +02:00
Romain Thomas 3d4799a0c0 Use the same output name as the other platforms 2021-05-21 15:01:37 +02:00
Romain Thomas 3568445ab0 Update changelog 2021-05-19 14:34:31 +02:00
Romain Thomas 0bac240a30 Add build script for Apple M1 2021-05-19 14:32:09 +02:00
Romain 7eed525d88 Merge pull request #579 from xhochy/memoize_symbols_during_parse
MachO: Memoize Symbols by address and name during parsing
2021-05-19 14:28:58 +02:00
Uwe L. Korn 3eea5e7e4a MachO: Memoize Symbols by address and name during parsing 2021-05-18 17:48:11 +02:00
Romain 61a8b046de Merge pull request #578 from aguinet/pylief_export_symbols
Python bindings: export C++ LIEF symbols
2021-05-18 15:05:11 +02:00
Adrien Guinet 036e7fdaf0 Python bindings: export C++ LIEF symbols
This allows external libraries (like QBDL) to use the same C++ typeinfo
objects for LIEF, and hence having compatible "pybind11" LIEF objects
between the two libraries.
2021-05-16 12:17:50 +02:00
Romain Thomas d8bca167f8 Fix missing info 2021-05-10 17:15:03 +02:00
Romain Thomas a83333e09f Fix #576 2021-05-06 06:59:07 +02:00
Romain Thomas e3cafe67ea Update changelog 2021-05-03 16:46:36 +02:00
Romain Thomas d2ad8f6108 Enable to use pre-compiled version of spdlog 2021-05-03 11:25:49 +02:00
Romain Thomas ab93d302d2 Resolve #573 2021-05-03 08:41:34 +02:00
Romain Thomas 8cff9dcad9 Fix loader 2021-04-18 08:37:46 +02:00
Romain Thomas 0d51ea4e50 Fix test 2021-04-17 19:47:41 +02:00
Romain Thomas 26b3920527 Fix tests for Apple M1 2021-04-17 18:50:39 +02:00
Romain Thomas c7bbd74094 Improve arm64 detection (related to Apple M1) 2021-04-17 10:17:31 +02:00
Romain 158f291b1f Merge pull request #570 from Catminusminus/sizeof_headers
Fix sizeof_headers computing
2021-04-15 06:08:32 +02:00
Romain Thomas ffef01221d Improve code of symbol's builder 2021-04-14 07:20:24 +02:00
Yuki Mogi ab3f073ac0 fix computing sizeof_headers
Adding 1 to the size of this->data_directories_ and this->sections_ seems to be unnecessary. In this commit, the two '+1' are removed.
2021-04-13 15:49:02 +09:00
Romain Thomas e4baf52b4f Fix missing relocation 2021-04-11 15:01:00 +02:00
Romain Thomas 12c740905d Properly write section/segment names 2021-04-11 14:56:31 +02:00
Romain Thomas 94bbacd100 Remove unused variable 2021-04-11 14:55:48 +02:00
Romain Thomas 3b7b5a738d Enhance relocation output 2021-04-03 19:38:00 +02:00
Romain 92dac82cc5 Merge pull request #568 from pdreiter/issue_418
resolution for LIEF issue #418
2021-04-03 19:10:42 +02:00
Romain Thomas 8d5e3a0e82 Use PLATFORM::ANDROID_PLAT instead of PLATFORM::ANDROID 2021-04-01 16:27:08 +02:00
Pemma Reiter 24f4a5d954 resolution for LIEF issue #418
addresses boundary scenario for relocations whose
relative offsets abut segment_size
2021-03-31 21:02:29 -07:00
Romain b8422047e9 Merge pull request #566 from aguinet/mrproper/remove_not
Remove usage of "not" in public headers
2021-03-29 17:24:03 +02:00
Adrien Guinet b8e825b464 Remove usage of "not" in public headers
This unfortunately makes compilation of project using LIEF with
cl.exe-like compilers really painful. Including "iso646.h" seems like a
hack, and does not seem to work with recent VS2019 versions.
2021-03-29 11:07:17 +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 32abf75562 Merge pull request #563 from dgavedissian/ensure-cmake-current-binary-dir
Ensure to consistently use CMAKE_CURRENT_BINARY_DIR
2021-03-29 07:06:45 +02:00
David Avedissian 5eb19bafbf Ensure to consistently use CMAKE_CURRENT_BINARY_DIR
The main CMakeLists.txt file was using the CMAKE_BINARY_DIR variable instead of CMAKE_CURRENT_BINARY_DIR. This breaks projects which embed LIEF as a source dependency.
2021-03-28 22:11:34 +01:00
Romain Thomas 1a4a93c36f Update README 2021-03-20 07:56:07 +01:00
Romain Thomas 8a338e57b3 Remove unused variable 2021-03-20 07:55:18 +01:00
Clcanny e8503e031f Fix has_section_with_va and section_from_virtual_address 2021-03-20 07:43:28 +01:00
Romain Thomas 9cf2ec87fa Remove unused includes 2021-03-11 06:02:37 +01:00
Romain Thomas 611ce0c5e0 Enable Profiler to inspect protected/private members 2021-03-10 09:08:40 +01:00
Romain Thomas 2aa87f656c Update changelog 2021-03-10 07:44:46 +01:00
Romain Thomas 923ecaa256 Fix missing bound check 2021-03-09 18:50:50 +01:00
Romain Thomas e875a8ffa2 Use abstract stream 2021-03-06 18:08:20 +01:00
Romain Thomas 9e084e64ff Update changelog 2021-03-02 04:47:02 +01:00
Romain Thomas d25b4d20a8 Add check on the signature size 2021-03-02 04:38:59 +01:00
Romain Thomas 3903034b78 Fix missing condition 2021-02-27 19:44:01 +01:00
Romain Thomas 8bb11a2efa Use different sinks depending on the platform 2021-02-27 18:58:22 +01:00
Romain Thomas dbbb952535 Prefer reinterpret_cast 2021-02-27 18:44:07 +01:00
Romain Thomas 66c772209b Disable spdlog exceptions and thread on iOS 2021-02-27 18:41:27 +01:00
Romain Thomas 2ec24125e6 Add in-memory stream 2021-02-27 17:41:20 +01:00
Romain Thomas e0b0814859 Add typing 2021-02-27 16:08:48 +01:00
Romain Thomas 5db3eb15f7 Remove the entry from the cache 2021-02-27 16:08:33 +01:00
Romain Thomas 42ca36844e Fix typo 2021-02-27 15:38:52 +01:00
Romain Thomas 23ec99d01c Improve the way we get segment from offset 2021-02-27 15:33:55 +01:00
Romain Thomas 29e4a07016 Update README 2021-02-27 11:06:37 +01:00
Romain Thomas df653a6331 Add API to get the underlying platform 2021-02-27 10:11:40 +01:00
Romain Thomas 70ac0a727f Use the abstraction of binary stream 2021-02-27 08:34:57 +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 530827a0f0 Fix error 2021-02-24 08:02:08 +01:00
Romain Thomas f39695b6b3 Fix error 2021-02-24 07:35:26 +01:00
Romain Thomas d0c30970eb Resolve #551 2021-02-24 07:00:17 +01:00
Romain Thomas 31a3b3b34b Optimization to avoid iterating over all the load commands 2021-02-22 21:32:05 +01:00
Romain Thomas d483b2b2f1 Fix style 2021-02-22 21:14:19 +01:00
Romain Thomas 136dea5fde Use absolute link 2021-02-22 20:07:24 +01:00
Romain Thomas 163fa1c42c Update changelog 2021-02-22 15:18:33 +01:00
Romain Thomas c28c195d1b Pass Mach-O segments as a parameter 2021-02-22 11:27:21 +01:00
Romain Thomas d8f452967e Cache heavily used commands 2021-02-21 20:42:32 +01:00
Romain Thomas d79b9f4e1f Return a pointer instead of a reference 2021-02-21 18:00:33 +01:00
Romain Thomas 10c5b0a190 Forward APPVEYOR_REPO_TAG_NAME 2021-02-21 16:03:35 +01:00
Romain Thomas 05103f55a6 Resolve #548 2021-02-21 11:52:33 +01:00
Romain Thomas ff629b5642 Handle content between two sections that is not wrapped by a section 2021-02-21 11:49:06 +01:00
Romain Thomas 8d874a023b Do not trunc section's name on a null char
If the section's name contains bytes after the null char, they should
be considered while computing the authentihash.
2021-02-21 11:42:30 +01:00
Romain Thomas f8c0d63ba3 Do not take account sections with empty content 2021-02-21 11:41:46 +01:00
Romain Thomas 3c65ffe2d6 The last data directory might not be null
See: bc203f2b6a928f1457e9ca99456747bcb7adbbfff789d1c47e9479aac11598af
2021-02-21 11:39:50 +01:00
Romain Thomas 2a197a23d7 Change dynamic_cast into reinterpret_cast 2021-02-17 20:45:51 +01:00
Romain Thomas ae7b3436b3 Enhance the abstract layer 2021-02-16 06:56:10 +01:00
Romain Thomas 49ab06b107 Update changelog 2021-02-15 18:38:53 +01:00
Daniel Firer b43d3fd6c8 Add support for DEX fields 2021-02-15 18:33:31 +01:00
Romain 3d7802aaac Merge pull request #545 from junghee/master
Fix parse_dynamic_entries to stop iterating at DT_NULL
2021-02-15 18:17:28 +01:00
Junghee Lim de7492ee49 Add dynamic_entry for DT_NULL
Also, update the baseline of the number of dynamic entries.
2021-02-11 14:17:59 -05:00
Junghee Lim dbee1f9efe Rename end_of_dynamic_section to end_of_dynamic 2021-02-11 13:11:17 -05:00
Junghee Lim 97a6546af0 Fix parse_dynamic_entries to stop iterating at DT_NULL
Previously, parse_dynamic_entries iterates the entire dynamic segment.
Ideally, it needs to only iterate dynamic section for dynamic entries.
This fix uses DT_NULL, which marks end of dynamic section.
2021-02-11 12:46:54 -05:00
Romain Thomas 67afb7b93d Add default case 2021-02-11 14:33:49 +01:00
Romain Thomas fce157b45f Fix related to #540 2021-02-10 19:37:51 +01:00
Romain Thomas 5bbbdad5f8 Use raw pointer instead of std::function 2021-02-05 11:08:57 +01:00
Romain Thomas fda42077c4 Resolve #524 2021-02-04 18:21:44 +01:00
Romain Thomas 89bbe0deb2 Fix #542 2021-02-04 18:12:40 +01:00
Romain 11540055c7 Merge pull request #543 from j-jorge/replace-maps-with-switches
Use switch/case statements instead of look-up tables for ordinals_lookup_tables
2021-02-04 17:52:20 +01:00
Julien Jorge a73ab46531 Use switch/case statements instead of look-up tables for ordinals_lookup_tables. 2021-02-04 08:22:27 +01:00
Romain Thomas 51d258f95b Update changelog 2021-02-04 04:19:53 +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 2737c05837 Fix typo 2021-02-02 17:27:43 +01:00
Romain Thomas 4aac4dc067 Fix condition 2021-02-02 09:46:08 +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
Charles 3d0da01f7f Fix bug of unittest (related to #507) 2021-01-31 11:09:42 +01:00
Romain 3d10658455 Merge pull request #538 from booti386/master
api-c: Protect bool typedef from duplicate declaration.
2021-01-30 21:36:29 +01:00
Romain Thomas e453b535a3 Add more information than just BAD_SIGNATURE 2021-01-30 21:34:29 +01:00
Romain Thomas e541b5f5b7 Fix missing env variable 2021-01-26 21:47:06 +01:00
Romain Thomas 3e4c3ae3a0 update auditwheel command 2021-01-26 21:13:33 +01:00
Romain Thomas 0260b2f534 Fix typo 2021-01-26 20:38:31 +01:00
Guillaume Charifi 15fcfc37cc api-c: Protect bool typedef from duplicate declaration.
bool is defined as a macro since C99.
2021-01-26 19:37:14 +01:00
Romain Thomas 2317898f36 Update Linux CI 2021-01-26 19:34:20 +01:00
Romain Thomas b1e1a44d49 Fix error on Appveyor 2021-01-24 11:32:15 +01:00
Romain Thomas f8543381b9 Fix typo 2021-01-24 09:51:32 +01:00
Romain Thomas d15defefe7 Resolve #532 2021-01-23 20:52:55 +01:00
Romain Thomas fa423b7e0f Resolve #533 2021-01-23 20:07:22 +01:00
Romain Thomas fd8af3ac00 Fix typo 2021-01-22 11:19:53 +01:00
Romain Thomas 97bd4aba91 Update version 2021-01-19 06:51:48 +01:00
Romain Thomas 14c15dec87 Fix typo 2021-01-18 20:35:53 +01:00
Romain Thomas 2cf38a7a8e Bump version 2021-01-18 20:29:39 +01:00
Romain Thomas f58605f94c Fix deployment on tag 2021-01-18 18:10:01 +01:00
Romain Thomas a348a12b36 Disable release from CI 2021-01-18 16:58:25 +01:00
Romain Thomas a479b6ee6e Fix MacOS rpath 2021-01-18 16:58:13 +01:00
Romain Thomas 9974da21ed Forward CXXFLAGS and CFLAGS 2021-01-18 16:25:29 +01:00
Romain Thomas 5b7e6978b9 Fix new line 2021-01-18 09:34:48 +01:00
Romain Thomas f8a3f4f8b5 Update compiler flags 2021-01-18 09:34:08 +01:00
Romain Thomas 1aff75d33f Fix warning 2021-01-18 08:11:42 +01:00
Romain Thomas 62a2e8e8c6 Resolve #525 2021-01-18 04:55:34 +01:00
Romain Thomas 27547aec33 Remove padding entry from the rich header 2021-01-17 18:52:51 +01:00
Romain Thomas 6e703014f6 Fix typo 2021-01-17 18:00:03 +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 9851421392 Remove extra ; 2021-01-16 11:54:04 +01:00
Romain Thomas bc92f0c3f9 Fix PPC doc 2021-01-16 11:46:38 +01:00
Romain Thomas 75846c5ec6 Fix table 2021-01-16 11:45:09 +01:00
Romain Thomas 1587cf5f2d Update un supported oids 2021-01-16 10:02:32 +01:00
Romain Thomas 4b9416731b Update documentation 2021-01-16 09:44:52 +01:00
Romain Thomas 8511b606d2 Add authenticode example 2021-01-16 09:44:52 +01:00
Romain Thomas 9b49d5d4ab Fix test 2021-01-16 09:44:51 +01:00
Romain Thomas e6c606e78a Update tests 2021-01-16 09:44:51 +01:00
Romain Thomas d29a74996b Process PKCS #9 counter signature and enhance signature verification 2021-01-16 09:44:51 +01:00
Romain Thomas e4d2da1fd5 Fix error 2021-01-16 09:44:51 +01:00
Romain Thomas e56fae238d Fix comma 2021-01-16 09:44:51 +01:00
Romain Thomas caac866496 Fix python 37 2021-01-16 09:44:51 +01:00
Romain Thomas 536f24a91b Fix volume 2021-01-16 09:44:51 +01:00
Romain Thomas 153f46bb7a Fix multi-lines 2021-01-16 09:44:51 +01:00
Romain Thomas 852b507491 Add Linux x86-64 action 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
Romain Thomas ec9115a3d1 Fix windows and python 3.7 2021-01-16 09:44:51 +01:00
rthomas 634c2fc98e Enhance PE Authenticode 2021-01-16 09:44:51 +01:00
Romain Thomas 5b587ea88f Update changelog 2021-01-16 09:44:41 +01:00
Romain d1ad5ab1de Merge pull request #522 from kohnakagawa/fix/elf_enum_to_string
Fix the number of entries of MIPS_RELOCS
2021-01-15 07:42:32 +01:00
Koh M. Nakagawa 820dd28905 fix the number of entries 2021-01-15 14:39:27 +09:00
Romain Thomas 846978474c Add linux x86-64 workflow 2021-01-14 09:27:54 +01:00
Romain Thomas 40052253ef Add missing PPC entries 2021-01-14 05:54:54 +01:00
Romain Thomas 1e914cd86e Add ddisam 2021-01-14 05:54:39 +01:00
Romain Thomas cd286e1c08 Update doc 2021-01-07 08:43:11 +01:00
Romain Thomas fa9e340842 Enable CI as 'romainthomas' 2021-01-06 06:50:10 +01:00
Romain Thomas 0a76b87d91 Update changelog according to postponed PR 2021-01-06 06:25:32 +01:00
Romain Thomas 2b01a2d086 Merge branch 'pr/519' 2021-01-06 06:19:08 +01:00
Andrew Chow 8f46263c17 Calculate MachO binary available_command_space_
This value was always set to 0, so space would always be allocated in
the binary for more commands. However it is not necessary to do this as
there will often be space available. This commit adds a simple way to
calculate that during parsing.

This method is taken from Apple's cctools package, specifically the
codesign_allocate tool. See https://github.com/tpoechtrager/cctools-port/blob/466063c7f7486762a5a8f0d98c48dc5ffbe42f74/cctools/misc/codesign_allocate.c#L861
2021-01-06 06:18:43 +01:00
Romain Thomas 90a781baac Fix condition 2021-01-05 13:35:12 +01:00
Romain Thomas bbe04d0e28 Backport Conan fixes.
See: https://github.com/conan-io/conan-center-index/commit/28e84b9c5f3831e3a00fd7686eeeda8c77832b7e
2021-01-05 11:17:39 +01:00
Romain Thomas 8b1d101a8f Fix variable name conflict 2021-01-04 18:31:33 +01:00
Romain Thomas 541cd5b0d9 Update badges 2021-01-04 11:14:13 +01:00
Romain Thomas 65e36a6650 Update FindLIEF 2021-01-04 10:50:12 +01:00
Romain Thomas c30a580d6b Add Mobile-Security-Framework-MobSF 2021-01-04 10:49:46 +01:00
Romain Thomas 13222b6974 Fix #515 2021-01-04 09:56:19 +01:00
Romain Thomas 42745373ef Update deployment script 2021-01-03 20:33:54 +01:00
Romain Thomas a7967a6827 Update doc 2021-01-03 19:55:16 +01:00
Romain Thomas f4fc5784af Enhance CI & platforms 2021-01-03 17:52:44 +01:00
Romain Thomas 64481662f5 Update nightly install command 2021-01-03 11:56:37 +01:00
Romain eccc0bbc61 Merge pull request #513 from aguinet/feature/fatmacho_take
Fat MachO: API to "take" a binary from the fat MachO object
2020-12-31 07:03:56 +01:00
Adrien Guinet 99f868b1b7 Fat MachO: API to "take" a binary from the fat MachO object
This gives ownership to the caller, and remove the LIEF::Binary object
from the FatMachO one.
2020-12-30 18:44:13 +01:00
Romain Thomas 6fe83ec826 Fix missing when releasing sdist 2020-12-29 13:28:04 +01:00
Romain Thomas 933b9492a0 Fixes 2020-12-24 20:51:46 +01:00
Romain Thomas d35ac6c48f Fix to support AArch64 cross-compilation 2020-12-24 20:19:36 +01:00
Romain Thomas 022ec6e998 Update strip 2020-12-23 09:46:09 +01:00
Romain Thomas a4682e0329 Update changelog 2020-12-23 09:41:23 +01:00
Romain Thomas a9fea192b1 Update doc 2020-12-23 09:40:16 +01:00
Romain Thomas 197b699951 Update strip command 2020-12-23 08:00:54 +01:00
Romain Thomas f8bd135057 Update dependencies 2020-12-23 07:37:39 +01:00
Romain Thomas ce58df93d8 Update doc build system
It enables to build documentation out-of-tree. It also introduces the
following build targets:

- lief-doc
- lief-doxygen
- lief-sphinx
- lief-quick-sphinx

See doc/CMakeLists.txt for the details
2020-12-23 07:10:17 +01:00
Romain Thomas 51305e205e Revert "Sort dynamic symbols"
This reverts commit 50a348e7f0.
2020-12-21 16:02:19 +01:00
Romain Thomas ca80be352e Fix typo 2020-12-21 15:55:25 +01:00
Romain Thomas db9ffbb61c Fix modular compilation 2020-12-21 08:37:08 +01:00
Romain Thomas c365a533bc Update links 2020-12-20 14:19:04 +01:00
Romain Thomas e509528896 Update python setup config 2020-12-19 06:37:53 +01:00
Romain Thomas 576d791f80 Update doc 2020-12-18 18:55:09 +01:00
Romain Thomas 01c33053ab Add commit attribute 2020-12-17 19:33:11 +01:00
Romain Thomas 9d1635ef72 Fix Travis
skip appveyor
2020-12-17 09:12:13 +01:00
Romain Thomas e59c7a992d Update CI 2020-12-17 08:23:32 +01:00
Romain Thomas 749241db92 Update changelog 2020-12-16 16:22:23 +01:00
Romain 1feefec9f8 Merge pull request #510 from mkomet/android_enums
added ELF enums for Android relocations and special compiler sections
2020-12-16 16:20:46 +01:00
Romain Thomas f17cb09269 Update doc 2020-12-16 16:16:36 +01:00
Meir Komet 9dd641d380 added ELF enums for Android relocations and special compiler sections 2020-12-12 00:48:32 -08:00
Romain Thomas 623055b045 Setup sccache 2020-12-12 08:31:52 +01:00
Romain Thomas 1fecc1b147 Remove fast finish 2020-12-11 11:24:07 +01:00
Romain Thomas fe953c16ff Fix fast finish 2020-12-11 11:23:29 +01:00
Romain Thomas ae8f262c7c Setup Python 3.9 in appveyor 2020-12-11 11:22:21 +01:00
Romain Thomas fe6f2a08d6 Comment until the CI is fixed (related to #507) 2020-12-11 11:14:16 +01:00
Romain Thomas d484fc89d0 Use sphinx role for the issues 2020-12-11 07:34:35 +01:00
Romain Thomas 3613f476fe Merge branch 'pr/507' 2020-12-11 07:26:38 +01:00
Romain Thomas 413feff355 Update changelog 2020-12-11 07:26:27 +01:00
Charles 50a348e7f0 Sort dynamic symbols 2020-12-11 11:23:38 +08:00
Romain ae67fbef17 Merge pull request #506 from Clcanny/charles-add-set-section-in-relocation-pull-request
Add section method to set section_ in class Relocation in ELF
2020-12-06 18:48:01 +01:00
Charles 24a07e23cc Add section method to set section_ in class Relocation in ELF 2020-12-06 17:31:59 +08:00
Romain 2fe4002699 Update README.md 2020-12-05 12:24:34 +01:00
Romain 2c93d12cfc Update README.md 2020-12-05 12:15:37 +01:00
Romain Thomas 8751eda888 Enable tests in github actions 2020-12-05 12:00:14 +01:00
Romain Thomas 1c35015b42 Remove dir 2020-12-05 11:53:27 +01:00
Romain fee1271157 Create windows.yml 2020-12-05 11:33:30 +01:00
Romain Thomas 03ba40b735 Setup Ninja for windows 2020-12-05 11:30:53 +01:00
Romain Thomas d1a7b81120 Set log output on stderr
Resolve #503
2020-12-05 07:23:59 +01:00
Charles 588a7a3a04 Sort ELF static symbols in Builder 2020-11-28 06:47:35 +01:00
Romain 533b74d551 Merge pull request #497 from Clcanny/charles-dont-relocation-when-extend-not-loaded-section-pull-request
Don't do relocation and etc. when extend not loaded section.
2020-11-28 06:41:07 +01:00
Romain 4de7fd2050 Merge pull request #498 from kwarrick/kwarrick/find-package
Simplify find_package mechanics
2020-11-28 06:34:08 +01:00
Kevin Warrick d11149b03d Generate LIEFConfig and LIEFConfigVersion 2020-11-26 13:36:12 -05:00
rthomas f0bddc0001 Change verbosity of some functions 2020-11-25 07:40:55 +01:00
Charles ad055a155f Fix bug: "Unable to find the segment associated with the address" in Binary::extend. 2020-11-25 14:40:20 +08:00
rthomas 2145d79efb Include according to config 2020-11-21 20:22:41 +01:00
rthomas b49786fd03 Resolve #492 2020-11-20 06:45:34 +01:00
rthomas 294428973a Clean Mach-O headers 2020-11-20 06:43:12 +01:00
rthomas 3b7c8fb203 Clean ELF headers 2020-11-20 06:42:23 +01:00
rthomas 8872b85fc7 Cleanup PE headers 2020-11-19 07:45:10 +01:00
rthomas 957929348b Fix check 2020-11-18 16:56:24 +01:00
rthomas 1538a55b97 Handle corrupted DLL name 2020-11-18 16:49:37 +01:00
rthomas f0ee03543b WIP 2020-11-18 16:49:37 +01:00
rthomas acb108602d Log 2020-11-18 16:49:37 +01:00
rthomas 8a72f4310e Update documentation & python bindings 2020-11-18 13:07:21 +01:00
Antonio Flores Montoya a49fb73f74 add mips relocations. 2020-11-18 13:07:15 +01:00
rthomas 44e072da15 Handle python utf-16 conversion in LangCodeItem values 2020-11-17 18:18:48 +01:00
rthomas d2218e549d Fix logging doc 2020-11-17 18:18:10 +01:00
rthomas 9c399e603c Fix permission issue 2020-11-11 11:36:03 +01:00
rthomas bee7a0bb86 Fix dockerfile 2020-11-11 10:18:46 +01:00
rthomas b224217bfe Remove cppcheck (to be replaced with clang-tidy) 2020-11-11 07:15:38 +01:00
rthomas 92181c8d51 Fix deps 2020-11-11 07:13:55 +01:00
rthomas 2bfd277360 Revert Python 3.9 on Windows 2020-11-10 18:30:00 +01:00
rthomas 43a223b70f Package json.hpp into third-party directory 2020-11-10 17:52:34 +01:00
rthomas 24d89a1315 Lint 2020-11-10 17:21:28 +01:00
Romain 122e6ab443 Merge pull request #487 from aeflores/add-mips-abstract
add mips to the elf architecture mapping.
2020-11-10 16:54:10 +01:00
rthomas ab4df2db1e Re-enable other python versions 2020-11-10 16:48:12 +01:00
rthomas ad6189e38c Enable Python 3.9 on Appveyor 2020-11-10 16:47:23 +01:00
Antonio Flores Montoya f2151dbe41 add mips to the elf architecture mapping. 2020-11-10 10:44:39 -05:00
rthomas a35a97aa83 Log improvements 2020-11-10 06:32:12 +01:00
rthomas 1364f22c78 Improve logging interface 2020-11-09 21:02:50 +01:00
rthomas 044f3d992c Merge branch 'pr/486' 2020-11-07 15:46:58 +01:00
Meir Komet 1851382170 added eBPF file support (compiled to ELF, via new llvm support) 2020-11-07 15:46:28 +01:00
rthomas c02bfee0e6 Add ftime-tracing script 2020-11-07 15:45:03 +01:00
Romain a76eb4a4f9 Merge pull request #483 from rafael-santiago/master
Changing library artifact suffix take into consideration CRT choice on MSVC based builds
2020-11-06 17:03:03 +01:00
rafael-santiago 7b5e8503d6 Changing library artifact suffix...
...take into consideration CRT choice on MSVC based builds.
2020-11-05 09:37:16 -03:00
rthomas b8a6c68731 Add test for empty gnu hash 2020-11-04 15:42:14 +01:00
rthomas b90d3c433d Update changelog & references 2020-11-04 14:50:42 +01:00
rthomas 1381f9a115 Force rebuild GNU hash table even though it's empty 2020-11-04 14:26:58 +01:00
rthomas dc31e15fc9 Fix #477 according to @Clcanny fix 2020-11-04 14:18:36 +01:00
rthomas d84f190790 Fix #479 2020-11-04 11:30:49 +01:00
rthomas 437fbeb3ea Update changelog 2020-10-22 14:50:14 +02:00
rthomas 3d9b84c6ec Add support for Python 3.9 2020-10-22 14:48:27 +02:00
rthomas 3bd530b880 Resolve #476 2020-10-15 09:14:18 +02:00
rthomas 1390f8b090 Add method to query binary's virtual size 2020-10-12 16:25:33 +02:00
rthomas 2d0005dc60 Unify GuardFlags 2020-10-11 20:18:20 +02:00
rthomas d6753b17c5 Fix error 2020-10-10 11:01:05 +02:00
rthomas 2e65a94b7c Export binding's original offset 2020-10-09 18:42:52 +02:00
rthomas a7921647cf Update OSX versions 2020-10-09 13:21:15 +02:00
Romain 96632324c3 Merge pull request #474 from 0xced/fix_fatbinary_segfault
Fix segmentation fault when accessing the raw data of a FatBinary
2020-10-09 08:45:48 +02:00
Cédric Luthi 4d4ef09e8e Fix segmentation fault when accessing the raw data of a FatBinary
Here is how to trigger the segmentation fault:

```cpp
#include <iostream>
#include <LIEF/MachO.hpp>

int main(int argc, const char * argv[])
{
    std::string path = "/usr/bin/yes";
    std::unique_ptr<LIEF::MachO::FatBinary> fat_binary = LIEF::MachO::Parser::parse(path);
    std::vector<uint8_t> raw = fat_binary->raw();
    std::cout << path << " size: " << raw.size() << std::endl;
    fat_binary.reset();
    return 0;
}
```

The `build()` method must not be called when the `Builder` is initilaized with a `FatBinary` because `this->binary_` is null (which causes the segmentation fault when accessing `this->binary_->is64_`). Anyway, calling `get_build()` is enough since `build()`or `build_fat()` is already called in the constructors of the `LIEF::MachO::Builder` class.

Before this commit:

```
./a.out
[1]    37481 segmentation fault  ./a.out
```

Afer this commit:

```
./a.out
/usr/bin/yes size: 30944
```
2020-10-08 10:28:11 +02:00
rthomas f8f353b5ed Fix 2020-10-04 21:30:21 +02:00
rthomas de766d3165 Fix python version 2020-10-04 21:00:53 +02:00
rthomas 1663ebd843 Fix typo 2020-10-04 19:54:09 +02:00
rthomas c6a2b93628 Trigger with Linux/3.8 2020-10-04 19:42:35 +02:00
rthomas ab3557654e Update changelog 2020-09-28 06:39:52 +02:00
Romain 7884e57aa1 Merge pull request #469 from aguinet/fix/lief_tuto_bin2lib
Enhance the bin2lib tutorial to support new glic versions
2020-09-28 06:34:52 +02:00
Adrien Guinet 48f72bd036 Enhance the bin2lib tutorial to support new glic versions
Glibc >= 2.29 versions do not allow the loading of a PIE binary with
dlopen. Explain this and how to workaround it.

An associated PR for https://github.com/lief-project/tutorials/ is
incoming
2020-09-27 11:52:02 +02:00
rthomas 1a416ea365 Fix reconstruction issue when the binary is prelinked
Resolve issue #466
2020-09-26 17:34:12 +02:00
rthomas 9e6902c19c Fix .eh_frame parsing issue 2020-09-26 12:24:53 +02:00
rthomas 013a3861c0 Setup cmake configuration as RelWithDebInfo when building in debug mode 2020-09-26 11:17:03 +02:00
rthomas 61e93d71f2 Add missing enum string 2020-09-25 20:13:13 +02:00
rthomas e0457bd779 Add DF_1_PIE 2020-09-25 16:47:41 +02:00
rthomas 081ec5c0e9 Add DF_1_PIE enum 2020-09-23 13:33:42 +02:00
Romain c31e7b4c3b Merge pull request #459 from kohnakagawa/fix/msvc_warning
Fix C4146 error when building LIEF with MSVC
2020-09-01 12:56:08 +02:00
Koh M. Nakagawa 32ad568691 Fix to remove C4146 errors 2020-08-31 16:54:22 +09:00
Romain f955a6bc0c Merge pull request #458 from metaverse-systems/fix-include-dir-pkgconfig
Fixes incorrect include directory in pkgconfig file.
2020-08-28 09:27:38 +02:00
Tim Schwartz 390d140fed Fixes incorrect include directory in pkgconfig file. 2020-08-27 15:34:54 -05:00
rthomas 19e06755e8 Fix 449 2020-08-27 11:14:32 +02:00
rthomas 5f26216f90 Resolve #455 2020-08-27 09:59:59 +02:00
Romain 4881c6f5c4 Merge pull request #456 from metaverse-systems/add-pkgconfig-file
Generates LIEF.pc and installs in /lib/pkgconfig/
2020-08-27 09:27:16 +02:00
Tim Schwartz 5fed2461a9 Generates LIEF.pc and installs in /lib/pkgconfig/ 2020-08-26 08:16:21 -05:00
Romain 4db8cf8b30 Merge pull request #453 from benjamb/benbrown/fix-404
Fix module entry point declaration (fixes #404)
2020-08-25 15:44:36 +02:00
rthomas 9f1bebb0ff Fix UTF8 (by @tacesrever) 2020-08-25 11:20:16 +02:00
rthomas 2348eb4d82 Fix missing undef (by @tacesrever) 2020-08-25 11:20:07 +02:00
rthomas 6e5a4937d4 Fix win32 build option (by @tacesrever) 2020-08-25 11:19:08 +02:00
Ben Brown cbad2be774 Re-enable the Windows python 3.8 build 2020-08-24 22:14:31 +01:00
Ben Brown 5e9053988f Fix module entry point declaration
Explicit definition of a py::module was only required when using the
deprecated PYBIND11_PLUGIN macro; remove this as the second argument of
the PYBIND11_MODULE macro will define the variable.

Set the docstring as appropriate.

Fixes #404.
2020-08-24 22:14:26 +01:00
Romain a81ee63e11 Merge pull request #445 from kohnakagawa/fix/escape_all_strings
Update mbedtls version to fix #395.
2020-08-24 08:01:46 +02:00
rthomas 672c539e73 Use mbedtls github version 2020-08-24 07:24:14 +02:00
Romain 346574132c Merge pull request #443 from kohnakagawa/feature/parse_resource_accelerators
Add parser for resource accelerator
2020-08-24 07:18:44 +02:00
Koh M. Nakagawa 1fd42b4ebf Add parser for resource accelerator
Signed-off-by: Koh M. Nakagawa <tsunekou1019@gmail.com>
2020-08-24 07:15:04 +02:00
Romain 10f0a2857f Merge pull request #444 from kohnakagawa/feature/parse_resource_html
Fix to parse html resource
2020-08-24 07:09:21 +02:00
Romain 6ae4915127 Merge pull request #448 from intelligide/patch-1
Fix for VS 2015
2020-08-24 07:05:36 +02:00
Yoann Potinet e287ad9447 FIx for VS 2015 2020-08-01 21:58:39 -04:00
Koh M. Nakagawa 653f8a1c35 Update mbedtls version to fix #395. Additionaly, escaping non-ascii strings to avoid crash of lief.to_json
Signed-off-by: Koh M. Nakagawa <tsunekou1019@gmail.com>
2020-07-23 14:54:31 +09:00
Koh M. Nakagawa eb87ca6ef6 fix to parse html resource
Signed-off-by: Koh M. Nakagawa <tsunekou1019@gmail.com>
2020-07-06 22:01:47 +09:00
Romain 4bbe410333 Merge pull request #433 from Wind3x/patch-1
Fix has_exceptions to check exception table
2020-07-05 12:22:56 +02:00
Romain 20f9d04ae8 Merge pull request #432 from kohnakagawa/feature/parse_resource_string
fix ResourcesManager to parse string table entry
2020-07-05 12:22:18 +02:00
Wind3x 04c18f851e Fix has_exceptions to check exception table
Change has_exceptions to check the exception table instead of the export table.
2020-06-25 13:24:46 -07:00
Koh M. Nakagawa 96e6fc66ad fix ResourcesManager to parse string table entry
Signed-off-by: Koh M. Nakagawa <tsunekou1019@gmail.com>
2020-06-26 01:18:58 +09:00
Romain ddc8b72e6b Merge pull request #426 from kohnakagawa/fix/segfault_gil_release
improve #400
2020-06-06 06:43:35 +02:00
Koh M. Nakagawa 1a7f8c41eb fix to avoid SIGSEGV 2020-06-01 22:34:31 +09:00
Romain a69f4b0867 Merge pull request #424 from kohnakagawa/fix/wrong_reloc_enum
fix wrong EnumToString
2020-05-28 06:30:41 +02:00
Koh M. Nakagawa 38f48a6e12 fix wrong EnumToString 2020-05-28 06:26:29 +02:00
Romain 2faa591440 Merge pull request #423 from kohnakagawa/fix/parse_corrupted_version_resources
fix to handle exceptions in json_dump of ResourcesManager
2020-05-28 06:23:40 +02:00
Romain caa767f26f Merge pull request #422 from kohnakagawa/fix/add_symbols_record_in_to_json
add some missing records in json dump
2020-05-28 06:21:51 +02:00
Romain e6c7e2af9e Merge pull request #421 from kohnakagawa/fix/parse_corrupted_symbols
add stream buffer size limit
2020-05-28 06:21:15 +02:00
Romain 565593dade Merge pull request #420 from kohnakagawa/fix/handle_empty_dialog
fix to parse the files that have empty dialogs and langs
2020-05-28 06:20:42 +02:00
Romain 67f04bfd38 Merge pull request #419 from kohnakagawa/fix/handle_empty_group_icon
fix to avoid SIGSEGV while parsing the file that has an empty group icon
2020-05-28 06:20:05 +02:00
Koh M. Nakagawa c38f3fc7dd fix to handle empty dialog 2020-05-28 10:23:10 +09:00
Koh M. Nakagawa 2e2818c837 add symbols record in to_json 2020-05-27 00:17:51 +09:00
Koh M. Nakagawa f1aa89f435 add stream buffer size limit 2020-05-26 23:58:00 +09:00
rthomas ee45d512d8 Disable circle-ci 2020-05-24 06:49:10 +02:00
rthomas e0656480cf Update changelog 2020-05-24 06:47:15 +02:00
rthomas 5684960317 Update dependencies 2020-05-24 06:47:15 +02:00
rthomas da371b3780 Fix const-ness 2020-05-23 20:46:35 +02:00
Romain 26ae54a175 Merge pull request #413 from JanuszL/optimization
This PR introduces several performance optimizations for the binary write/build process
2020-05-22 10:14:10 +02:00
Janusz Lisiecki 1e0c4e81d4 This PR introduces several performance optimizations for the binary write/build process
- it changes the way how the number of symbols is reduced and how offsets to names are calculated.
  Instead of n^2 algorithms, it introduces nlog(n) algorithm.
  When the symbols optimization step is performed map<symbol_name, offset_to_name>
  is created so it saves another n^2 pass
- a couple of performance improvements to filter_iterator - from pre to post incrementation
  to save an unneeded copy, memoization of end iterator as the compiler cannot do it on its own
  and recreates it every loop iteration, simplified construction of the end iterator
  on the test binary that has a couple of hundreds of MB, it reduces the execution time of
  elf_add_section example form 20 minutes to a couple of seconds
- adds an ability to modify single value inplace in the sectiton to save coying it just to do that
- the reason behind this patch is to use LIEF as a patchelf replacement so the performance
  is one of the factors

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
2020-05-22 02:29:59 +02:00
rthomas a2a1ce6fe3 Fix #412 2020-05-21 18:38:30 +02:00
Koh M. Nakagawa 4ccac0389d fix to avoid SIGSEGV while parsing the file that has a empty group icon 2020-05-21 22:12:01 +09:00
Koh M. Nakagawa a1521128e1 fix to handle exceptions in json_dump of ResourcesManager 2020-05-21 13:02:36 +09:00
rthomas 3cee05646c Fix typo 2020-05-20 16:30:38 +02:00
Romain 2ed4dd0157 Merge pull request #417 from kohnakagawa/fix/empty_fixed_file_version_entry
Fix to parse PE files that have empty fixed_file_version entry
2020-05-20 16:27:23 +02:00
Koh M. Nakagawa 2166c91773 fix to parse empty fixed_file_version entry 2020-05-20 16:46:11 +09:00
rthomas b99e791be6 Prefer unordered_map 2020-05-11 09:44:54 +02:00
rthomas 6fd553114d Update references 2020-05-11 09:33:03 +02:00
rthomas 8671cc0a97 Fix changelog 2020-05-11 09:25:03 +02:00
Romain cf2f92fc65 Merge pull request #408 from kohnakagawa/fix/debug_type
add IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS
2020-05-11 09:18:09 +02:00
Koh M. Nakagawa cd05f34bae add IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS 2020-05-11 09:16:59 +02:00
Romain e4a3659297 Merge pull request #407 from kohnakagawa/fix/add_json_records
Fix to show some missing JSON records
2020-05-11 08:55:36 +02:00
Koh M. Nakagawa 541c38c9e8 add some json records 2020-05-11 08:53:38 +02:00
Romain b023698df8 Merge pull request #409 from benjamb/bundle-license
Add LICENSE to MANIFEST.in
2020-05-11 08:51:23 +02:00
Ben Brown 37f38b3a42 Add LICENSE to MANIFEST.in 2020-05-06 10:29:40 +01:00
Romain 84ffe2d478 Merge pull request #405 from kohnakagawa/fix/reloc_base_types
add missing RELOCATIONS_BASE_TYPES
2020-05-03 20:18:24 +02:00
rthomas a04eb8888a Enhancement 2020-05-03 11:15:36 +02:00
Koh M. Nakagawa c03125045e add missing RELOCATIONS_BASE_TYPES 2020-05-03 11:15:36 +02:00
rthomas 798950d874 Fix memcpy 2020-05-03 11:14:07 +02:00
rthomas c0d028b4eb Fix symbol size 2020-05-03 10:51:52 +02:00
rthomas 9b2420d2e4 Fix uninitialized variable 2020-05-02 11:51:23 +02:00
Romain 9a64ced220 Merge pull request #406 from kohnakagawa/fix/machine_type_enum
fix machine type enum
2020-05-01 19:29:20 +02:00
Koh M. Nakagawa 6ee808a1e4 fix machine type enum 2020-05-01 10:01:19 +09:00
rthomas 1400144455 Fix python path 2020-04-26 19:29:31 +02:00
rthomas 59fb3b5da5 Update travis 2020-04-26 16:56:07 +02:00
rthomas faf2067f08 Update travis 2020-04-26 14:45:39 +02:00
Romain f96d95d718 Merge pull request #400 from intezer/master
feature: release the GIL on parse
2020-04-26 11:53:14 +02:00
thetufik 2c85678fb6 feature: release the GIL on parse 2020-04-21 16:54:23 +03:00
Romain ec8ed4d842 Merge pull request #394 from kohnakagawa/fix/README
fix C++ sample in README
2020-04-15 06:08:09 +02:00
Romain 1deb7f945d Merge pull request #393 from suletm/patch-1
To fix documentation issue #392
2020-04-15 06:07:52 +02:00
Koh M. Nakagawa ee7ccb2863 fix C++ sample in README 2020-04-11 14:07:59 +09:00
suletm 7daff3bf9b To fix documentation issue #392
1. Inconsistent function name fix.
2. Compilation fix as discussed in #392
2020-04-10 20:12:25 -07:00
rthomas 8ac569cb52 Update travis 2020-04-10 14:48:57 +02:00
Romain 43b65f616b Merge pull request #389 from kohnakagawa/fix/resource-parse-bug
fix resource parsing bug
2020-04-07 13:57:13 +02:00
Romain 5d45f8c6cb Merge pull request #385 from aeflores/always-parse-section-relocs
parse section relocations but do not parse dynamic relocations twice.
2020-04-07 13:56:54 +02:00
rthomas b57f32333a Consider relative offset when parsing EH frame.
Related to #385
2020-04-07 09:28:48 +02:00
Koh Nakagawa a7254d1ba9 fix resource parsing bug 2020-04-05 15:49:17 +09:00
Antonio Flores Montoya fe7c725f3b remove leftover debugging code. 2020-03-23 08:59:03 -04:00
Antonio Flores Montoya 594ea3b356 add test for binary with all relocations. 2020-03-23 08:53:25 -04:00
aeflores 6c53646bb7 parse section relocations but do not parse dynamic relocations twice. 2020-03-14 12:06:56 -04:00
Romain 1014ba0ad1 Merge pull request #384 from lief-project/revert-382-always-parse-section-relocs
Revert "Binaries generated with --emit-relocs have dynamic and section relocations"
2020-03-14 07:37:01 +01:00
Romain e39f939899 Revert "Binaries generated with --emit-relocs have dynamic and section relocations" 2020-03-14 07:36:23 +01:00
Romain f210e6ba9b Merge pull request #382 from aeflores/always-parse-section-relocs
Binaries generated with --emit-relocs have dynamic and section relocations
2020-03-14 07:35:54 +01:00
Antonio Flores Montoya a8293b4343 Binaries generated with --emit-relocs have dynamic and section relocations. 2020-03-09 16:47:43 -04:00
rthomas 33d1b894c0 Fix collisions in string optimization 2020-01-04 07:59:13 +01:00
rthomas 0b205665c3 Add package dir 2019-12-27 06:21:51 +01:00
Romain fb789a8e9a Merge pull request #368 from newgre/master
Use ifstream::read method to read file data instead of std::copy.
2019-12-15 10:53:28 +01:00
newgre 89bd542833 Use ifstream::read method to read file data instead of std::copy.
Improves the time to load and parse a large executable (~100MB) on my machine from ~1000ms to ~400ms.
2019-12-14 23:29:18 +01:00
Romain a26ae60e83 Merge pull request #365 from mingwandroid/FixMissing-typeinfo-symbol
Export BuildToolVersion and fix typo
2019-12-11 07:46:31 +01:00
Ray Donnelly f9e88a6665 Export BuildToolVersion 2019-12-10 18:20:18 +01:00
Ray Donnelly 68f6154722 Fix typo BuildeVersion => BuildVersion which may lead to my link failures 2019-12-10 15:42:04 +01:00
Romain Thomas eeddc38393 Handle PE forwarded exports
Resolve: #307
2019-12-10 06:33:48 +01:00
rthomas ab349aadc6 Set Python 3.5 as the minimum version 2019-12-08 09:21:51 +01:00
rthomas 172c589d4c Update LIEF version 2019-12-07 09:31:36 +01:00
rthomas 0ade59de75 Add PT_GNU_PROPERTY 2019-12-06 06:22:01 +01:00
rthomas 86568dc77a Update tests 2019-12-01 14:52:54 +01:00
rthomas 74bc77465e Do not break parsing when a symbol is empty.
Seen in ``libbaiduprotect.so`` (4813a0c5cf97f52ccb3d2494d86fc2e3e924df2fbd83936437e3472f64019d22)
2019-12-01 07:51:27 +01:00
rthomas 1cd2db0dca Fix typo 2019-12-01 07:38:50 +01:00
rthomas da4507fcbb Force patch version to '0' 2019-11-30 16:14:27 +01:00
rthomas 7b7216f14c Update README 2019-11-30 07:29:58 +01:00
rthomas bfe5414a1e Set date 2019-11-29 21:51:38 +01:00
rthomas 86a35bd7bc Fix typo 2019-11-28 17:16:57 +01:00
rthomas b0e480c9f2 Fix Python parsing with input 'bytes' 2019-11-28 07:53:27 +01:00
rthomas ca4e6148fe Add API to demangle strings 2019-11-28 16:25:58 +01:00
rthomas c93f428d04 Add doc option 2019-11-28 07:47:06 +01:00
rthomas 7fc13786e8 Cleanup 2019-11-28 06:47:49 +01:00
rthomas 91bc294b62 Update README 2019-11-25 08:17:27 +01:00
rthomas 1090d09e1a Update README 2019-11-24 19:12:00 +01:00
rthomas 833d8a626f Fix date 2019-11-24 19:07:38 +01:00
rthomas 845f675627 Clean 2019-11-24 09:54:14 +01:00
rthomas f5d152ee92 Update API key 2019-11-24 08:52:32 +01:00
rthomas b9eb5c4043 Update files 2019-11-24 08:33:30 +01:00
rthomas db4e52dd90 Only wheel files matter 2019-11-24 08:33:17 +01:00
rthomas fe9315f42d Update changelog 2019-11-23 14:20:38 +01:00
rthomas bf9e4a259b Fix travis CI 2019-11-23 12:04:12 +01:00
rthomas 42ee4173cd Disable Python 3.8 in Appveyor because of error 2019-11-23 06:53:35 +01:00
Laszlo Kiss-Kollar 5f865a8980 Run build on Python 3.8
Enable Travis and AppVeyor builds on 3.8.
2019-11-23 06:53:35 +01:00
Romain 4744ab12a0 Merge pull request #359 from majin42/fix/pe_missing_offset
[PE] Fix missing offset in resource parsing
2019-11-23 06:32:33 +01:00
rthomas d838f523bb Trigger Docker on OSX build instead of Linux 2019-11-23 06:31:31 +01:00
majin42 ed2e775e77 reintroduce missing offset parameter in PE resource data parsing 2019-11-22 10:40:49 +01:00
rthomas 934d84ffea Move to Pybind11 v2.4.3 and fix enum conflicts 2019-11-19 06:41:11 +01:00
rthomas d400ca429d Add blog post about kaitai and LIEF 2019-11-08 16:05:59 +01:00
rthomas 4105c31f61 Missing import 2019-11-08 16:05:59 +01:00
Romain 657d589fae Merge pull request #352 from recvfrom/master
Expose raw bytes of Authenticode-related structures and other improvements
2019-10-08 10:10:38 +02:00
Andrew 08d31be932 Authenticode-related bug fixes and improvements
Part of Authenticode verification consists of:
 - Comparing the computed Authenticode hash to the digest
   stored in the ContentInfo section
 - Comparing hash(ContentInfo) to the digest stored in the
   AuthenticatedAttributes section
 - Verifying signed(hash(AuthenticatedAttributes)) using a
   certificate identified by the issuer and serial number
   specified in the SignerInfo section

This commit makes it so that the raw bytes needed to
calculate hash(ContentInfo) and hash(AuthenticatedAttributes)
are available for use.

============================================================

Allow missing [0] in SpcSpOpusInfo

Some executables have MoreInfo but not a ProgramName (and the documentation
lists both as OPTIONAL), so handle this case correctly.

Example:

```
01416b1730218454c99b13592650cb170402b86742b4bab971565903b841829b

SEQUENCE(2 elem)
OBJECT IDENTIFIER1.3.6.1.4.1.311.2.1.12spcSpOpusInfo(Microsoft code signing)
SET(1 elem)
  SEQUENCE(1 elem)
  [1](1 elem)
   [0]http://www.mozilla.com
```

============================================================

Improve consistency of parsed serial numbers

When parsing the issuer serial number, call mbedtls_x509_get_serial instead of
parsing it as an integer directly with mbedtls_asn1_get_mpi. These two functions
differ in how they treat serial numbers prepended with '00' to prevent them from
being negative (the former preserves the '00', and the latter discards it). The
embedded certs are parsed via a call to mbedtls_x509_crt_parse_der, which uses
mbedtls_x509_get_serial behind the scenes, so there was an inconsistency between
lief_obj.signature.signer_info.issuer[1] and
lief_obj.signature.certificates[x].serial_number.  Example:

8bf57d97dd917c4f823659266caaa33e7398406daf11ba8318e3f7414ee3fb24

============================================================

Handle SpcLink and SpcString CHOICEs in SpcSpOpusInfo

The Authenticode spec doc says that these can be CHOICES, so
handle the easy ones and safely skip the others.

============================================================

Allow Authenticode sig to be parsed even if cert parsing fails

By default, mbedtls doesn't support MD2 certs, which are fairly
common in older signed executables.  Ex:

1cb16f94cebdcad7dd05c8537375a6ff6379fcdb08528fc83889f26efaa84e2a

============================================================

Enable mbed TLS MD2 and MD4 support; add Unix debug options

By default, mbedtls doesn't support MD2 certs, which are fairly
common in older signed executables.  Ex:

1cb16f94cebdcad7dd05c8537375a6ff6379fcdb08528fc83889f26efaa84e2a

============================================================

Set MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION flag

Some older signed executables use certs with the SpcSpAgencyInfo
Critical Extension, which mbed TLS doesn't support, so set
MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION to have it
skip this extension.  Example:

781ca31416ec708a587851dafd90c661b86f244ab8b8475c4185e958e54ff838

============================================================

Support accessing non-utf8 issuer names via Python

For a few signatures where the issuer name contained non-utf8
characters, accessing the issuer name field in Python would raise
a UnicodeDecodeError exception. Now this field is handled the
same way the names in the individual certs are (I'm not sure if
they get represented 100% correctly, but at least they are
consistent, which is good enough for me). Example:

048f91b9302c88380fc66adac1e314d82733089ef3a31eadca5f0cb4169b195f
2019-10-07 00:58:40 -04:00
rthomas 208264cb66 Remove unused files
Resolve #348
2019-10-02 08:13:12 +02:00
rthomas e563d682bf Update changelog 2019-10-02 07:55:04 +02:00
Laszlo Kiss-Kollar 3550e45f18 Build manylinux1-compliant wheels in Travis
* Temporarily disable Melkor in test suite
The Makefile uses the -executable flag which doesn't work on RHEL5.
Disabling until I find a workaround for this.

* Patch Makefile in Melkor fuzzer
This replaces the `-executable` flag which is not supported by `find` on
CentOS 5.

* Respect CC environment variable
Several tests hard coded /usr/bin/cc which might not exist in some
environments. We first check the CC environment variable and fall back
to the hard coded path if CC is unset.

* Skip tests on GLIBC < 2.17
Some test binaries were linked against GLIBC 2.17. Skip tests which use
this binary if the platform does not have the required GLIBC version.

* Enable ccache in Docker in Travis builds

* Run `auditwheel repair` on the produced wheels
This will vendor the needed external shared libraries into the wheel and
tag it as manylinux1.

* Install ccache in Docker image

* Avoid using bind mount volume in Docker build

The bind mount volume wrote files as 'root' which causes issues with the
deploy script in Travis. Copying the source code into the image and
retrieving the built wheels instead of mounting the source tree fixes
this issue.

* Fix missing build folder when building with Docker

After finishing the build inside Docker we need the build directory from
the container to be able to deploy the built artifacts with deploy.sh.

* Use the right Python interpreter for Linux builds

The Dockerized .travis.yml builds attempt to invoke the interpreter in
the PYTHON_BINARY environment variable, which is only valid inside the
Docker image. To fix this, override the variable on Linux for tasks
which require the host's Python interpreter.

* Fix missing pip installation in Travis

The Ubuntu image in Travis does not come with `pip` preinstalled for
Python 3.

* Remove .git directory from .dockerignore

As `setup.py` uses `git` to determine the version number we need to copy
the contents of `.git` into the image.
2019-10-02 07:49:45 +02:00
Romain Thomas e50436164e Fix missing code-block 2019-09-09 17:28:43 +02:00
Romain Thomas 27666e4f02 Add Android x86/x86-64 cmake scripts 2019-09-09 07:44:59 +02:00
Romain Thomas f6cc8f8ff6 Improve debug build on Windows 2019-08-29 08:24:39 +02:00
Romain Thomas 6cf1e2f9df Fix doc about compilation 2019-08-28 07:16:28 +02:00
Romain Thomas 4d4f96d268 Fix local variable life-time.
Resolve #331
2019-08-27 07:54:33 +02:00
Romain Thomas 273f001895 Add script for AArch64 2019-08-24 17:28:34 +02:00
Romain Thomas 40570e6522 Enhance LIEF modules configuration 2019-08-23 08:07:40 +02:00
Romain Thomas 088951ddb7 Resolve #329 2019-08-23 07:54:23 +02:00
Chris 2cc22a792f Update 09_frida_lief.rst (#330)
Fix typo
2019-08-23 07:25:32 +02:00
Romain Thomas 04037644af Update README 2019-08-21 07:36:05 +02:00
wisk df2d56c532 Fix PE available sections space
(cherry picked from commit fb311c28f2f6dd682d195a235ebddf549618b84b)
2019-07-29 09:37:54 +02:00
wisk 2b1214b770 Use C++ header for Mach-O
(cherry picked from commit e477afad1f0f13acc8cbca8a80d1bc7935c0923f)
2019-07-29 09:37:54 +02:00
Andrew Williams fcb9c76be6 Expose the raw bytes backing each PE Authenticode cert (#320) 2019-07-26 19:26:13 +02:00
Romain Thomas 1b1a616ac7 Add missing entry 2019-07-26 09:09:07 +02:00
Romain Thomas 715448d3b8 Merge branch 'fix/cmake' 2019-07-25 13:09:59 +02:00
Andrew Williams 20f46e74a3 Unify SignerInfo issuer field format (#319)
* Unify SignerInfo issuer field format

This makes it so that the SignerInfo issuer field has the same
format as the issuer fields in each x509 cert, so the two can
be more easily compared.

Also, this commit adds '0x' in front of the Data Directory
RVAs and sizes to make it more clear that the values are printed
in hex.

* Add missing include in SignerInfo.cpp

* Address Codacy feedback and minor change to text

The serial number of the signing certificate will now be
printed as 'Serial Number' instead of 'Issuer Serial Number'
since the latter is a bit confusing (the serial number in
the SignerInfo section is the serial number of the certificate
that actually signed the executable)

* Update python pe_reader example based on issuer changes
2019-07-25 11:38:42 +02:00
Romain Thomas d4ad532c58 Downgrade cmake_minimum_required to 3.5 2019-07-24 14:56:25 +02:00
Romain Thomas 3a11b24798 Add alias 2019-07-10 06:59:41 +02:00
Romain bab1c1d5b7 Merge pull request #317 from recvfrom/master
Update the PE Authenticode parsing code
2019-07-10 06:54:08 +02:00
Andrew 535623de3a Update the PE Authenticode parsing code
- Allow UTF8String and IA5String types when parsing the Issuer fields
   (previously only PrintableString types were handled).  Handling these
   three types should be sufficient, based on the default types indicated
   at https://github.com/ARMmbed/mbedtls/blob/master/library/x509_create.c#L52.
   The approach used is similar to what's done in mbedtls's internal
   x509_get_attr_type_value function.

   Examples:
```
     8a364e0881fd7201cd6f0a0ff747451c9b93182d5699afb28ad8466f7f726660:
     SEQUENCE (4 elem)
       SET (1 elem)
         SEQUENCE (2 elem)
           OBJECT IDENTIFIER 2.5.4.6 countryName (X.520 DN component)
           PrintableString PL
       SET (1 elem)
         SEQUENCE (2 elem)
           OBJECT IDENTIFIER 2.5.4.10 organizationName (X.520 DN component)
           UTF8String Unizeto Technologies S.A.
       SET (1 elem)
         SEQUENCE (2 elem)
           OBJECT IDENTIFIER 2.5.4.11 organizationalUnitName (X.520 DN component)
           UTF8String Certum Certification Authority
       SET (1 elem)
         SEQUENCE (2 elem)
           OBJECT IDENTIFIER 2.5.4.3 commonName (X.520 DN component)
           UTF8String Certum Code Signing CA SHA2

     From a test binary compiled with osslsigncode:
     SEQUENCE (6 elem)
       SET (1 elem)
         SEQUENCE (2 elem)
           OBJECT IDENTIFIER 2.5.4.6 countryName (X.520 DN component)
           PrintableString US
       SET (1 elem)
         SEQUENCE (2 elem)
           OBJECT IDENTIFIER 2.5.4.8 stateOrProvinceName (X.520 DN component)
           UTF8String State
       SET (1 elem)
         SEQUENCE (2 elem)
           OBJECT IDENTIFIER 2.5.4.7 localityName (X.520 DN component)
           UTF8String City
       SET (1 elem)
         SEQUENCE (2 elem)
           OBJECT IDENTIFIER 2.5.4.10 organizationName (X.520 DN component)
           UTF8String Cisco Talos
       SET (1 elem)
         SEQUENCE (2 elem)
           OBJECT IDENTIFIER 2.5.4.11 organizationalUnitName (X.520 DN component)
           UTF8String Test CA 1704a8ea9e24d8ed
       SET (1 elem)
         SEQUENCE (2 elem)
           OBJECT IDENTIFIER 1.2.840.113549.1.9.1 emailAddress (PKCS #9. Deprecated, use an altName extension instead)
           IA5String rfc2606@example.net
```

 - Allow any order for the AuthenticatedAttributes, and ignore ones that
   aren't recognized. The code was looking for a strict ordering of the
   attributes, but Windows seems to be OK with any order.
   Example:
```
     From f91e258ea71dcbfc82371b2ee3e20852e45bef0cb946223d1141a6ef1dfb793f:
     SEQUENCE (2 elem)
       OBJECT IDENTIFIER 1.3.6.1.4.1.311.2.1.12 spcSpOpusInfo (Microsoft code signing)
       SET (1 elem)
         SEQUENCE (0 elem)
     SEQUENCE (2 elem)
       OBJECT IDENTIFIER 1.2.840.113549.1.9.3 contentType (PKCS #9)
       SET (1 elem)
         OBJECT IDENTIFIER 1.3.6.1.4.1.311.2.1.4 spcIndirectDataContext (Microsoft code signing)
     SEQUENCE (2 elem)
       OBJECT IDENTIFIER 1.3.6.1.4.1.311.2.1.11 spcStatementType (Microsoft code signing)
       SET (1 elem)
         SEQUENCE (1 elem)
           OBJECT IDENTIFIER 1.3.6.1.4.1.311.2.1.21 individualCodeSigning (Microsoft)
     SEQUENCE (2 elem)
       OBJECT IDENTIFIER 1.2.840.113549.1.9.4 messageDigest (PKCS #9)
       SET (1 elem)
         OCTET STRING (20 byte) 7C87D331C6E62C0EC840BC23CA63FBC2CE68586F
```

 - Allow the program name and/or more info to be missing from SpcSpOpusInfo.
   Examples:
```
     8a364e0881fd7201cd6f0a0ff747451c9b93182d5699afb28ad8466f7f726660:
     SEQUENCE (2 elem)
       OBJECT IDENTIFIER 1.3.6.1.4.1.311.2.1.12 spcSpOpusInfo (Microsoft code signing)
       SET (1 elem)
         SEQUENCE (0 elem)

     0059fb3f225c5784789622eeccb97197d591972851b63d59f5bd107ddfdb7a21:
     SEQUENCE (2 elem)
       OBJECT IDENTIFIER 1.3.6.1.4.1.311.2.1.12 spcSpOpusInfo (Microsoft code signing)
       SET (1 elem)
         SEQUENCE (1 elem)
           [0] (1 elem)
             [0] (22 byte) 0047006F0054006F0020004F00700065006E00650072
```

 - I removed the #if 0 ContentInfo from being populated, and the code worked
   with all of the test samples I used... Is there another reason this code
   is commented out?

 - The authenticated_attribytes content_name_ member now gets populated. This
   was commented out with a TODO by it... Is there a reason this field wasn't
   being populated?

 - When the SignerInfo is printed, it will now show 'N/A' if no value was
   parsed out from the executable
2019-07-09 13:51:20 -04:00
Romain Thomas 91eb4783c3 Resolve #313 2019-07-08 08:40:10 +02:00
Romain Thomas 8f2770506d Remove unecessary file 2019-07-08 08:14:20 +02:00
Romain 826965be1b Merge pull request #308 from jlewallen/master
Fix performance issue parsing relocations.
2019-06-26 09:18:15 +02:00
Romain Thomas bd9be9a765 Add notice regarding LIEF imphash implementation
Related to #299
2019-06-26 09:10:35 +02:00
Jacob Lewallen 3be83b7b22 Fix performance issue parsing relocations.
Uses a map to track added relocations.
2019-06-24 19:53:15 -07:00
Romain Thomas 7ff0859879 Fix terminal columns 2019-06-23 10:20:21 +02:00
Romain Thomas 778763de88 Fix Python return value policy for `get_symbol()`
Resolve #305
2019-06-23 10:19:14 +02:00
Romain 9dd9ded098 Merge pull request #301 from mackncheesiest/LIEF-300
Fixes issues with printing/serializing notes
2019-06-08 15:38:16 +02:00
Joshua Mack 89c7afa680 Adds regression check for Note::dump segfault 2019-06-07 18:04:08 -07:00
Joshua Mack d188fbdd23 Assigns alignment of note segments that are added by lief user
Adds support for serialization of hwcap and unknown notes through
Builder::build()

Gives unknown note types a default ".note" namespace rather than
potentially alias a ".note.unknown" type in the future
2019-06-07 14:37:34 -07:00
Joshua Mack c9c49bb4b8 Adds ability to clone ELF NoteDetails objects
Subsequently, calling print(mybin) on an ELF binary that has a new note
added it no longer segfaults
2019-06-06 21:34:03 -07:00
Romain Thomas fa3195b1bd Add API to check if a section associated with an Off/VA exists 2019-05-28 09:47:33 +02:00
Romain Thomas 8fb74bec60 Fix ELF `patch_address` function for object files (.o) 2019-05-20 11:01:40 +02:00
Romain Thomas 22344e764e Fix conflict when the builder tries to resolve the DT_XXX_ARRAY section 2019-05-20 10:59:39 +02:00
Romain Thomas 3730e447e1 Add ANBU 2019-05-13 17:09:11 +02:00
Romain Thomas 1bd6cb8120 Use compiler shstrtab name 2019-05-13 17:04:40 +02:00
Romain Thomas ca846b3ce7 Add Wiggle 2019-05-11 10:41:08 +02:00
Romain Thomas 352fa954a1 Set LIEF_EXPORTS for LIEF shared library 2019-05-11 10:40:52 +02:00
Romain Thomas 31db3adf34 Fix typo 2019-05-11 08:39:45 +02:00
Romain Thomas 084fc4544f Resolve #295 2019-05-11 08:14:19 +02:00
Romain Thomas 6824548665 Bump version for nightly build
Issue: #294
2019-05-11 08:08:23 +02:00
Romain Thomas f4ba8b199e Fix (bad) bound checking 2019-05-07 16:12:16 +02:00
Romain Thomas 27a03a6fd3 Force GLIBCXX_USE_CXX11_ABI 2019-05-04 07:17:03 +02:00
Romain Thomas 35805fb598 Explicitly export function 2019-05-03 21:00:08 +02:00
Romain Thomas 36a7eeda2a Fix #292 2019-05-03 20:40:13 +02:00
Cédric Tessier 9fc3a8a433 Add coredump support in LIEF 2019-04-18 07:17:46 +02:00
Romain Thomas 4608af8280 Remove not unnecessary dependencies 2019-04-15 21:01:35 +02:00
Romain Thomas f20b1600c9 Install elf,pe,macho_reader when installing python api 2019-04-02 17:10:21 +02:00
Romain Thomas 22cd81cfd8 Fix typo 2019-04-01 14:47:51 +02:00
Romain Thomas 449a56b3a9 Merge branch 'enhancement/setup' 2019-03-31 10:15:38 +02:00
Romain Thomas 0d03b4bdb8 Improve Python setup 2019-03-31 10:15:08 +02:00
Romain 57c30b8bd5 Update issue templates 2019-03-30 16:13:12 +01:00
Romain 779529b1b8 Merge pull request #287 from lief-project/romainthomas-patch-1
Update issue templates
2019-03-30 16:12:02 +01:00
Romain 2129f645e3 Update issue templates 2019-03-30 16:11:22 +01:00
Romain 6c5889d9f2 Merge pull request #286 from nezetic/fix_macho
Add support for adding LC_UNIXTHREAD commands in a MachO
2019-03-30 09:38:37 +01:00
Cédric Tessier 64d2597284 Add support for adding LC_UNIXTHREAD commands in a MachO (include minor fixes) 2019-03-29 16:54:17 +01:00
Romain Thomas a6adf242df Fix typo 2019-03-29 13:45:09 +01:00
Romain Thomas b26abae9a9 Fix #285 2019-03-25 20:38:28 +01:00
Romain Thomas e4c37e00ec Fix warning 2019-03-24 09:06:33 +01:00
Romain Thomas 09454f84a3 Resolve #284 2019-03-22 15:41:09 +01:00
Romain Thomas a2403d5eeb Resolve #280 2019-03-14 12:48:03 +01:00
Romain b1e9c1baed Merge pull request #275 from DaLynX/master
Counter bugs in PE resources manipulation functions
2019-03-12 05:56:12 +01:00
DaLynX 01b4d47048 [PE] Fix counter bug in ResourceNode child addition 2019-03-11 23:43:58 +01:00
DaLynX d56e4fbb69 [PE] Fix counter bug in ResourceNode deletion 2019-03-11 23:33:52 +01:00
Romain Thomas 90867193b5 Fix #271 2019-03-10 17:49:21 +01:00
Romain Thomas 5fd3edc2a9 Fix #272 2019-03-10 17:28:18 +01:00
Romain Thomas 12073db330 Resolve #259 2019-03-09 09:16:52 +01:00
Romain Thomas 342f450e3c Update references 2019-02-19 16:38:15 +01:00
Romain Thomas 87e200a07f Add cmake config for Android 2019-02-19 08:28:06 +01:00
Romain Thomas 24f7898748 Add CMake export 2019-02-18 17:23:33 +01:00
Romain Thomas 44a10f2d35 Update appveyor 2019-02-18 16:16:32 +01:00
Romain Thomas 6fc676387a Enhance tests 2019-02-18 14:17:08 +01:00
Romain Thomas 7e88e2b2c0 Add function to check if a symbol can be removed 2019-02-18 14:17:08 +01:00
Romain Thomas 826aae615b Add function to check format integrity against codesign 2019-02-18 14:17:08 +01:00
Romain Thomas 1fefa7eee9 Handle Dynsym table 2019-02-18 14:17:08 +01:00
Romain Thomas 616d739da5 Enable to remove Mach-O symbols 2019-02-18 14:17:08 +01:00
Romain Thomas 38c7ef8416 Fix UTF8 char 2019-02-04 08:47:43 +01:00
KOLANICH 8a30e1a3d7 Added a dir with runtime libs i to PATH if it exists 2019-01-27 08:55:14 +01:00
Romain Thomas 1fdeafc6cc Fix windows 2019-01-17 07:37:15 +01:00
Romain Thomas 9f4962654c Sanity checks on import names and ordinal value
Resolve #260
2019-01-16 07:19:33 +01:00
Romain 2778882bc2 Merge pull request #262 from mingwandroid/macho-has_dynamic_symbol_command
MachO: Fix has_dynamic_symbol_command()
2019-01-15 07:43:29 +01:00
Romain Thomas 146238029d Merge branch 'pr/258', close #258 2019-01-15 07:42:35 +01:00
dm 3833e0be9c Add min_size parameters to Binary::strings function 2019-01-15 07:41:50 +01:00
Ray Donnelly f3709db789 MachO: Fix has_dynamic_symbol_command() 2019-01-15 00:23:14 -06:00
Romain 04fc91bfca Merge pull request #257 from williballenthin/fix-rsrc-2
resources manager: fix parsing string info by trusting k-v pair header
2019-01-11 11:08:13 +01:00
Willi Ballenthin 2f8773e149 resources manager: fix parsing string info by trusting k-v pair header
closes #256
2019-01-10 15:15:16 -06:00
Romain Thomas 9e04d0b118 Resolve #253 2019-01-09 07:57:57 +01:00
Romain 13ad81e743 Merge pull request #254 from unratito/patch-1
Set export address for unnamed exports
2019-01-05 19:49:39 +01:00
Paco Soberón 3aaef13292 Set export address for unnamed exports 2019-01-05 10:10:38 +01:00
Romain Thomas 8d7ec26a93 Add ELF ABI Version 2018-12-30 20:27:53 +01:00
Romain f20fa5e4f4 Merge pull request #250 from breadchris/patch-1
Update 11_macho_modification.rst
2018-12-24 06:10:46 +01:00
Chris cb55d7501b Update 11_macho_modification.rst
Typo
2018-12-23 23:39:56 -05:00
Romain Thomas c1758ba1ed Fix 249 2018-12-24 05:33:11 +01:00
Romain Thomas 0054b9acef Update References 2018-12-20 03:21:44 +01:00
Romain 3e4ec39ab3 Merge pull request #247 from elsamuko/master
chg: recognize cygwin in setup.py
2018-12-19 08:29:52 +01:00
Samuel Albrecht e64668c0c8 chg: recognize cygwin in setup.py 2018-12-18 07:42:26 +00:00
Romain 5ed5c5e4d9 Merge pull request #246 from williballenthin/fix-rsrc-empty-string
PE ResourcesManager: correctly handle empty strings
2018-12-18 06:51:23 +01:00
William Ballenthin 882bf35197 PE ResourcesManager: correctly handle empty strings
addresses https://github.com/lief-project/LIEF/issues/245
2018-12-17 16:17:33 -07:00
Romain Thomas 3b892188a1 Fix typo 2018-12-16 19:24:20 +01:00
Romain Thomas 678039cf44 Add missing enum 2018-12-16 17:57:57 +01:00
Romain Thomas 98395524b5 Update references 2018-12-16 17:56:26 +01:00
Romain Thomas dc87423761 Merge branch 'pr/243' 2018-12-16 16:34:24 +01:00
1orenz0 3537440b8d Add support to parse POGO debug entries 2018-12-16 16:34:12 +01:00
Romain Thomas f2b93bf796 Merge branch 'feature/build_version' 2018-12-13 15:39:56 +01:00
Romain Thomas 6f967238fc Introduce Mach-O Build Version command
New API:
  LIEF::MachO::BuildVersion
  LIEF::MachO::BuildToolVersion

  LIEF::MachO::Binary::has_build_version
  LIEF::MachO::Binary::build_version
2018-12-13 15:37:19 +01:00
Romain Thomas 2c6f052a5f Merge branch 'packer/tencent' 2018-12-13 09:33:46 +01:00
Romain Thomas 35b3d039f7 Only relocate section if the original one was not empty.
We also introduce ELF API for overlay:
  * lief.ELF.Binary.eof_offset
  * lief.ELF.Binary.has_overlay
  * lief.ELF.Binary.overlay
2018-12-13 09:32:54 +01:00
Romain Thomas 93b73d35ef Fix Mach-O fat header endianness (alignment attribute) 2018-12-09 08:37:28 +01:00
Romain Thomas 7c22f643c2 Forward Debug class 2018-12-03 06:56:36 +01:00
Romain Thomas 840d70cb6d Update LIEF version (related to #242) 2018-12-02 13:50:39 +01:00
Romain Thomas 3271d1011b Merge branch 'pr/241' 2018-11-29 09:18:06 +01:00
1orenz0 fcc75dd879 Parse PE debug data directory as a list of debug entries
PE's DATA_DIRECTORY_DEBUG does not define a single debug entry, but
a list of struct pe_debug entries (the number of entries is determined
by the data directory's size).

This commit reflect this layout by returning a vector<> when calling
PE.debug()
2018-11-29 09:16:34 +01:00
Romain Thomas 3ac2067267 Resolve #238 and add bibtex 2018-11-26 06:39:11 +01:00
Romain Thomas cf8a0d9ce3 Add HITCON 2018 - Unexecutable writeup 2018-11-16 11:18:13 +01:00
Romain Thomas 184074841b Drop Python 2.7 support. Add Python 3.7 support 2018-11-16 11:00:09 +01:00
Romain f3e52f5f3c Merge pull request #235 from strazzere/patch-1
Fix list object to become an iterator
2018-11-14 04:39:01 +01:00
Tim Strazzere c6ba2fd8e1 Fix list object to become an iterator 2018-11-13 15:26:30 -08:00
Romain cc7a2657ef Merge pull request #229 from mingwandroid/master
A few fixes from the Anaconda Distribution.
2018-10-31 17:58:46 +01:00
Ray Donnelly b3678bfdfc Export LIEF::Object and LIEF::MachO::DataCodeEntry classes
Otherwise the shared library does not contain these symbols.
2018-10-31 12:29:34 +00:00
Ray Donnelly 946527a732 MSVC: Add bigobj flag 2018-10-31 12:29:34 +00:00
Ray Donnelly e7f5829b19 Allow building from released tarball 2018-10-31 12:29:01 +00:00
Romain 8620b08f95 Merge pull request #222 from pbrunet/fix/export_trie
Fix/export trie
2018-10-19 13:49:34 +02:00
Pierrick Brunet 0927287703 Fix export_trie ordering. 2018-10-19 10:07:42 +02:00
Pierrick Brunet 53b1eb4165 Fix fatMachO to simpleMacho translation.
* empty file was created.
2018-10-19 10:07:42 +02:00
Romain Thomas 12416db45a Fix #221 (memory leak) 2018-10-19 09:59:13 +02:00
Romain Thomas f3b14dac83 Update references 2018-10-18 06:54:41 +02:00
Romain Thomas f9b8bcf503 Fix error in read_sleb128 implementation 2018-10-12 09:31:09 +02:00
Romain de064eb591 Merge pull request #218 from yrp604/patch-1
Update 02_pe_from_scratch.rst
2018-10-06 17:15:54 +02:00
_yrp 273924ab85 Update 02_pe_from_scratch.rst
`PE64` renamed to `PE32_PLUS`
2018-10-03 23:23:59 -07:00
Romain Thomas decb8621f8 Enhancement 2018-10-01 10:40:58 +02:00
Romain Thomas d7d1d18beb Fix #216 2018-10-01 10:40:40 +02:00
Romain Thomas ad792af834 Add color when using Ninja 2018-10-01 10:02:24 +02:00
Romain c4524ea6f1 Merge pull request #212 from hillu/c-api-content-size
api/c: Add explict size fields for extracted content fields
2018-09-13 14:47:49 +02:00
Hilko Bengen cbacbc47f4 api/c: Add explict size fields for extracted content fields
Corrupted files may cause section or segment contents not to be
available entirely. However, C-based client code is not able to detect
this which may cause out-of-bounds reads when accessing data from the
.content fields.

Note: This is a silent ABI-breaking change because it changes struct layouts.

Note: Naming is inconsistent: .size was already taken in PE Sections.
2018-09-13 13:56:48 +02:00
Romain Thomas b5a08463ad Expose API to list functions found in a binary 2018-09-12 14:44:18 +02:00
Romain Thomas 5c757dff91 Fix ELF VA -> Offset issue 2018-09-11 06:33:53 +02:00
Romain Thomas dfd8e55b83 Remove yamlcpp 2018-09-09 04:48:35 +02:00
Romain Thomas 196717c999 Fix gnu hash table 2018-09-08 09:19:02 +02:00
Romain Thomas b716003f59 Fix alignement issue 2018-09-08 06:17:42 +02:00
Romain Thomas 6c62bed5ab WIP 2018-09-08 05:46:00 +02:00
Romain Thomas 4b649ad231 WIP 2018-09-08 05:25:21 +02:00
Romain Thomas 9142c2bfb3 Update Yamlcpp 2018-09-08 04:56:10 +02:00
Romain Thomas a7d4f682f5 Merge branch 'pr/201' 2018-09-07 11:47:09 +02:00
Romain Thomas 2c01518cc0 Update doc 2018-09-07 11:45:47 +02:00
Adrien Guinet 89d4de54c8 Fix git tag commmand to always work
Forward CRT on other targets
2018-08-29 13:38:27 +02:00
Adrien Guinet 4b03ac45e0 Remove LIEF_SHARED_LIB from cmake
Moreover, add macros to force the CRT usage when using MSVC.
This is based on the LLVM one.
2018-08-29 08:50:56 +02:00
Romain Thomas d394e0e58f Strip file for Release Build 2018-08-20 09:04:28 +02:00
Romain Thomas 507dfd2dcb Bug fix 2018-08-12 11:39:32 +02:00
Romain Thomas 2d603ede82 Move from fatal to error 2018-08-12 10:55:32 +02:00
Romain Thomas cb70c44391 Bug fix when section offset is corrupted 2018-08-12 10:55:16 +02:00
Romain Thomas 9314b4ad11 Fix when no tag are present 2018-08-12 10:54:57 +02:00
Romain Thomas 38e84d6d2c Fix encoding issue 2018-08-11 04:11:56 +02:00
Romain Thomas bce9ebe170 Add support for Android 9 2018-08-10 16:10:51 +02:00
Romain Thomas 04dddd3710 Fix alignment issue when removing a PE section 2018-08-10 15:16:29 +02:00
Romain Thomas 1f875dbea8 Fix error 2018-08-10 11:15:49 +02:00
Romain Thomas 02f4851c9f Return string located in the .rodata section
New API: lief.ELF.Binary.strings / LIEF::ELF::Binary::strings()
2018-07-27 10:56:41 +02:00
Romain Thomas 6b2ac0cc2a Remove some exceptions in Mach-O and ELF utils 2018-07-23 14:59:07 +02:00
Romain Thomas 4cb7ba46c7 Merge branch 'pr/176' 2018-07-23 14:52:36 +02:00
Romain Thomas b22ef1f211 Fix comments 2018-07-23 14:52:12 +02:00
pbrunet e3b680f70b Fix filtering of object relocation. 2018-07-23 14:47:39 +02:00
pbrunet d1b98d69ad Add support for static relocation writing. 2018-07-23 14:47:39 +02:00
Romain Thomas 2dde1afc5c Do not rebuild GNU Hash table when it is empty 2018-07-23 14:40:16 +02:00
Romain Thomas c6779702b1 Expose Python API to remove ELF static symbols 2018-07-23 13:23:04 +02:00
Romain Thomas 0c9ecec7c5 Fix ELF consistency 2018-07-23 13:22:32 +02:00
Romain 0f6cfd0b84 Resolve #195
Fix links
2018-07-19 10:13:41 +02:00
Romain Thomas ceee60e1b5 Resolve #193 2018-07-17 14:50:56 +02:00
Romain Thomas bc4c94ca6c Add missing virtual 2018-07-16 14:05:48 +02:00
Romain Thomas 26586459d9 cleanup 2018-07-16 13:42:24 +02:00
Romain Thomas 16595316fd Enable write on Fat Mach-O 2018-07-16 13:32:00 +02:00
Romain Thomas 9268a35c68 Bug fix: Exit too early 2018-07-16 08:58:26 +02:00
Romain Thomas ce4af44b26 Disable ELPP crash handler 2018-07-16 08:57:54 +02:00
Romain 28aeb36400 Merge pull request #191 from aguinet/feature/write_abstract
Put the Binary::write interface in the Abstract interface
2018-07-10 13:24:49 +02:00
Adrien Guinet af4d48ed2e Put the Binary::write interface in the Abstract interface 2018-07-10 11:44:05 +02:00
Romain Thomas 918438c6be Enable to remove sections using the abstract layer 2018-07-09 15:08:39 +02:00
Romain Thomas 613412955c Fix bug 2018-07-09 14:02:57 +02:00
Romain Thomas 1c854c2663 Bug Fix: Mach-O Section is not a load command 2018-07-07 09:19:16 +02:00
Romain Thomas 47d5fb7180 Merge branch 'pr/189' 2018-07-06 08:53:18 +02:00
Jurriaan Bremer 394d7ec44a also zero the remaining bytes in section names 2018-07-06 08:52:15 +02:00
Jurriaan Bremer 83f659222f allow for reproducible builds by zeroing non-initialized dosheader fields 2018-07-05 23:23:56 +02:00
Romain Thomas 057d6e2d08 Fix bug when ELF doesn't have sections 2018-07-05 08:18:28 +02:00
Romain Thomas 4edff179ca Fix parser issue 2018-07-03 05:12:50 +02:00
Romain Thomas 4fcbdb7f33 Add reflective-polymorphism 2018-07-02 05:23:24 +02:00
Romain Thomas 85067e9edd Fix #188 2018-07-02 05:17:49 +02:00
Romain Thomas 752bb934c9 Fix typo 2018-06-29 07:03:41 +02:00
Romain Thomas f137d314e5 Fix issue with VS2017 2018-06-29 07:01:11 +02:00
Romain Thomas f665c78033 Update readme 2018-06-29 07:00:54 +02:00
Romain Thomas 957384cd36 Add ELF dtor functions 2018-06-28 16:49:55 +02:00
Romain Thomas 31a4b19c54 Update tests 2018-06-28 16:14:00 +02:00
Romain Thomas cc9dd14863 Fix error between FINI_ARRAY and INIT_ARRAY 2018-06-28 16:12:31 +02:00
Romain Thomas 0d9479b850 Fix link 2018-06-27 16:10:41 +02:00
Romain Thomas c3f99aebda Remove useless 'remove' 2018-06-27 16:10:03 +02:00
Romain Thomas d7582fcab9 Fix typo 2018-06-27 16:00:44 +02:00
Romain Thomas 86941c28cd Fix typo 2018-06-27 15:38:02 +02:00
Romain Thomas ed15e0968c Fix warnings 2018-06-27 15:30:22 +02:00
Romain Thomas 4866ead1a7 Update README 2018-06-27 15:27:54 +02:00
Romain Thomas 406115c8d0 Enhance Mach-O modification
* Add load command
  * Add sections
  * Add segments

Resolve #46 (partially)
2018-06-27 14:44:42 +02:00
Romain Thomas 5ec8956ba9 Fix missing Symbol version aux 2018-06-21 10:53:53 +02:00
Romain Thomas fd9ecaf8c6 Move to warning 2018-06-21 10:53:04 +02:00
Romain 149d352a49 Merge pull request #187 from 1orenz0/master
[PE] Pad section contents when rebuilding binary
2018-06-20 05:18:40 +02:00
1orenz0 e1b19bd181 [PE] prevent integer underflow when padding sections 2018-06-20 00:01:34 +02:00
1orenz0 1524906483 [PE] Pad section contents when rebuilding binary
Some PE have sections with section.VirtualSize < section.SizeOfRawData,
which is usually padded with zeroes. In that case, the PE parser only
read the lesser of the two to get only the useful content.

However, when rebuilding the binary as-is, we need to re-pad thoses
sections, otherwise the NT loader won't recognized it as a valid PE.
2018-06-19 23:33:18 +02:00
Romain Thomas 3098193227 Fix #186 2018-06-19 15:51:25 +02:00
Romain Thomas 67d924a220 Add constructor functions in the abstract layer
New API:
  * LIEF::ELF::Binary::get_relocation
  * LIEF::Binary::ctor_functions
2018-06-19 15:27:35 +02:00
Romain Thomas 6e7e373660 Update test 2018-06-19 10:48:41 +02:00
Romain Thomas fa5790ca80 Update tests 2018-06-19 10:25:25 +02:00
Romain Thomas a9f3cb8f9b Enable to add relocation associated with symbol
Resolve #184
2018-06-19 09:59:29 +02:00
Romain cd9cb41687 Merge pull request #183 from serge-sans-paille/fix/do-not-distribute-utf8
exception-free headers
2018-06-15 20:23:12 +02:00
Romain Thomas 69a8c4fcd0 Merge branch 'pr/171' 2018-06-15 20:20:51 +02:00
yd0b0N d26f398296 Support for building foreign-endian ELF binaries 2018-06-15 20:19:16 +02:00
serge-sans-paille 4bc623f341 Move filesystem headers to the private namespace 2018-06-15 15:58:25 +02:00
serge-sans-paille 00aad800ae Do not throw in public headers
especially for checks that are typically asserts.
2018-06-15 15:58:25 +02:00
serge-sans-paille f2f09d9c6d Do not distribute utf8 headers
They are part of the private interface, move them to the right place.
2018-06-15 15:08:44 +02:00
Romain Thomas 03529285df Update formating 2018-06-12 11:06:48 +02:00
Romain Thomas 310cf5a690 Fix typo 2018-06-12 10:43:07 +02:00
1125 changed files with 62923 additions and 34491 deletions
+86 -99
View File
@@ -1,59 +1,25 @@
version: 0.7.{build}
image: Visual Studio 2017
image: Visual Studio 2019
clone_folder: c:\projects\lief
configuration: Release
#clone_depth: 3
services:
- docker
platform:
- x86
- x64
#cache:
# - rang_cpp_color-prefix -> CMakeLists.txt
# - mbed_tls -> CMakeLists.txt
# - libjson-prefix -> CMakeLists.txt
# - easyloggingpp-prefix -> CMakeLists.txt
# - tests\YAMLCPP -> tests\CMakeLists.txt
# - tests\lief-samples -> tests\CMakeLists.txt
# - tests\catch -> tests\CMakeLists.txt
# - api\python\pybind11-prefix -> api\python\CMakeLists.txt
environment:
LIEF_AUTOMATIC_BUILDS_KEY:
secure: TT7SXISIifq2/tf02n2ATgPj+Ky4Cjl3Fg44BAfyI4yRa4i87UAQIx5EFeV63+Xv2rhcU7JcMgl+An7QBrV6ofuQ9jxbuw+Gd1GqcCrAIyY=
LIEF_AUTOMATIC_BUILDS_IV:
secure: /S6Vbt3vEisoC81siFbkqOXQeVnwxLZZPMYp1r79G7h+HFjLlWUZSidxxpsAgHNE
SCCACHE_CACHE_SIZE: "750M"
SCCACHE_DIR: C:\Users\appveyor\AppData\Local\Mozilla\sccache
SCCACHE_ERROR_LOG: C:\projects\sccache.log
matrix:
# Python 2.7
- PYTHON_VERSION: "2.7"
PYTHON32_PATH: "C:\\Python27"
PYTHON32_INCLUDE: "C:\\Python27\\include"
PYTHON32_BINARY: "C:\\Python27\\python.exe"
PYTHON32_LIBRARY: "C:\\Python27\\libs\\python27.lib"
PYTHON64_PATH: "C:\\Python27-x64"
PYTHON64_INCLUDE: "C:\\Python27-x64\\include"
PYTHON64_BINARY: "C:\\Python27-x64\\python.exe"
PYTHON64_LIBRARY: "C:\\Python27-x64\\libs\\python27.lib"
LIEF_TEST_SHARED: "OFF"
LIEF_TEST_STATIC: "ON"
# Python 3.5
- PYTHON_VERSION: "3.5"
PYTHON32_PATH: "C:\\Python35"
PYTHON32_INCLUDE: "C:\\Python35\\include"
PYTHON32_BINARY: "C:\\Python35\\python.exe"
PYTHON32_LIBRARY: "C:\\Python35\\libs\\python35.lib"
PYTHON64_PATH: "C:\\Python35-x64"
PYTHON64_INCLUDE: "C:\\Python35-x64\\include"
PYTHON64_BINARY: "C:\\Python35-x64\\python.exe"
PYTHON64_LIBRARY: "C:\\Python35-x64\\libs\\python35.lib"
LIEF_TEST_SHARED: "ON"
LIEF_TEST_STATIC: "OFF"
# Python 3.6
- PYTHON_VERSION: "3.6"
PYTHON32_PATH: "C:\\Python36"
@@ -64,89 +30,110 @@ environment:
PYTHON64_INCLUDE: "C:\\Python36-x64\\include"
PYTHON64_BINARY: "C:\\Python36-x64\\python.exe"
PYTHON64_LIBRARY: "C:\\Python36-x64\\libs\\python36.lib"
LIEF_TEST_SHARED: "ON"
LIEF_TEST_STATIC: "ON"
# Python 3.7
- PYTHON_VERSION: "3.7"
PYTHON32_PATH: "C:\\Python37"
PYTHON32_INCLUDE: "C:\\Python37\\include"
PYTHON32_BINARY: "C:\\Python37\\python.exe"
PYTHON32_LIBRARY: "C:\\Python37\\libs\\python37.lib"
PYTHON64_PATH: "C:\\Python37-x64"
PYTHON64_INCLUDE: "C:\\Python37-x64\\include"
PYTHON64_BINARY: "C:\\Python37-x64\\python.exe"
PYTHON64_LIBRARY: "C:\\Python37-x64\\libs\\python37.lib"
matrix:
fast_finish: true # set this flag to immediately finish build once one of the jobs fails.
allow_failures:
- platform: x86
configuration: Release
- platform: x64
configuration: Release
# Python 3.8
- PYTHON_VERSION: "3.8"
PYTHON32_PATH: "C:\\Python38"
PYTHON32_INCLUDE: "C:\\Python38\\include"
PYTHON32_BINARY: "C:\\Python38\\python.exe"
PYTHON32_LIBRARY: "C:\\Python38\\libs\\python38.lib"
PYTHON64_PATH: "C:\\Python38-x64"
PYTHON64_INCLUDE: "C:\\Python38-x64\\include"
PYTHON64_BINARY: "C:\\Python38-x64\\python.exe"
PYTHON64_LIBRARY: "C:\\Python38-x64\\libs\\python38.lib"
# Python 3.9
- PYTHON_VERSION: "3.9"
PYTHON32_PATH: "C:\\Python39"
PYTHON32_INCLUDE: "C:\\Python39\\include"
PYTHON32_BINARY: "C:\\Python39\\python.exe"
PYTHON32_LIBRARY: "C:\\Python39\\libs\\python39.lib"
PYTHON64_PATH: "C:\\Python39-x64"
PYTHON64_INCLUDE: "C:\\Python39-x64\\include"
PYTHON64_BINARY: "C:\\Python39-x64\\python.exe"
PYTHON64_LIBRARY: "C:\\Python39-x64\\libs\\python39.lib"
cache:
- '%SCCACHE_DIR%'
install:
- cmd: choco install sccache
- cmd: sccache.exe --start-server
- ps: if ($env:PLATFORM -eq "x64") { $env:CMAKE_ARCH = "x64" }
- ps: if ($env:PLATFORM -eq "x64") { $env:PYTHON_PATH = $env:PYTHON64_PATH }
- ps: if ($env:PLATFORM -eq "x64") { $env:PYTHON_PATH = $env:PYTHON64_PATH }
- ps: if ($env:PLATFORM -eq "x64") { $env:PYTHON_INCLUDE = $env:PYTHON64_INCLUDE }
- ps: if ($env:PLATFORM -eq "x64") { $env:PYTHON_BINARY = $env:PYTHON64_BINARY }
- ps: if ($env:PLATFORM -eq "x64") { $env:PYTHON_BINARY = $env:PYTHON64_BINARY }
- ps: if ($env:PLATFORM -eq "x64") { $env:PYTHON_LIBRARY = $env:PYTHON64_LIBRARY }
- ps: if ($env:PLATFORM -eq "x86") { $env:PYTHON_PATH = $env:PYTHON32_PATH }
- ps: if ($env:PLATFORM -eq "x86") { $env:PYTHON_PATH = $env:PYTHON32_PATH }
- ps: if ($env:PLATFORM -eq "x86") { $env:PYTHON_INCLUDE = $env:PYTHON32_INCLUDE }
- ps: if ($env:PLATFORM -eq "x86") { $env:PYTHON_BINARY = $env:PYTHON32_BINARY }
- ps: if ($env:PLATFORM -eq "x86") { $env:PYTHON_BINARY = $env:PYTHON32_BINARY }
- ps: if ($env:PLATFORM -eq "x86") { $env:PYTHON_LIBRARY = $env:PYTHON32_LIBRARY }
- set PATH=%PYTHON_PATH%;%PATH%
# Upgrade pip
- python.exe -m pip install --disable-pip-version-check --user --upgrade pip
- python.exe -m pip install --user wheel mako
- python.exe -m pip install --upgrade setuptools
build_script:
- >
cmake -A "%CMAKE_ARCH%"
-DLIEF_TESTS=on
-DLIEF_PYTHON_API=on
-DLIEF_COMPILER_JOBS=4
-DPYTHON_VERSION=%PYTHON_VERSION%
-DPYTHON_INCLUDE_DIR=%PYTHON_INCLUDE%
-DPYTHON_EXECUTABLE=%PYTHON_BINARY%
-DPYTHON_LIBRARY=%PYTHON_LIBRARY%
-DLIEF_TEST_SHARED=%LIEF_TEST_SHARED%
-DLIEF_TEST_STATIC=%LIEF_TEST_STATIC%
- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- cmake --build . --config Release --target lief_samples -- /v:m /logger:%MSBuildLogger%
- cmake .
- cmake --build . --config Release --target ALL_BUILD -- /v:m /logger:%MSBuildLogger%
test_script:
- cmake --build . --config Release --target lief_samples -- /v:m /logger:%MSBuildLogger%
- cmake .
- cmake --build . --config Release --target check-lief -- /v:m /logger:%MSBuildLogger%
- cd %APPVEYOR_BUILD_FOLDER%
- python.exe .\setup.py --ninja --lief-test build bdist_wheel --skip-build && exit 0 # Ignore warnings...
- ps: if ($env:PYTHON_VERSION -eq "3.9") { python.exe .\scripts\windows\package_sdk.py }
after_build:
- cmake --build . --config Release --target package -- /v:m /logger:%MSBuildLogger%
- cd api\python
- python.exe .\setup.py bdist_egg && exit 0 # Ignore warnings...
- ps: if ($env:APPVEYOR_REPO_TAG -eq "true") { python.exe .\setup.py sdist --formats=zip } # Ignore warnings...
- ps: if ($env:APPVEYOR_REPO_TAG -eq "false") { python.exe .\setup.py sdist --dev --formats=zip } # Ignore warnings...
- cd ..\..
- bash ./.github/deploy.sh
- ps: Get-Service -Name 'ssh-agent' | Set-Service -StartupType Manual
- ps: Start-Service -Name 'ssh-agent'
- cd %APPVEYOR_BUILD_FOLDER%
- ps: docker pull liefproject/deploy:latest
- ps: |
docker run `
-v ${PWD}:/src `
-e APPVEYOR="true" `
-e APPVEYOR_PULL_REQUEST_NUMBER="$env:APPVEYOR_PULL_REQUEST_NUMBER" `
-e APPVEYOR_REPO_NAME="$env:APPVEYOR_REPO_NAME" `
-e APPVEYOR_REPO_TAG_NAME="$env:APPVEYOR_REPO_TAG_NAME" `
-e APPVEYOR_REPO_BRANCH="$env:APPVEYOR_REPO_BRANCH" `
-e APPVEYOR_BUILD_FOLDER="$env:APPVEYOR_BUILD_FOLDER" `
-e LIEF_AUTOMATIC_BUILDS_KEY="$env:LIEF_AUTOMATIC_BUILDS_KEY" `
-e LIEF_AUTOMATIC_BUILDS_IV="$env:LIEF_AUTOMATIC_BUILDS_IV" `
--rm `
liefproject/deploy python3 /src/.github/deploy.py
$host.SetShouldExit(0)
on_finish:
- cmd: sccache.exe --stop-server
artifacts:
- path: '*.zip'
- path: 'dist\*.whl'
name: python-wheel
- path: 'build\*.zip'
name: sdk
- path: 'api\python\dist\*.zip'
name: python-src
- path: 'api\python\dist\*.egg'
name: python-egg
deploy:
description: "LIEF version $(APPVEYOR_REPO_TAG_NAME)"
provider: GitHub
auth_token:
secure: FU9CGrZ1lm0VDHUZg6zvTL4tidluDvRegVUTehCRo2xgiOv6NZePi7TdSy5CsOdG
artifact: sdk;python-src;python-egg
draft: false
prerelease: false
force_update: true
on:
appveyor_repo_tag: true # deploy on tag push only
#deploy:
# description: "LIEF version $(APPVEYOR_REPO_TAG_NAME)"
# provider: GitHub
# auth_token:
# secure: FU9CGrZ1lm0VDHUZg6zvTL4tidluDvRegVUTehCRo2xgiOv6NZePi7TdSy5CsOdG
# artifact: sdk;python-wheel
# draft: false
# prerelease: false
# force_update: true
# on:
# appveyor_repo_tag: true # deploy on tag push only
+62
View File
@@ -0,0 +1,62 @@
version: 2.1
jobs:
build:
macos:
xcode: 12.3.0
steps:
- checkout:
path: ~/LIEF
- restore_cache:
keys:
- ccache-{{ arch }}-{{ .Branch }}
- ccache-{{ arch }}-master
- ccache-{{ arch }}
- pyenv
- run:
name: Install pyenv
command: |
brew install pyenv
pyenv root
pyenv install --list
- run:
name: Install ccache
command: brew install ccache
- run:
name: Install ninja
command: brew install ninja
- run:
name: CCache initialization
command: |
ccache --show-stats
ccache --zero-stats
ccache --max-size=10.0G
ccache --set-config=compiler_check=content
- run:
name: LIEF build setup
command: |
export PYTHON_CONFIGURE_OPTS="--enable-shared --enable-unicode=ucs2"
pyenv install --skip-existing 3.9.0
export PYTHON_BINARY=$(pyenv root)/versions/3.9.0/bin/python3.9
$PYTHON_BINARY -m pip install --upgrade pip setuptools wheel
$PYTHON_BINARY ./setup.py --ninja --lief-test build bdist_wheel
bash scripts/osx/package_sdk.sh
- run:
name: LIEF deploy
command: |
export PYTHON_BINARY=$(pyenv root)/versions/3.9.0/bin/python3.9
$PYTHON_BINARY -m pip install --upgrade requests mako
$PYTHON_BINARY .github/deploy.py
- run:
name: ccache stats
when: always
command: |
ccache --show-stats
- save_cache:
key: 'ccache-{{ arch }}-{{ .Branch }}'
paths: [ "/home/circleci/.ccache" ]
- save_cache:
key: 'pyenv'
paths: [ "/home/circleci/.pyenv" ]
+1 -10
View File
@@ -1,10 +1 @@
*
!src
!doc
!tests
!include
!examples
!api
!CMakeLists.txt
!CMakeModules
!package
build
+25
View File
@@ -0,0 +1,25 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: romainthomas
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
**Expected behavior**
A clear and concise description of what you expected to happen.
**Environment (please complete the following information):**
- System and Version : [e.g. Ubuntu 16.04]
- Target format (PE, ELF, Mach-O)
- LIEF commit version: ``python -c "import lief;print(lief.__version__)"`` or the one from ``LIEF/config.h``
**Additional context**
Add any other context about the problem here.
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+407
View File
@@ -0,0 +1,407 @@
#!/usr/bin/env python3
import sys
import os
import re
import logging
import pathlib
import subprocess
import shutil
import json
from datetime import datetime
from mako.template import Template
from enum import Enum, auto
class CI(Enum):
UNKNOWN = auto()
TRAVIS = auto()
APPVEYOR = auto()
GITLAB_CI = auto()
CIRCLE_CI = auto()
GITHUB_ACTIONS = auto()
AZURE = auto()
LOCAL = auto()
def pretty_ci_name(ci):
return str(ci).split(".")[-1].replace("_", "-").lower()
def is_pr(ci):
if ci == CI.TRAVIS:
cond1 = os.getenv("TRAVIS_EVENT_TYPE", "pull_request") == "pull_request"
cond2 = not (os.getenv("TRAVIS_REPO_SLUG", "").startswith("lief-project/") or os.getenv("TRAVIS_REPO_SLUG", "").startswith("romainthomas/LIEF"))
return cond1 or cond2
elif ci == CI.APPVEYOR:
logger.info("%s - %s", os.getenv("APPVEYOR_PULL_REQUEST_NUMBER", -1), os.getenv("APPVEYOR_REPO_NAME", ""))
pr_number = os.getenv("APPVEYOR_PULL_REQUEST_NUMBER", "")
cond1 = len(pr_number) != 0 and int(pr_number) >= 0
cond2 = not (os.getenv("APPVEYOR_REPO_NAME", "").startswith("lief-project/") or os.getenv("APPVEYOR_REPO_NAME", "").startswith("romainthomas/"))
return cond1 or cond2
elif ci == CI.CIRCLE_CI:
cond1 = int(os.getenv("CIRCLE_PR_NUMBER", -1)) >= 0
cond2 = os.getenv("CIRCLE_PROJECT_USERNAME", "") != "lief-project" and os.getenv("CIRCLE_PROJECT_USERNAME", "") != "romainthomas"
return cond1 or cond2
elif ci == CI.GITHUB_ACTIONS:
cond1 = os.getenv("GITHUB_HEAD_REF", "") != ""
cond2 = not (os.getenv("GITHUB_REPOSITORY", "").startswith("lief-project/") or os.getenv("GITHUB_REPOSITORY", "").startswith("romainthomas/LIEF"))
return cond1 or cond2
elif ci == CI.LOCAL:
return False
return True
def get_branch(ci):
if ci == CI.TRAVIS:
return os.getenv("TRAVIS_BRANCH")
elif ci == CI.APPVEYOR:
return os.getenv("APPVEYOR_REPO_BRANCH")
elif ci == CI.CIRCLE_CI:
return os.getenv("CIRCLE_BRANCH")
elif ci == CI.GITHUB_ACTIONS:
return os.getenv("GITHUB_REF").replace("refs/heads/", "")
elif ci == CI.LOCAL:
return os.getenv("CI_BRANCH")
return None
def get_ci_workdir(ci):
if ci == CI.CIRCLE_CI:
return os.getenv("CIRCLE_WORKING_DIRECTORY")
elif ci == CI.TRAVIS:
return os.getenv("TRAVIS_BUILD_DIR")
elif ci == CI.APPVEYOR:
return os.getenv("APPVEYOR_BUILD_FOLDER")
elif ci == CI.GITHUB_ACTIONS:
return os.getenv("GITHUB_WORKSPACE")
elif ci == CI.LOCAL:
return os.getenv("CI_WORKING_DIR")
else:
logger.critical("Unsupported CI to resolve working directory")
sys.exit(1)
def get_tag(ci):
if ci == CI.CIRCLE_CI:
return os.getenv("CIRCLE_TAG", "")
elif ci == CI.TRAVIS:
return os.getenv("TRAVIS_TAG", "")
elif ci == CI.APPVEYOR:
if "APPVEYOR_REPO_TAG_NAME" in os.environ:
return os.getenv("APPVEYOR_REPO_TAG_NAME", "")
return ""
elif ci == CI.GITHUB_ACTIONS:
ref = os.getenv("GITHUB_REF", "")
logger.info("Github Action tag: {}".format(ref))
if ref.startswith("refs/tags/"):
return ref.replace("refs/tags/", "")
return ""
elif ci == CI.LOCAL:
return os.getenv("CI_TAG")
else:
logger.critical("Unsupported CI to resolve working directory")
sys.exit(1)
LOG_LEVEL = logging.DEBUG
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
logging.getLogger().setLevel(LOG_LEVEL)
logger = logging.getLogger(__name__)
CURRENT_CI = CI.UNKNOWN
# Detect CI
# ===========================================
if os.getenv("TRAVIS", None) is not None:
CURRENT_CI = CI.TRAVIS
elif os.getenv("APPVEYOR", None) is not None:
CURRENT_CI = CI.APPVEYOR
elif os.getenv("GITHUB_ACTIONS", None) is not None:
CURRENT_CI = CI.GITHUB_ACTIONS
elif os.getenv("GITLAB_CI", None) is not None:
CURRENT_CI = CI.GITLAB_CI
elif os.getenv("CI_LOCAL", "") == "true":
CURRENT_CI = CI.LOCAL
else:
logger.error("Can't detect CI!")
sys.exit(1)
# TODO(romain): Azure
CI_PRETTY_NAME = pretty_ci_name(CURRENT_CI)
logger.info("CI: %s", CI_PRETTY_NAME)
ALLOWED_BRANCHES = {"master", "deploy", "devel"}
BRANCH_NAME = get_branch(CURRENT_CI)
TAG_NAME = get_tag(CURRENT_CI)
IS_TAGGED = TAG_NAME is not None and len(TAG_NAME) > 0
logger.info("Branch: %s", BRANCH_NAME)
logger.info("Tag: %s", TAG_NAME)
if BRANCH_NAME not in ALLOWED_BRANCHES and not IS_TAGGED:
logger.info("Skip deployment for branch '%s'", BRANCH_NAME)
sys.exit(0)
if is_pr(CURRENT_CI):
logger.info("Skip pull request")
sys.exit(0)
CURRENTDIR = pathlib.Path(__file__).resolve().parent
REPODIR = CURRENTDIR.parent
DEPLOY_KEY = os.getenv("LIEF_AUTOMATIC_BUILDS_KEY", None)
DEPLOY_IV = os.getenv("LIEF_AUTOMATIC_BUILDS_IV", None)
if DEPLOY_KEY is None or len(DEPLOY_KEY) == 0:
logger.error("Deploy key is not set!")
sys.exit(1)
if DEPLOY_IV is None or len(DEPLOY_IV) == 0:
logger.error("Deploy IV is not set!")
sys.exit(1)
GIT_USER = "lief-{}-ci".format(CI_PRETTY_NAME)
GIT_EMAIL = "lief@quarkslab.com"
CI_CWD = pathlib.Path(get_ci_workdir(CURRENT_CI))
if CI_CWD is None:
logger.debug("Can't resolve CI working dir")
sys.exit(1)
LIEF_PACKAGE_REPO = "https://github.com/lief-project/packages.git"
LIEF_PACKAGE_DIR = REPODIR / "deploy-packages"
LIEF_PACKAGE_SSH_REPO = "git@github.com:lief-project/packages.git"
SDK_PACKAGE_DIR = LIEF_PACKAGE_DIR / "sdk"
PYPI_PACKAGE_DIR = LIEF_PACKAGE_DIR / "lief"
JSON_PACKAGE = LIEF_PACKAGE_DIR / "packages.json"
DIST_DIR = REPODIR / "dist"
BUILD_DIR = REPODIR / "build"
logger.debug("Working directory: %s", CI_CWD)
SSH_DIR = pathlib.Path("~/.ssh").expanduser().resolve()
PYTHON = shutil.which("python")
GIT = shutil.which("git")
TAR = shutil.which("tar")
OPENSSL = shutil.which("openssl")
MV = shutil.which("mv")
RM = shutil.which("rm")
SSH_AGENT = shutil.which("ssh-agent")
SSH_ADD = shutil.which("ssh-add")
SSH_KEYSCAN = shutil.which("ssh-keyscan")
if DEPLOY_KEY is None:
logger.error("Deploy key is not set!")
sys.exit(1)
if DEPLOY_IV is None:
logger.error("Deploy IV is not set!")
sys.exit(1)
#####################
# Clone package repo
#####################
target_branch = "gh-pages"
if BRANCH_NAME != "master":
target_branch = "packages-{}".format(BRANCH_NAME.replace("/", "-").replace("_", "-"))
if IS_TAGGED:
target_branch = str(TAG_NAME)
new_branch = False
if not LIEF_PACKAGE_DIR.is_dir():
cmd = "{} clone --branch={} -j8 --single-branch {} {}".format(GIT, target_branch, LIEF_PACKAGE_REPO, LIEF_PACKAGE_DIR)
p = subprocess.Popen(cmd, shell=True, cwd=REPODIR, stderr=subprocess.STDOUT)
p.wait()
if p.returncode:
cmd = "{} clone --branch=master -j8 --single-branch {} {}".format(GIT, LIEF_PACKAGE_REPO, LIEF_PACKAGE_DIR)
pmaster = subprocess.Popen(cmd, shell=True, cwd=REPODIR, stderr=subprocess.STDOUT)
pmaster.wait()
if pmaster.returncode:
sys.exit(1)
new_branch = True
cmd = "{} checkout --orphan {}".format(GIT, target_branch)
pmaster = subprocess.Popen(cmd, shell=True, cwd=LIEF_PACKAGE_DIR, stderr=subprocess.STDOUT)
pmaster.wait()
if pmaster.returncode:
sys.exit(1)
cmd = "{} reset --hard".format(GIT)
pmaster = subprocess.Popen(cmd, shell=True, cwd=LIEF_PACKAGE_DIR, stderr=subprocess.STDOUT)
pmaster.wait()
SDK_PACKAGE_DIR.mkdir(exist_ok=True)
PYPI_PACKAGE_DIR.mkdir(exist_ok=True)
packages_info = {}
new_packages_info = {}
if JSON_PACKAGE.is_file():
try:
packages_info = json.loads(JSON_PACKAGE.read_bytes())
except json.decoder.JSONDecodeError as e:
logger.error(e)
else:
JSON_PACKAGE.touch()
logger.info("CI: %s - %s", GIT_USER, GIT_EMAIL)
cmds = [
"{} config user.name '{}'".format(GIT, GIT_USER),
"{} config user.email '{}'".format(GIT, GIT_EMAIL),
"{} reset --soft root".format(GIT),
"{} ls-files -v".format(GIT),
]
for cmd in cmds:
p = subprocess.Popen(cmd, shell=True, cwd=LIEF_PACKAGE_DIR, stderr=subprocess.STDOUT)
p.wait()
if p.returncode:
sys.exit(1)
for file in DIST_DIR.glob("*.whl"):
logger.debug("Copying '%s' to '%s'", file.as_posix(), PYPI_PACKAGE_DIR.as_posix())
new_packages_info[file.name] = datetime.now().strftime('%Y-%m-%d-%H:%M:%S')
shutil.copy(file.as_posix(), PYPI_PACKAGE_DIR.as_posix())
for file in BUILD_DIR.glob("*.zip"):
logger.debug("Copying '%s' to '%s'", file.as_posix(), SDK_PACKAGE_DIR.as_posix())
new_packages_info[file.name] = datetime.now().strftime('%Y-%m-%d-%H:%M:%S')
shutil.copy(file.as_posix(), SDK_PACKAGE_DIR.as_posix())
for file in BUILD_DIR.glob("*.tar.gz"):
logger.debug("Copying '%s' to '%s'", file.as_posix(), SDK_PACKAGE_DIR.as_posix())
new_packages_info[file.name] = datetime.now().strftime('%Y-%m-%d-%H:%M:%S')
shutil.copy(file.as_posix(), SDK_PACKAGE_DIR.as_posix())
for k, v in new_packages_info.items():
logger.info("{:<30}: {}".format(k, v))
try:
packages_info.update(new_packages_info)
JSON_PACKAGE.write_text(json.dumps(packages_info))
except Exception as e:
logger.error(e)
INDEX_TEMPLATE = r"""
<html>
<title>Links for lief</title>
<body>
<h1>Links for lief</h1>
% for name in names:
<a href="${base_url}/${base}/${name}">${name}</a><br />
% endfor
</body>
</html>
"""
EXCLUDED = ['index.html', '.gitkeep']
BASE_URL = "https://lief-project.github.io"
fnames = [fname for fname in sorted(f.name for f in PYPI_PACKAGE_DIR.iterdir() if f.is_file() and f.name not in EXCLUDED)]
html = Template(INDEX_TEMPLATE).render(names=fnames, base_url=BASE_URL, base="packages/lief")
with open((PYPI_PACKAGE_DIR / "index.html").as_posix(), "w") as f:
f.write(html)
fnames = [fname for fname in sorted(f.name for f in SDK_PACKAGE_DIR.iterdir() if f.is_file() and f.name not in EXCLUDED)]
html = Template(INDEX_TEMPLATE).render(names=fnames, base_url=BASE_URL, base="packages/sdk")
with open((SDK_PACKAGE_DIR / "index.html").as_posix(), "w") as f:
f.write(html)
if not SSH_DIR.is_dir():
SSH_DIR.mkdir(mode=0o700)
#fix_ssh_perms()
deploy_key_path = (REPODIR / ".github" / "deploy-key.enc").as_posix()
output_key_path = (REPODIR / ".git" / "deploy-key")
cmd = "{} aes-256-cbc -K {} -iv {} -in {} -out {} -d".format(
OPENSSL, DEPLOY_KEY, DEPLOY_IV, deploy_key_path, output_key_path.as_posix())
kwargs = {
'shell': True,
'cwd': REPODIR,
'stdout': subprocess.DEVNULL,
'stderr': subprocess.DEVNULL,
}
p = subprocess.Popen(cmd, **kwargs)
p.wait()
if p.returncode:
sys.exit(1)
output_key_path.chmod(0o600)
logger.info(output_key_path)
process = subprocess.run(SSH_AGENT, stdout=subprocess.PIPE, universal_newlines=True, stderr=subprocess.STDOUT)
OUTPUT_PATTERN = re.compile(r'SSH_AUTH_SOCK=(?P<socket>[^;]+).*SSH_AGENT_PID=(?P<pid>\d+)', re.MULTILINE | re.DOTALL)
match = OUTPUT_PATTERN.search(process.stdout)
if match is None:
logger.error("Can't start ssh-agent")
sys.exit(1)
agent_data = match.groupdict()
logger.info(f'ssh agent data: {agent_data!s}')
logger.info('Exporting ssh agent environment variables' )
os.environ['SSH_AUTH_SOCK'] = agent_data['socket']
os.environ['SSH_AGENT_PID'] = agent_data['pid']
process = subprocess.run([SSH_ADD, output_key_path], stderr=subprocess.STDOUT)
if process.returncode != 0:
raise Exception(f'Failed to add the key: {output_key_path}')
known_hosts = (SSH_DIR / "known_hosts").as_posix()
cmd = "{} -H github.com >> {}".format(SSH_KEYSCAN, known_hosts)
kwargs = {
'shell': True,
'cwd': REPODIR,
'stderr': subprocess.STDOUT,
}
p = subprocess.Popen(cmd, **kwargs)
p.wait()
if p.returncode:
sys.exit(1)
commit_msg = 'Automatic deployment by {}'.format(CI_PRETTY_NAME)
cmds = [
"{} add .".format(GIT),
"{} commit -m '{}'".format(GIT, commit_msg),
"{} ls-files -v".format(GIT),
]
for cmd in cmds:
logger.info("Running %s", cmd)
p = subprocess.Popen(cmd, shell=True, cwd=LIEF_PACKAGE_DIR, stderr=subprocess.STDOUT)
p.wait()
if p.returncode:
logger.error("Error while running %s", cmd)
sys.exit(1)
for i in range(10):
p = subprocess.Popen("{} push --force {} {}".format(GIT, LIEF_PACKAGE_SSH_REPO, target_branch),
shell=True, cwd=LIEF_PACKAGE_DIR, stderr=subprocess.STDOUT)
p.wait()
if p.returncode == 0:
break
cmds = [
"{} branch -a -v".format(GIT),
"{} fetch -v origin {}".format(GIT, target_branch),
"{} branch -a -v".format(GIT),
"{} rebase -s recursive -X theirs FETCH_HEAD".format(GIT),
"{} branch -a -v".format(GIT),
]
for c in cmds:
p = subprocess.Popen(c, shell=True, cwd=LIEF_PACKAGE_DIR, stderr=subprocess.STDOUT)
p.wait()
else:
logger.critical("Can't push file on %s -> %s", LIEF_PACKAGE_SSH_REPO, target_branch)
sys.exit(1)
output_key_path.unlink()
logger.info("Done!")
-181
View File
@@ -1,181 +0,0 @@
#! /bin/bash
## vim:set ts=4 sw=4 et:
#
# Automatic build of LIEF
# Repo: https://github.com/lief-project/packages
# Mostly inspired by https://github.com/upx/upx-automatic-builds
set -e; set -o pipefail
if [[ $TRAVIS_OS_NAME == osx ]]; then
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
else
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
fi
set -x # debug
if [[ $TRAVIS_OS_NAME == osx ]]; then
# use GNU coreutils ("brew install coreutils")
date() {
gdate "$@"
}
readlink() {
greadlink "$@"
}
sha256sum() {
gsha256sum "$@"
}
fi
if [[ -n $APPVEYOR_JOB_ID ]]; then
openssl() {
/usr/bin/openssl "$@"
}
sort() {
/usr/bin/sort "$@"
}
fi
fix_home_ssh_perms() {
if [[ -d ~/.ssh ]]; then
if [[ -x /usr/sbin/restorecon ]]; then
/usr/sbin/restorecon -v -R ~/.ssh || true
fi
chmod -c -R go-rwx ~/.ssh || true
fi
}
# =================
# SETUP BRANCH NAME
# =================
branch=
if [[ -n $APPVEYOR_JOB_ID ]]; then
branch=$APPVEYOR_REPO_BRANCH
if [[ -n $APPVEYOR_PULL_REQUEST_NUMBER ]]; then exit 0; fi
else
branch=$TRAVIS_BRANCH
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi
fi
case $branch in
devel*) ;;
master*) ;;
deploy*) ;;
*) exit 0;;
esac
# get $rev, $branch and $git_user
LIEF_SRCDIR=
[[ -z $LIEF_SRCDIR ]] && LIEF_SRCDIR=$(readlink -mn -- $argv0dir/..)
cd / && cd $LIEF_SRCDIR || exit 1
rev=$(git rev-parse --verify HEAD)
timestamp=$(git log -n1 --format='%at' $rev)
date=$(TZ=UTC0 date -d "@$timestamp" '+%Y%m%d-%H%M%S')
#branch="$branch-$date-${rev:0:6}"
branch="lief-$branch-latest"
if [[ -n $APPVEYOR_JOB_ID ]]; then
branch="$branch"
git_user="AppVeyor CI"
else
branch="$branch"
git_user="Travis CI"
fi
unset timestamp date
# ========================
# SETUP 'deploy' DIRECTORY
# ========================
if [[ -n $APPVEYOR_JOB_ID ]]; then
[[ -z $LIEF_BUILDDIR ]] && LIEF_BUILDDIR=$(readlink -mn -- .)
else
[[ -z $LIEF_BUILDDIR ]] && LIEF_BUILDDIR=$(readlink -mn -- ./build)
fi
echo $LIEF_BUILDDIR
cd / && cd $LIEF_BUILDDIR || exit 1
mkdir deploy || exit 1
chmod 700 deploy
cd deploy || exit 1
# ==================
# CLONE - ADD - PUSH
# ==================
new_branch=0
if ! git clone -b "$branch" --single-branch https://github.com/lief-project/packages.git; then
git clone -b master --single-branch https://github.com/lief-project/packages.git
new_branch=1
fi
cd packages || exit 1
chmod 700 .git
git config user.name "$git_user"
git config user.email "lief@quarkslab.com"
if [[ $new_branch == 1 ]]; then
git checkout --orphan "$branch"
git reset --hard || true
fi
git reset --soft `git rev-list --all | tail -1`
git ls-files -v
/bin/cp -rf $LIEF_BUILDDIR/api/python/dist/*.zip .
/bin/cp -rf $LIEF_BUILDDIR/api/python/dist/*.egg .
if [[ -n $APPVEYOR_JOB_ID ]]; then
/bin/cp -rf $LIEF_BUILDDIR/*.zip .
else
/bin/cp -rf $LIEF_BUILDDIR/*.tar.gz .
fi
git add .
if git diff --cached --exit-code --quiet >/dev/null; then
# nothing to do ???
exit 0
fi
now=$(date '+%s')
git commit --date="$now" -m "Automatic build - ${rev:0:7} - Python ${PYTHON_VERSION}"
git ls-files -v
git log --pretty=fuller
umask 077
[[ -d ~/.ssh ]] || mkdir ~/.ssh
fix_home_ssh_perms
repo=$(git config remote.origin.url)
ssh_repo=${repo/https:\/\/github.com\//git@github.com:}
eval $(ssh-agent -s)
set +x # IMPORTANT
openssl aes-256-cbc -K $LIEF_AUTOMATIC_BUILDS_KEY -iv $LIEF_AUTOMATIC_BUILDS_IV -in "$LIEF_SRCDIR/.github/deploy-key.enc" -out .git/deploy-key -d
set -x
chmod 600 .git/deploy-key
ssh-add .git/deploy-key
fix_home_ssh_perms
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
fix_home_ssh_perms
#
let i=0 || true
while true; do
if [[ $i -ge 10 ]]; then
echo "ERROR: git push failed"
exit 1
fi
if [[ $new_branch == 1 ]]; then
if git push --force -u $ssh_repo "$branch"; then break; fi
else
if git push --force $ssh_repo "$branch"; then break; fi
fi
git branch -a -v
git fetch -v origin "$branch"
git branch -a -v
git rebase -s recursive -X theirs FETCH_HEAD
git branch -a -v
sleep $((RANDOM % 5 + 1))
let i+=1
done
exit 0
+42
View File
@@ -0,0 +1,42 @@
""" Build index from directory listing
From: https://stackoverflow.com/questions/39048654/how-to-enable-directory-indexing-on-github-pages
make_index.py </path/to/directory>
"""
INDEX_TEMPLATE = r"""
<html>
<title>Links for lief</title>
<body>
<h1>Links for lief</h1>
% for name in names:
<a href="${base_url}/${base}/${name}">${name}</a><br />
% endfor
</body>
</html>
"""
EXCLUDED = ['index.html', '.gitkeep']
BASE_URL = "https://lief-project.github.io"
import os
import argparse
# May need to do "pip install mako"
from mako.template import Template
def main():
parser = argparse.ArgumentParser()
parser.add_argument("directory")
parser.add_argument("--base")
parser.add_argument("--output")
args = parser.parse_args()
fnames = [fname for fname in sorted(os.listdir(args.directory))
if fname not in EXCLUDED]
html = Template(INDEX_TEMPLATE).render(names=fnames, base_url=BASE_URL, base=args.base)
with open(args.output, "w") as f:
f.write(html)
if __name__ == '__main__':
main()
+3 -5
View File
@@ -1,5 +1,3 @@
#!/usr/bin/env python3.6
# Launch Docker CI when committing
# Inspired from https://medium.com/@zypherman/my-experiences-with-travis-ci-7f5ea26a87c0
@@ -21,7 +19,7 @@ logger = logging.getLogger(__name__)
AUTH_TOKEN = os.getenv("TRAVIS_TOKEN", sys.argv[1] if len(sys.argv) > 1 else None)
if not AUTH_TOKEN:
logger.fatal("No token found!")
logger.error("No token found!")
sys.exit(1)
LIEF_ID = 12579556
@@ -106,12 +104,12 @@ def trigger_build():
if remote_var:
r = requests.patch(f"{DOCKER}/env_var/{remote_var['id']}", data=json.dumps(env_var), headers=headers)
if not r.ok:
loggger.error(f"Error while setting variable: '{remote_var['name']}'")
logger.error(f"Error while setting variable: '{remote_var['name']}'")
sys.exit(1)
else:
result = requests.post(DOCKER_ENV_VARS_ENDPOINT, data=json.dumps(env_var), headers=headers)
if not result.ok:
loggger.error(f"Error while setting variable: '{env_var['env_var.name']}'")
logger.error(f"Error while setting variable: '{env_var['env_var.name']}'")
sys.exit(1)
# (Re)Start build
+63
View File
@@ -0,0 +1,63 @@
name: 'Android'
on: push
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
shell: bash
- name: ccache cache files
uses: actions/cache@v1.1.0
with:
path: ~/.ccache
key: android-${{ runner.os }}-${{ steps.get-date.outputs.date }}
restore-keys: |
android-${{ runner.os }}-
- name: Build ARM SDK
shell: bash
run: |
docker run \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-v $GITHUB_WORKSPACE:/work \
-v $HOME/.ccache:/ccache \
--rm liefproject/android-arm bash /work/scripts/docker/android-arm.sh
- name: Build AArch64 SDK
shell: bash
run: |
docker run \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-v $GITHUB_WORKSPACE:/work \
-v $HOME/.ccache:/ccache \
--rm liefproject/android-arm64 bash /work/scripts/docker/android-aarch64.sh
- name: Deploy
env:
LIEF_AUTOMATIC_BUILDS_KEY: ${{ secrets.LIEF_AUTOMATIC_BUILDS_KEY }}
LIEF_AUTOMATIC_BUILDS_IV: ${{ secrets.LIEF_AUTOMATIC_BUILDS_IV }}
shell: bash
run: |
docker run \
-v $GITHUB_WORKSPACE:/src \
-e GITHUB_ACTIONS="true" \
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
-e GITHUB_REF=$GITHUB_REF \
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e LIEF_AUTOMATIC_BUILDS_KEY=$LIEF_AUTOMATIC_BUILDS_KEY \
-e LIEF_AUTOMATIC_BUILDS_IV=$LIEF_AUTOMATIC_BUILDS_IV \
--rm \
liefproject/deploy python3 /src/.github/deploy.py
+54
View File
@@ -0,0 +1,54 @@
name: 'iOS'
on: push
jobs:
osx-sdk:
runs-on: macos-11.0
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install system dependencies
run: |
brew install cmake ninja ccache
python -m pip install --upgrade pip setuptools wheel
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
shell: bash
- name: Setup cache dir
shell: bash
run: |
mkdir -p ~/.ccache
- name: ccache cache files
uses: actions/cache@v1.1.0
with:
path: ~/.ccache
key: ios-${{ runner.os }}-${{ steps.get-date.outputs.date }}
restore-keys: |
ios-${{ runner.os }}-
- name: Build iOS SDK
shell: bash
env:
CCACHE_DIR: ~/.ccache
CCACHE_MAXSIZE: 10.0G
CCACHE_CPP2: 1
CCACHE_COMPRESS: 1
run: |
bash scripts/osx/package_ios.sh
- name: Deploy
env:
LIEF_AUTOMATIC_BUILDS_KEY: ${{ secrets.LIEF_AUTOMATIC_BUILDS_KEY }}
LIEF_AUTOMATIC_BUILDS_IV: ${{ secrets.LIEF_AUTOMATIC_BUILDS_IV }}
shell: bash
run: |
python -m pip install --upgrade requests mako
python .github/deploy.py
+71
View File
@@ -0,0 +1,71 @@
name: 'Linux AArch64'
on: push
jobs:
linux-sdk:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
shell: bash
- name: ccache cache files
uses: actions/cache@v1.1.0
with:
path: ~/.ccache
key: linux-aarch64-${{ runner.os }}-${{ steps.get-date.outputs.date }}
restore-keys: |
linux-aarch64-${{ runner.os }}-
- name: Build SDK
if: matrix.python-version == '3.9'
shell: bash
run: |
docker run \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-v $GITHUB_WORKSPACE:/work \
-v $HOME/.ccache:/ccache \
--rm liefproject/manylinux2014-aarch64 bash /work/scripts/docker/linux-aarch64.sh
- name: Build Python ${{ matrix.python-version }} wheel
shell: bash
env:
PYTHON_VERSION: ${{ matrix.python-version }}
run: |
PYTHON_VERSION2=$(echo "${PYTHON_VERSION}" | sed 's/\.//') # Transform 3.8 -> 38
docker run \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-e PYTHON_BINARY=/opt/python/cp${PYTHON_VERSION2}-cp${PYTHON_VERSION2}/bin/python${PYTHON_VERSION} \
-v $GITHUB_WORKSPACE:/work \
-v $HOME/.ccache:/ccache \
--rm liefproject/manylinux2014-aarch64 bash /work/scripts/docker/manylinux2014-aarch64.sh
- name: Deploy
env:
LIEF_AUTOMATIC_BUILDS_KEY: ${{ secrets.LIEF_AUTOMATIC_BUILDS_KEY }}
LIEF_AUTOMATIC_BUILDS_IV: ${{ secrets.LIEF_AUTOMATIC_BUILDS_IV }}
shell: bash
run: |
docker run \
-v $GITHUB_WORKSPACE:/src \
-e GITHUB_ACTIONS="true" \
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
-e GITHUB_REF=$GITHUB_REF \
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e LIEF_AUTOMATIC_BUILDS_KEY=$LIEF_AUTOMATIC_BUILDS_KEY \
-e LIEF_AUTOMATIC_BUILDS_IV=$LIEF_AUTOMATIC_BUILDS_IV \
--rm \
liefproject/deploy python3 /src/.github/deploy.py
+108
View File
@@ -0,0 +1,108 @@
name: 'Linux x86-64'
on: push
jobs:
linux-sdk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
shell: bash
- name: ccache cache files
uses: actions/cache@v1.1.0
with:
path: ~/.ccache
key: linux-x86-64-${{ runner.os }}-${{ steps.get-date.outputs.date }}
restore-keys: |
linux-x86-64-${{ runner.os }}-
- name: Build Python 3.7 wheel
shell: bash
env:
PYTHON_VERSION: 37
run: |
docker run --rm \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-e PYTHON_VERSION=$PYTHON_VERSION \
-e PYTHON_BINARY=/opt/python/cp37-cp37m/bin/python3.7 \
-v $GITHUB_WORKSPACE:/src \
-v $HOME/.ccache:/ccache \
liefproject/manylinux1_x86_64 bash /src/scripts/docker/travis-linux.sh
- name: Build Python 3.8 wheel
shell: bash
env:
PYTHON_VERSION: 38
run: |
docker run --rm \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-e PYTHON_VERSION=$PYTHON_VERSION \
-e PYTHON_BINARY=/opt/python/cp38-cp38/bin/python3.8 \
-v $GITHUB_WORKSPACE:/src \
-v $HOME/.ccache:/ccache \
liefproject/manylinux1_x86_64 bash /src/scripts/docker/travis-linux.sh
- name: Build Python 3.9 wheel
shell: bash
env:
PYTHON_VERSION: 39
run: |
docker run --rm \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-e PYTHON_VERSION=$PYTHON_VERSION \
-e PYTHON_BINARY=/opt/python/cp39-cp39/bin/python3.9 \
-v $GITHUB_WORKSPACE:/src \
-v $HOME/.ccache:/ccache \
liefproject/manylinux1_x86_64 bash /src/scripts/docker/travis-linux.sh
- name: Build SDK
shell: bash
run: |
docker run --name lief_sdk --rm \
-e PYTHON_BINARY=/opt/python/cp39-cp39/bin/python3.9 \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_DIR=/ccache \
-v $GITHUB_WORKSPACE:/src \
-v $HOME/.ccache:/ccache \
liefproject/manylinux1_x86_64 bash /src/scripts/docker/travis-linux-sdk.sh
- name: Deploy
env:
LIEF_AUTOMATIC_BUILDS_KEY: ${{ secrets.LIEF_AUTOMATIC_BUILDS_KEY }}
LIEF_AUTOMATIC_BUILDS_IV: ${{ secrets.LIEF_AUTOMATIC_BUILDS_IV }}
shell: bash
run: |
docker run \
-v $GITHUB_WORKSPACE:/src \
-e GITHUB_ACTIONS="true" \
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
-e GITHUB_REF=$GITHUB_REF \
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e LIEF_AUTOMATIC_BUILDS_KEY=$LIEF_AUTOMATIC_BUILDS_KEY \
-e LIEF_AUTOMATIC_BUILDS_IV=$LIEF_AUTOMATIC_BUILDS_IV \
--rm \
liefproject/deploy python3 /src/.github/deploy.py
- name: Trigger documentation
env:
CIRCLE_CI_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
shell: bash
run: |
docker run --rm \
-e CIRCLE_CI_TOKEN=$CIRCLE_CI_TOKEN \
liefproject/manylinux1_x86_64 \
bash -c "curl --request POST --url https://circleci.com/api/v2/project/gh/lief-project/doc/pipeline --header 'Circle-Token: ${CIRCLE_CI_TOKEN}' --header 'content-type: application/json'";
+70
View File
@@ -0,0 +1,70 @@
name: 'macOS'
on: push
jobs:
osx-sdk:
runs-on: macos-11.0
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
brew install cmake ninja ccache
python -m pip install --upgrade pip setuptools wheel
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
shell: bash
- name: Setup cache dir
shell: bash
run: |
mkdir -p ~/.ccache
- name: ccache cache files
uses: actions/cache@v1.1.0
with:
path: ~/.ccache
key: osx-${{ runner.os }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.date }}
restore-keys: |
osx-${{ runner.os }}-${{ matrix.python-version }}-
osx-${{ runner.os }}-
- name: Build Python ${{ matrix.python-version }} wheel
shell: bash
env:
MACOSX_DEPLOYMENT_TARGET: "10.14"
CCACHE_DIR: ~/.ccache
CCACHE_MAXSIZE: 10.0G
CCACHE_CPP2: 1
CCACHE_COMPRESS: 1
run: |
python ./setup.py --ninja build bdist_wheel --skip-build --plat-name=macosx_${MACOSX_DEPLOYMENT_TARGET}_x86_64
- name: Build SDK
shell: bash
if: matrix.python-version == '3.9' # Build the SDk only with Python 3.9
env:
MACOSX_DEPLOYMENT_TARGET: "10.14"
CCACHE_DIR: ~/.ccache
CCACHE_MAXSIZE: 10.0G
CCACHE_CPP2: 1
CCACHE_COMPRESS: 1
run: |
bash scripts/osx/package_sdk.sh
- name: Deploy
env:
LIEF_AUTOMATIC_BUILDS_KEY: ${{ secrets.LIEF_AUTOMATIC_BUILDS_KEY }}
LIEF_AUTOMATIC_BUILDS_IV: ${{ secrets.LIEF_AUTOMATIC_BUILDS_IV }}
shell: bash
run: |
python -m pip install --upgrade requests mako
python .github/deploy.py
+30
View File
@@ -0,0 +1,30 @@
name: LIEF Windows Tests
on: [pull_request]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
choco install ninja
python -m pip install --upgrade pip setuptools
python -m pip install wheel mako
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
- name: Build and Test
run: |
python ./setup.py --ninja --lief-test bdist_wheel
shell: cmd
+291 -204
View File
@@ -1,235 +1,322 @@
language: cpp
git:
depth: false
matrix:
jobs:
include:
# Linux gcc 5.0 - Python 2.7
- os: linux
dist: trusty
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'ccache', 'libpython2.7']
env: >
[
CXX_COMPILER=g++-5 ,
C_COMPILER=gcc-5 ,
PYTHON_VERSION=2.7 ,
PYTHON_INCLUDE_DIR=/usr/include/python2.7 ,
PYTHON_LIBRARY=/usr/lib/libpython2.7.so ,
PYTHON_BINARY=/usr/bin/python2.7 ,
LIEF_TEST_STATIC=ON ,
LIEF_TEST_SHARED=OFF ,
]
- if: branch = master AND tag IS present
services: docker
name: "Linux Python 3.5"
script:
- >
docker run --name lief_35
-e PYTHON_BINARY=/opt/python/cp35-cp35m/bin/python3.5
-e CCACHE_DIR=/ccache
-v $HOME/.ccache:/ccache
-v $TRAVIS_BUILD_DIR:/src
liefproject/manylinux1_x86_64
bash /src/scripts/docker/travis-linux.sh
- >
if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
docker run \
-v $TRAVIS_BUILD_DIR:/src \
-e TRAVIS="true" \
-e TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE \
-e TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG \
-e TRAVIS_BRANCH=$TRAVIS_BRANCH \
-e TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR \
-e LIEF_AUTOMATIC_BUILDS_KEY=$LIEF_AUTOMATIC_BUILDS_KEY \
-e LIEF_AUTOMATIC_BUILDS_IV=$LIEF_AUTOMATIC_BUILDS_IV \
--rm \
liefproject/deploy python3 /src/.github/deploy.py;
fi
# Linux gcc 5.0 - Python 3.5
- os: linux
dist: trusty
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'deadsnakes']
packages: ['g++-5', 'gcc-5', 'ccache', 'python3.5-dev']
env: >
[
CXX_COMPILER=g++-5 ,
C_COMPILER=gcc-5 ,
PYTHON_VERSION=3.5 ,
PYTHON_INCLUDE_DIR=/usr/include/python3.5m ,
PYTHON_LIBRARY=/usr/lib/libpython3.5m.so ,
PYTHON_BINARY=/usr/bin/python3.5 ,
LIEF_TEST_STATIC=OFF ,
LIEF_TEST_SHARED=ON ,
]
- if: branch = master AND tag IS present
services: docker
name: "Linux Python 3.6"
script:
- >
docker run --name lief_36
-e PYTHON_BINARY=/opt/python/cp36-cp36m/bin/python3.6
-e CCACHE_DIR=/ccache
-v $HOME/.ccache:/ccache
-v $TRAVIS_BUILD_DIR:/src
liefproject/manylinux1_x86_64
bash /src/scripts/docker/travis-linux.sh
- >
if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
docker run \
-v $TRAVIS_BUILD_DIR:/src \
-e TRAVIS="true" \
-e TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE \
-e TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG \
-e TRAVIS_BRANCH=$TRAVIS_BRANCH \
-e TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR \
-e LIEF_AUTOMATIC_BUILDS_KEY=$LIEF_AUTOMATIC_BUILDS_KEY \
-e LIEF_AUTOMATIC_BUILDS_IV=$LIEF_AUTOMATIC_BUILDS_IV \
--rm \
liefproject/deploy python3 /src/.github/deploy.py;
fi
- services: docker
name: "Linux Python 3.7 | SDK | Doc Trigger"
script:
- >
docker run --name lief_37
-e PYTHON_BINARY=/opt/python/cp37-cp37m/bin/python3.7
-e CCACHE_DIR=/ccache
-v $HOME/.ccache:/ccache
-v $TRAVIS_BUILD_DIR:/src
liefproject/manylinux1_x86_64
bash /src/scripts/docker/travis-linux.sh
- >
docker run --name lief_sdk
-e PYTHON_BINARY=$PYTHON_BINARY
-e CCACHE_DIR=/ccache
-v $HOME/.ccache:/ccache
-v $TRAVIS_BUILD_DIR:/src
liefproject/manylinux1_x86_64
bash /src/scripts/docker/travis-linux-sdk.sh
- >
sudo chmod -R 777 $TRAVIS_BUILD_DIR/build &&
sudo chown -R 1000:1000 $TRAVIS_BUILD_DIR/build
- >
if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
docker run \
-v $TRAVIS_BUILD_DIR:/src \
-e TRAVIS="true" \
-e TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE \
-e TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG \
-e TRAVIS_BRANCH=$TRAVIS_BRANCH \
-e TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR \
-e LIEF_AUTOMATIC_BUILDS_KEY=$LIEF_AUTOMATIC_BUILDS_KEY \
-e LIEF_AUTOMATIC_BUILDS_IV=$LIEF_AUTOMATIC_BUILDS_IV \
--rm \
liefproject/deploy python3 /src/.github/deploy.py;
fi
after_success:
- >
if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]];
then
docker run --rm
-e CIRCLE_CI_TOKEN=$CIRCLE_CI_TOKEN
liefproject/manylinux1_x86_64
bash -c "curl --request POST --url https://circleci.com/api/v2/project/gh/lief-project/doc/pipeline --header 'Circle-Token: ${CIRCLE_CI_TOKEN}' --header 'content-type: application/json'";
fi
- services: docker
name: "Linux Python 3.8"
script:
- >
docker run --name lief_38
-e PYTHON_BINARY=/opt/python/cp38-cp38/bin/python3.8
-e CCACHE_DIR=/ccache
-v $HOME/.ccache:/ccache
-v $TRAVIS_BUILD_DIR:/src
liefproject/manylinux1_x86_64
bash /src/scripts/docker/travis-linux.sh
- >
sudo chmod -R 777 $TRAVIS_BUILD_DIR/build &&
sudo chown -R 1000:1000 $TRAVIS_BUILD_DIR/build
- >
if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
docker run \
-v $TRAVIS_BUILD_DIR:/src \
-e TRAVIS="true" \
-e TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE \
-e TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG \
-e TRAVIS_BRANCH=$TRAVIS_BRANCH \
-e TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR \
-e LIEF_AUTOMATIC_BUILDS_KEY=$LIEF_AUTOMATIC_BUILDS_KEY \
-e LIEF_AUTOMATIC_BUILDS_IV=$LIEF_AUTOMATIC_BUILDS_IV \
--rm \
liefproject/deploy python3 /src/.github/deploy.py;
fi
- services: docker
name: "Linux Python 3.9"
script:
- >
docker run --name lief_39
-e PYTHON_BINARY=/opt/python/cp39-cp39/bin/python3.9
-e CCACHE_DIR=/ccache
-v $HOME/.ccache:/ccache
-v $TRAVIS_BUILD_DIR:/src
liefproject/manylinux1_x86_64
bash /src/scripts/docker/travis-linux.sh
- >
sudo chmod -R 777 $TRAVIS_BUILD_DIR/build &&
sudo chown -R 1000:1000 $TRAVIS_BUILD_DIR/build
- >
if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
docker run \
-v $TRAVIS_BUILD_DIR:/src \
-e TRAVIS="true" \
-e TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE \
-e TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG \
-e TRAVIS_BRANCH=$TRAVIS_BRANCH \
-e TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR \
-e LIEF_AUTOMATIC_BUILDS_KEY=$LIEF_AUTOMATIC_BUILDS_KEY \
-e LIEF_AUTOMATIC_BUILDS_IV=$LIEF_AUTOMATIC_BUILDS_IV \
--rm \
liefproject/deploy python3 /src/.github/deploy.py;
fi
## macOS 10.14.6 - xcode 11 - Python 3.5
#- if: branch = master AND tag IS present AND type = push
# os: osx
# osx_image: xcode11
# compiler: clang
# script:
# - pyenv install --skip-existing 3.5.0
# - >
# export PYTHON_BINARY=$(pyenv root)/versions/3.5.0/bin/python3.5 &&
# sudo $PYTHON_BINARY -m pip install --upgrade pip setuptools wheel &&
# $PYTHON_BINARY ./setup.py --ninja --lief-test build bdist_wheel
# after_success:
# - >
# if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
# export PYTHON_BINARY=$(pyenv root)/versions/3.5.0/bin/python3.5 &&
# sudo $PYTHON_BINARY -m pip install --upgrade pip setuptools requests mako wheel &&
# cd $TRAVIS_BUILD_DIR &&
# bash ./.github/deploy.sh;
# fi
## macOS 10.14.6 - xcode 11 - Python 3.6
#- if: branch = master AND tag IS present AND type = push
# os: osx
# osx_image: xcode11
# compiler: clang
# script:
# - pyenv install --skip-existing 3.6.0
# - >
# export PYTHON_BINARY=$(pyenv root)/versions/3.6.0/bin/python3.6 &&
# sudo $PYTHON_BINARY -m pip install --upgrade pip setuptools wheel &&
# $PYTHON_BINARY ./setup.py --ninja --lief-test build bdist_wheel
# after_success:
# - >
# if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
# export PYTHON_BINARY=$(pyenv root)/versions/3.6.0/bin/python3.6 &&
# sudo $PYTHON_BINARY -m pip install --upgrade pip setuptools requests mako wheel &&
# cd $TRAVIS_BUILD_DIR &&
# bash ./.github/deploy.sh;
# fi
# Linux gcc 6 - Python 3.6
- os: linux
dist: trusty
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'deadsnakes']
packages: ['g++-6', 'gcc-6', 'ccache', 'python3.6-dev']
env: >
[
CXX_COMPILER=g++-6 ,
C_COMPILER=gcc-6 ,
PYTHON_VERSION=3.6 ,
PYTHON_INCLUDE_DIR=/usr/include/python3.6m ,
PYTHON_LIBRARY=/usr/lib/libpython3.6m.so ,
PYTHON_BINARY=/usr/bin/python3.6 ,
LIEF_TEST_STATIC=ON ,
LIEF_TEST_SHARED=ON ,
]
## macOS 10.14.6 - xcode 11 - Python 3.7
#- os: osx
# osx_image: xcode11
# compiler: clang
# script:
# - pyenv install --skip-existing 3.7.0
# - >
# export PYTHON_BINARY=$(pyenv root)/versions/3.7.0/bin/python3.7 &&
# sudo $PYTHON_BINARY -m pip install --upgrade pip setuptools wheel &&
# $PYTHON_BINARY ./setup.py --ninja --lief-test build bdist_wheel
# after_success:
# - >
# if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
# export PYTHON_BINARY=$(pyenv root)/versions/3.7.0/bin/python3.7 &&
# sudo $PYTHON_BINARY -m pip install --upgrade pip setuptools requests mako wheel &&
# cd $TRAVIS_BUILD_DIR &&
# bash ./.github/deploy.sh;
# fi
# OSX 10.11 - xcode 7.3 - Python 2.7
- os: osx
osx_image: xcode7.3
compiler: clang
env: >
[
CXX_COMPILER=clang++ ,
C_COMPILER=clang ,
PYTHON_VERSION=2.7 ,
LIEF_TEST_STATIC=ON ,
LIEF_TEST_SHARED=OFF ,
]
# macOS 10.14.6 - xcode 11 - Python 3.8
#- os: osx
# osx_image: xcode11
# compiler: clang
# name: "OSX Python 3.8"
# script:
# - pyenv install --skip-existing 3.8.0
# - >
# export PYTHON_BINARY=$(pyenv root)/versions/3.8.0/bin/python3.8 &&
# sudo $PYTHON_BINARY -m pip install --upgrade pip setuptools wheel &&
# $PYTHON_BINARY ./setup.py --ninja --lief-test build bdist_wheel
# after_success:
# - >
# if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
# export PYTHON_BINARY=$(pyenv root)/versions/3.8.0/bin/python3.8 &&
# sudo $PYTHON_BINARY -m pip install --upgrade pip setuptools requests mako wheel &&
# cd $TRAVIS_BUILD_DIR &&
# bash ./.github/deploy.sh;
# fi
# OSX 10.12 - xcode 8.2 - Python 3.5
- os: osx
osx_image: xcode8.2
compiler: clang
env: >
[
CXX_COMPILER=clang++ ,
C_COMPILER=clang ,
PYTHON_VERSION=3.5 ,
LIEF_TEST_STATIC=OFF ,
LIEF_TEST_SHARED=ON ,
]
## macOS 10.14.6 - xcode 11 - Python 3.9
#- os: osx
# osx_image: xcode11
# compiler: clang
# name: "OSX Python 3.9 | SDK"
# script:
# - pyenv install --skip-existing 3.9.0
# - >
# export PYTHON_BINARY=$(pyenv root)/versions/3.9.0/bin/python3.9 &&
# sudo $PYTHON_BINARY -m pip install --upgrade pip setuptools wheel &&
# $PYTHON_BINARY ./setup.py --ninja --lief-test build bdist_wheel
# - bash scripts/osx/package_sdk.sh
# after_success:
# - >
# if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
# export PYTHON_BINARY=$(pyenv root)/versions/3.9.0/bin/python3.9 &&
# sudo $PYTHON_BINARY -m pip install --upgrade pip setuptools requests mako wheel &&
# cd $TRAVIS_BUILD_DIR &&
# bash ./.github/deploy.sh;
# fi
## OSX 10.12 - xcode 8.2 - Python 3.6
- os: osx
osx_image: xcode8.2
compiler: clang
env: >
[
CXX_COMPILER=clang++ ,
C_COMPILER=clang ,
PYTHON_VERSION=3.6 ,
LIEF_TEST_STATIC=ON ,
LIEF_TEST_SHARED=ON ,
]
#branches:
# only:
# - master
notifications:
email:
on_success: never
on_failure: always
sudo: required
cache:
- apt
- ccache
- $HOME/.pyenv
- build/rang_cpp_color-prefix
- build/mbed_tls
- build/libjson-prefix
- build/easyloggingpp-prefix
- build/tests/YAMLCPP
- build/tests/lief-samples
- build/tests/catch
- build/api/python/pybind11-prefix
- ccache: true
- directories:
- $HOME/.pyenv
- $HOME/.ccache
env:
global:
- USE_CCACHE=1
- CCACHE_COMPRESS=1
- CCACHE_MAXSIZE=10.0G
- CCACHE_CPP2=1
addons:
homebrew:
packages:
- pyenv
- ccache
- ninja
update: true
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -q; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install python-setuptools; fi
- export CC="$C_COMPILER"
- export CXX="$CXX_COMPILER"
- ccache --set-config=max_size=10.0G
- ccache --zero-stats --version
- ccache --set-config=compiler_check=content
- ccache -p
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then docker pull liefproject/manylinux1_x86_64:latest; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PREFIX="/usr/local"; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install ccache; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
#- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PYTHON_CONFIGURE_OPTS="--enable-shared --enable-unicode=ucs2"; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then pyenv root; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then pyenv install --list ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "2.7" ]]; then pyenv install 2.7.12; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "3.5" ]]; then pyenv install 3.5.0; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "3.6" ]]; then pyenv install 3.6.0; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "2.7" ]]; then export PYTHON_INCLUDE_DIR=$(pyenv root)/versions/2.7.12/include/python2.7 ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "2.7" ]]; then export PYTHON_LIBRARY=$(pyenv root)/versions/2.7.12/lib/libpython2.7.dylib ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "2.7" ]]; then export PYTHON_BINARY=$(pyenv root)/versions/2.7.12/bin/python2.7 ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "2.7" ]]; then $PYTHON_BINARY -m pip install --upgrade pip ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "2.7" ]]; then $PYTHON_BINARY -m pip install --upgrade setuptools ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "3.5" ]]; then export PYTHON_INCLUDE_DIR=$(pyenv root)/versions/3.5.0/include/python3.5m ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "3.5" ]]; then export PYTHON_LIBRARY=$(pyenv root)/versions/3.5.0/lib/libpython3.dylib ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "3.5" ]]; then export PYTHON_BINARY=$(pyenv root)/versions/3.5.0/bin/python3.5 ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "3.6" ]]; then export PYTHON_INCLUDE_DIR=$(pyenv root)/versions/3.6.0/include/python3.6m ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "3.6" ]]; then export PYTHON_LIBRARY=$(pyenv root)/versions/3.6.0/lib/libpython3.dylib ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "3.6" ]]; then export PYTHON_BINARY=$(pyenv root)/versions/3.6.0/bin/python3.6 ;fi
install:
- if [ "$GCOV" == "ON" ]; then sudo ln -sf /usr/bin/gcov-5 /usr/bin/gcov; fi
- if [ "$GCOV" == "ON" ]; then wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.13.orig.tar.gz; fi
- if [ "$GCOV" == "ON" ]; then tar xf lcov_1.13.orig.tar.gz; fi
- if [ "$GCOV" == "ON" ]; then sudo make -C lcov-1.13/ install; fi
# Setup CMake 3.1 for Linux
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget --no-check-certificate http://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xzf cmake-3.7.2-Linux-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=$PWD/cmake-3.7.2-Linux-x86_64/bin:$PATH ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo $PYTHON_BINARY ./get-pip.py ;fi
# Prepare build
- mkdir build
- cd build
script:
- >
cmake
-DCMAKE_C_COMPILER=$C_COMPILER
-DCMAKE_CXX_COMPILER=$CXX_COMPILER
-DPYTHON_VERSION=$PYTHON_VERSION
-DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_DIR
-DPYTHON_LIBRARY=$PYTHON_LIBRARY
-DPYTHON_EXECUTABLE=$PYTHON_BINARY
-DLIEF_TESTS=on
-DLIEF_PYTHON_API=on
-DLIEF_EXAMPLES=on
-DLIEF_TEST_SHARED=$LIEF_TEST_SHARED
-DLIEF_TEST_STATIC=$LIEF_TEST_STATIC
..
- make -j3 lief_samples
- cmake ..
- make -j3 all
- make -j3 check-lief
#- sudo make check-lief
after_success:
- make package
- sudo $PYTHON_BINARY -m pip install setuptools
- sudo $PYTHON_BINARY -m pip install requests
- sudo $PYTHON_BINARY -m pip install --upgrade setuptools
- cd api/python
- $PYTHON_BINARY setup.py bdist_egg
- if [[ -z "$TRAVIS_TAG" ]]; then $PYTHON_BINARY setup.py sdist --dev --formats=zip ;fi
- if [[ -n "$TRAVIS_TAG" ]]; then $PYTHON_BINARY setup.py sdist --formats=zip ;fi
- cd $TRAVIS_BUILD_DIR
- bash ./.github/deploy.sh
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$PYTHON_VERSION" == "3.6" ]]; then $PYTHON_BINARY ./.github/trigger_docker.py ;fi
deploy:
provider: releases
api_key:
- secure: "RlyaagAWt1BrcOBDSpmOnP+/FYUJqQiURlWw7JWvuBBWBDPBta+WI1zZvH6x5H+1bm8F77LrGdU1mRES/MAlhzb8o/VHgOAFhu2si/A+A7Xa9fAIOQw12jcGbtZQUQ7HCkRfa5VGrW4IlMI5+FJ7uFUU2lLoWOsA3u8pLEwApbdiB/LmtEY+kKhXzX0bT3h9cZATDWTeEoopXOseaBmTFC9IUATE3Ht1wVP49wXRUZHNJA10PJILbKtR1OITCAKm0iu1rVdLhoMzqH3T2dXDZ5ykF9TuYQaXJzKMFHaAeSe135JYOiIEWUUiif80q/mTWXiJAQ6gQXXOyDVu6R0Hi03TKsWXPlEKDBpDCRDu58I2hJyxsc5MPbFg8IAjraXkOLIQkIpgBOfV0JYVihikOLTfbCBKO+w9RFwrEVy91YsKCDosEAUa9p5nyRoV+k9Epmr/2atlHY8z7RyycB2fNQv3/NkHX8jZesiUFUwu5SHaZD76mKGELEZlf7LW8XwL4Cwfa2OB2vsKFcN1qyGUmXS57MODVBAUubQY4oTFwFJJUv28s06KA6BfZE4QqAeWoRSslDr9ORLUlsHHoCpZrAAY0uyl8kff/jL8IJMd8qng9bBTLu8hiK0yyQWKkebMvMWXhvAjssXeqWt3OeL2mssbUG5N1pXt6eHFmQvxqzs="
file_glob: true
file:
- ${TRAVIS_BUILD_DIR}/build/api/python/dist/*.egg
- ${TRAVIS_BUILD_DIR}/build/api/python/dist/*.zip
- ${TRAVIS_BUILD_DIR}/build/*.tar.gz
skip_cleanup: true
on:
#branch: master
tags: true
after_script:
- ccache --show-stats
#deploy:
# provider: releases
# token:
# - secure: LTJMZp9kJ9/tmv73YGktP3Bdhh3moettDNooiRlQfUEgUemRlp9K+ybbufN0ya0Md0bouOJ/7nWqFToWl1G5/kcRr4MjV/P2c+iH8W7mvWcFupLGdwm1+aqpin3hiGsdYz0a1TK37y6DANspFwHILjq1SPf5L8kGEHnYSIfyUFHaETbv7GHL+4gf1XG/55KVuyFa3vZ2BPa3sIXr4bRypdNsqssFOZ7qeoJawtcI3TbjmLqx+sOGR2aiG+9lX+/vcYVGECHOE4KdV5BbTFitDLkJ0toAQrgN4XuB6XMXEnijU0RGtpkvsUAYJUuYaNcV2ea4bwLPCKz0IJvzTw3gtyB/pioP4OUx0xY2csuNuGfppZ0Fb+BWhPx9wOg209lrPjtoWszK8vo4PywKlEUviNG+3hEYx9x382IbtbXvIxp+c2iYdRicudFIdjjSZt7fy1MwBvHhWoBRl1hVw5fpFvRIC6Q1/B6MV55Jc3LVYCs+QHPAXq2KJ1KWK/Q7mmlriG3O+dvswcE1l0/AmeqKuXLsgUMuzScYa4fMFvXL3l/B8bKw205ynMzKvbb61P3sGrJJ+AFDEoHDk8yNtSaTowoUveu75DbL1s1p02QjYeVt7AJS8AsqUm7QPcUU5iXW1gSgt50jD/46/uvK7NZCFj2LzkiVzM5JIbiUANx8pKA=
# file_glob: true
# file:
# - ${TRAVIS_BUILD_DIR}/dist/*.whl
# - ${TRAVIS_BUILD_DIR}/build/*.tar.gz
# on:
# tags: true
+358 -268
View File
@@ -1,24 +1,35 @@
cmake_minimum_required(VERSION 3.6)
cmake_minimum_required(VERSION 3.5)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
if(WIN32)
include(ChooseMSVCCRT)
endif()
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
include(Findcppcheck)
include(CppcheckTargets)
include(ExternalProject)
include(CMakePackageConfigHelpers)
find_package(Git REQUIRED)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git"
AND IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
find_package(Git REQUIRED)
# Information from git
# ====================
include(LIEFGit)
# Information from git
# ====================
include(LIEFGit)
else()
set(LIEF_VERSION_MAJOR "0")
set(LIEF_VERSION_MINOR "12")
set(LIEF_VERSION_PATCH "0")
endif()
# LIEF Project
# ============
project(LIEF VERSION ${LIEF_VERSION_MAJOR}.${LIEF_VERSION_MINOR}.${LIEF_VERSION_PATCH})
project(
LIEF
VERSION ${LIEF_VERSION_MAJOR}.${LIEF_VERSION_MINOR}.${LIEF_VERSION_PATCH})
message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION}")
# LIEF options
@@ -30,32 +41,59 @@ include(LIEFCompilerDetection)
# CCACHE
# ======
find_program(CCACHE_FOUND ccache)
message(STATUS "ccache: ${LIEF_USE_CCACHE}")
if(CCACHE_FOUND AND LIEF_USE_CCACHE)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
message(STATUS "Caching: ${LIEF_USE_CCACHE}")
if(LIEF_USE_CCACHE)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
message(STATUS "Found ccache: ${CCACHE_FOUND}")
else()
find_program(SCCACHE_FOUND sccache)
if (SCCACHE_FOUND)
set(CMAKE_C_COMPILER_LAUNCHER ${SCCACHE_FOUND})
set(CMAKE_CXX_COMPILER_LAUNCHER ${SCCACHE_FOUND})
message(STATUS "Found sccache: ${SCCACHE_FOUND}")
else()
set(LIEF_USE_CCACHE OFF)
message(WARNING "Can't find cache solution")
endif()
endif()
endif()
# Dependencies
# Dependencies
# ============
set(THIRD_PARTY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/third-party/")
include(LIEFDependencies)
# iOS specific config
# ===================
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
endif()
message(STATUS "CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_CXX_LINK_EXECUTABLE: ${CMAKE_CXX_LINK_EXECUTABLE}")
message(STATUS "CMAKE_CXX_LINK_FLAGS: ${CMAKE_CXX_LINK_FLAGS}")
message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
message(STATUS "CMAKE_EXE_LINKER_FLAGS_RELEASE: ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
message(STATUS "CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
message(STATUS "CMAKE_SHARED_LINKER_FLAGS_RELEASE: ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
message(STATUS "CMAKE_CXX_LINK_LIBRARY_FILE_FLAG: ${CMAKE_CXX_LINK_LIBRARY_FILE_FLAG}")
message(STATUS "CMAKE_LINK_LIBRARY_FILE_FLAG: ${CMAKE_LINK_LIBRARY_FILE_FLAG}")
message(STATUS "CMAKE_LINK_INTERFACE_LIBRARIES: ${CMAKE_LINK_INTERFACE_LIBRARIES}")
message(STATUS "CMAKE_CXX_IMPLICIT_LINK_LIBRARIES: ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}")
message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
# LIEF Source definition
# ======================
set_source_files_properties(${mbedtls_src_crypto} PROPERTIES GENERATED TRUE)
set_source_files_properties(${mbedtls_src_x509} PROPERTIES GENERATED TRUE)
set_source_files_properties(${mbedtls_src_tls} PROPERTIES GENERATED TRUE)
if (LIEF_LOGGING)
set_source_files_properties(${ELG_SOURCE_DIR}/easylogging++.cc PROPERTIES GENERATED TRUE)
#set_source_files_properties(${ELG_SOURCE_DIR}/easylogging++.cc PROPERTIES COMPILE_FLAGS -Wno-unused-variable)
#set_source_files_properties(${ELG_SOURCE_DIR}/easylogging++.h PROPERTIES COMPILE_FLAGS -Wno-unused-variable)
set(ELG_CC_PATH "${ELG_SOURCE_DIR}/easylogging++.cc")
endif()
set(LIEF_PRIVATE_INCLUDE_DIR)
set(LIEF_PUBLIC_INCLUDE_DIR)
@@ -63,69 +101,63 @@ set(LIEF_PUBLIC_INCLUDE_FILES)
set(LIEF_PRIVATE_INCLUDE_FILES)
set(LIBLIEF_SOURCE_FILES
"${ELG_CC_PATH}"
"${mbedtls_src_crypto}"
"${mbedtls_src_x509}"
"${mbedtls_src_tls}"
"${LIBFUZZER_SRC_FILES}"
"${CMAKE_CURRENT_SOURCE_DIR}/src/logging.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/exception.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/iostream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Object.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Object.tcc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Visitor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/BinaryStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/VectorStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/Convert.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/visitors/hash.cpp")
"${mbedtls_src_crypto}"
"${mbedtls_src_x509}"
"${mbedtls_src_tls}"
"${LIBFUZZER_SRC_FILES}"
"${CMAKE_CURRENT_SOURCE_DIR}/src/errors.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/hash_stream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/logging.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/exception.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/iostream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Object.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Object.tcc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Visitor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/BinaryStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/VectorStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/MemoryStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/Convert.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/visitors/hash.cpp")
# Grouping basic headers together
# ===============================
set(LIEF_INC_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Builder.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/ELF.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Abstract.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/exception.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/iostream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/iterators.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/LIEF.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/logging.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/MachO.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/PE.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/types.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/utf8.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/utils.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/visibility.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Object.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Visitor.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/visitor_macros.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/BinaryStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/VectorStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/Convert.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/frozen.hpp"
)
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/errors.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/ELF.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Abstract.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/exception.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/iostream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/iterators.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/LIEF.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/logging.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/MachO.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/PE.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/types.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/utils.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/visibility.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Object.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Visitor.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/visitor_macros.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/BinaryStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/VectorStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/MemoryStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/Convert.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/hash_stream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/frozen.hpp")
set(LIEF_VISITOR_INCLUDE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/hash.hpp")
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/hash.hpp")
set(LIEF_INCLUDE_FILES
${LIEF_INC_FILES}
${LIEF_VISITOR_INCLUDE_FILES}
)
set(LIEF_INCLUDE_FILES ${LIEF_INC_FILES} ${LIEF_VISITOR_INCLUDE_FILES})
set(LIEF_JSON_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/visitors/json.cpp")
set(LIEF_JSON_HDR
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/json.hpp"
"${LIBJSON_SOURCE_DIR}/json.hpp"
)
set(LIEF_JSON_HDR "${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/json.hpp"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/json.hpp")
if (LIEF_ENABLE_JSON)
list(APPEND LIBLIEF_SOURCE_FILES "${LIEF_JSON_SRC}")
list(APPEND LIEF_INC_FILES "${LIEF_JSON_HDR}")
list(APPEND LIEF_PUBLIC_INCLUDE_DIR "${LIBJSON_SOURCE_DIR}/")
if(LIEF_ENABLE_JSON)
list(APPEND LIBLIEF_SOURCE_FILES "${LIEF_JSON_SRC}")
list(APPEND LIEF_INC_FILES "${LIEF_JSON_HDR}")
endif()
source_group("Header Files" FILES ${LIEF_INC_FILES})
@@ -133,23 +165,33 @@ source_group("Source Files" FILES ${LIBLIEF_SOURCE_FILES})
source_group("Header Files\\visitors" FILES ${LIEF_VISITOR_INCLUDE_FILES})
add_library(LIB_LIEF_STATIC STATIC ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES}) # Static one
if(LIEF_SHARED_LIB)
add_library(LIB_LIEF_SHARED SHARED ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES}) # Shared one
add_library(LIB_LIEF ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES})
if(WINDOWS AND BUILD_SHARED_LIBS)
target_link_libraries(LIB_LIEF ws2_32)
endif()
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug AND WINDOWS)
add_definitions(-D_ITERATOR_DEBUG_LEVEL=0 -D_SECURE_SCL=0
-D_HAS_ITERATOR_DEBUGGING=0)
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug AND UNIX)
target_compile_options(LIB_LIEF PRIVATE -g -O0)
endif()
if(BUILD_SHARED_LIBS OR LIEF_FORCE_API_EXPORTS)
target_compile_definitions(LIB_LIEF PRIVATE -DLIEF_EXPORTS)
else()
add_library(LIB_LIEF_SHARED SHARED EXCLUDE_FROM_ALL ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES}) # Shared one
target_compile_definitions(LIB_LIEF PRIVATE -DLIEF_STATIC)
endif()
if(WINDOWS)
target_link_libraries(LIB_LIEF_SHARED ws2_32)
endif()
target_compile_definitions(LIB_LIEF_STATIC PRIVATE -DLIEF_STATIC)
target_compile_definitions(LIB_LIEF_SHARED PRIVATE -DLIEF_EXPORTS)
if (LIEF_SUPPORT_CXX14)
target_compile_features(LIB_LIEF_STATIC PRIVATE cxx_std_14)
target_compile_features(LIB_LIEF_SHARED PRIVATE cxx_std_14)
if(LIEF_SUPPORT_CXX14)
target_compile_features(LIB_LIEF PRIVATE cxx_std_14)
endif()
# Abstract part
@@ -158,17 +200,16 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/src/Abstract/CMakeLists.txt")
# ELF Part
# ========
include("${CMAKE_CURRENT_SOURCE_DIR}/src/ELF/CMakeLists.txt")
if (LIEF_ELF)
if(LIEF_ELF)
set(ENABLE_ELF_SUPPORT 1)
else()
set(ENABLE_ELF_SUPPORT 0)
endif()
# PE Part
# =======
include("${CMAKE_CURRENT_SOURCE_DIR}/src/PE/CMakeLists.txt")
if (LIEF_PE)
if(LIEF_PE)
set(ENABLE_PE_SUPPORT 1)
else()
set(ENABLE_PE_SUPPORT 0)
@@ -177,36 +218,31 @@ endif()
# MachO part
# ==========
include("${CMAKE_CURRENT_SOURCE_DIR}/src/MachO/CMakeLists.txt")
if (LIEF_MACHO)
if(LIEF_MACHO)
set(ENABLE_MACHO_SUPPORT 1)
else()
set(ENABLE_MACHO_SUPPORT 0)
endif()
# Logging Configuration
# =====================
if (LIEF_LOGGING)
add_definitions(-DELPP_NO_DEFAULT_LOG_FILE)
add_definitions(-DVDEBUG=9)
add_definitions(-DELPP_FEATURE_CRASH_LOG)
set(ENABLE_LOGGING_SUPPORT 1)
else()
set(ENABLE_LOGGING_SUPPORT 0)
add_definitions(-DELPP_DISABLE_LOGS)
add_definitions(-DELPP_NO_LOG_TO_FILE)
add_definitions(-DELPP_DISABLE_DEFAULT_CRASH_HANDLING)
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_DISABLE_DEFAULT_LOGGER
SPDLOG_FUNCTION=)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_NO_EXCEPTIONS SPDLOG_NO_THREAD_ID)
endif()
# Frozen Configuration
# ====================
if (LIEF_FROZEN_ENABLED)
if(LIEF_FROZEN_ENABLED)
list(APPEND LIEF_PRIVATE_INCLUDE_DIR "${FROZEN_INCLUDE_DIR}")
endif()
# OAT part
# ========
if (LIEF_OAT)
if(LIEF_OAT)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/OAT/CMakeLists.txt)
set(ENABLE_OAT_SUPPORT 1)
else()
@@ -215,27 +251,25 @@ endif()
# DEX part
# ========
if (LIEF_DEX)
if(LIEF_DEX)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/DEX/CMakeLists.txt)
set(ENABLE_DEX_SUPPORT 1)
else()
set(ENABLE_DEX_SUPPORT 0)
endif()
# VDEX part
# =========
if (LIEF_VDEX)
# =========
if(LIEF_VDEX)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/VDEX/CMakeLists.txt)
set(ENABLE_VDEX_SUPPORT 1)
else()
set(ENABLE_VDEX_SUPPORT 0)
endif()
# ART part
# ========
if (LIEF_ART)
# ========
if(LIEF_ART)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/ART/CMakeLists.txt)
set(ENABLE_ART_SUPPORT 1)
else()
@@ -247,148 +281,184 @@ endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/src/platforms/CMakeLists.txt)
# LIEF includes
# =============
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/version.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/version.h"
)
# =============
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/version.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/version.h")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/config.h"
@ONLY
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/config.h" @ONLY)
list(APPEND LIEF_PUBLIC_INCLUDE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/"
"${CMAKE_CURRENT_BINARY_DIR}/include/"
)
list(APPEND LIEF_PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/"
"${CMAKE_CURRENT_BINARY_DIR}/include/")
list(APPEND LIEF_PRIVATE_INCLUDE_DIR
"${LIEF_PUBLIC_INCLUDE_DIR}"
"${LIEF_PUBLIC_INCLUDE_DIR}"
"${LIBRANG_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/src"
"${CMAKE_BINARY_DIR}"
"${ELG_SOURCE_DIR}"
"${MBEDTLS_INCLUDE_DIRS}"
)
list(APPEND LIEF_PRIVATE_INCLUDE_DIR "${LIEF_PUBLIC_INCLUDE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_BINARY_DIR}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/LIEF.pc.in ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
@ONLY)
# Grouping external projects
# ==========================
source_group("mbedtls\\crypto" FILES ${mbedtls_src_crypto})
source_group("mbedtls\\x509" FILES ${mbedtls_src_x509})
source_group("mbedtls\\tls" FILES ${mbedtls_src_tls})
if (LIEF_LOGGING)
source_group("easylogging" FILES ${ELG_SOURCE_DIR}/easylogging++.cc)
endif()
source_group("mbedtls\\x509" FILES ${mbedtls_src_x509})
source_group("mbedtls\\tls" FILES ${mbedtls_src_tls})
# Library definition
# ==================
target_include_directories(LIB_LIEF_STATIC
PUBLIC "${LIEF_PUBLIC_INCLUDE_DIR}"
target_include_directories(
LIB_LIEF SYSTEM PRIVATE "${MBEDTLS_INCLUDE_DIRS}")
target_include_directories(
LIB_LIEF
PUBLIC "${LIEF_PUBLIC_INCLUDE_DIR}"
PRIVATE "${LIEF_PRIVATE_INCLUDE_DIR}")
target_include_directories(LIB_LIEF_SHARED
PUBLIC "${LIEF_PUBLIC_INCLUDE_DIR}"
PRIVATE "${LIEF_PRIVATE_INCLUDE_DIR}")
if(LIEF_ENABLE_JSON)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/json.hpp
COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBJSON_SOURCE_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/
DEPENDS lief_libjson)
if (LIEF_ENABLE_JSON)
add_dependencies(LIB_LIEF_STATIC lief_libjson)
add_dependencies(LIB_LIEF_SHARED lief_libjson)
target_sources(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/json.hpp)
endif()
if (LIEF_LOGGING)
add_dependencies(LIB_LIEF_STATIC lief_easyloggingpp)
add_dependencies(LIB_LIEF_SHARED lief_easyloggingpp)
if(LIEF_FROZEN_ENABLED)
add_dependencies(LIB_LIEF lief_frozen)
endif()
if (LIEF_FROZEN_ENABLED)
add_dependencies(LIB_LIEF_STATIC lief_frozen)
add_dependencies(LIB_LIEF_SHARED lief_frozen)
endif()
# =======================================
# Leaf
# =======================================
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/boost/leaf/all.hpp
COMMAND
${CMAKE_COMMAND} -E copy_directory ${LEAF_INCLUDE_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/
DEPENDS lief_leaf)
add_dependencies(LIB_LIEF_STATIC lief_rang_cpp_color)
add_dependencies(LIB_LIEF_SHARED lief_rang_cpp_color)
target_sources(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/boost/leaf/all.hpp)
add_dependencies(LIB_LIEF_STATIC lief_mbed_tls)
add_dependencies(LIB_LIEF_SHARED lief_mbed_tls)
# =======================================
# utfcpp
# =======================================
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/utfcpp/utf8.h
COMMAND
${CMAKE_COMMAND} -E copy_directory ${UTFCPP_INCLUDE_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/utfcpp
DEPENDS lief_utfcpp)
target_sources(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/utfcpp/utf8.h)
add_dependencies(LIB_LIEF lief_mbed_tls)
target_link_libraries(LIB_LIEF PRIVATE lief_spdlog)
# Flags definition
# ----------------
set_property(TARGET LIB_LIEF_STATIC LIB_LIEF_SHARED PROPERTY CXX_STANDARD 11)
set_property(TARGET LIB_LIEF_STATIC LIB_LIEF_SHARED PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET LIB_LIEF_STATIC LIB_LIEF_SHARED PROPERTY POSITION_INDEPENDENT_CODE ON)
# cmake-format: off
set_target_properties(
LIB_LIEF
PROPERTIES POSITION_INDEPENDENT_CODE ON
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
CXX_VISIBILITY_PRESET hidden
C_VISIBILITY_PRESET hidden)
# cmake-format: on
if(UNIX AND NOT APPLE)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS "-Wl,--gc-sections -Wl,--exclude-libs,ALL")
endif()
target_compile_definitions(LIB_LIEF PUBLIC -D_GLIBCXX_USE_CXX11_ABI=1)
# Enable support for MD2 and MD4 for parsing the Authenticode sigs of older
# executables. Also, some older signed executables use certs with the
# SpcSpAgencyInfo Critical Extension, which mbed TLS doesn't support, so set
# MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION to have it skip this
# extension.
add_definitions(-DMBEDTLS_MD2_C -DMBEDTLS_MD4_C -DMBEDTLS_PEM_PARSE_C
-DMBEDTLS_X509_CRT_PARSE_C -DMBEDTLS_PEM_WRITE_C
-DMBEDTLS_PKCS1_V15 -DMBEDTLS_PKCS1_V21
-DMBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION)
# ASAN - LSAN - TSAN - USAN
# ~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~
set(SANITIZER_FLAGS -fno-omit-frame-pointer -g -O1)
if (LIEF_ASAN)
if(LIEF_ASAN)
message(STATUS "Address sanitizer enabled")
list(APPEND SANITIZER_FLAGS -fsanitize=address)
set_property(TARGET LIB_LIEF_STATIC LIB_LIEF_SHARED APPEND PROPERTY LINK_FLAGS -fsanitize=address)
target_link_libraries(LIB_LIEF_STATIC INTERFACE asan)
target_link_libraries(LIB_LIEF_SHARED INTERFACE asan)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS -fsanitize=address)
target_link_libraries(LIB_LIEF INTERFACE asan)
endif()
if (LIEF_LSAN)
if(LIEF_LSAN)
message(STATUS "Leak sanitizer enabled")
list(APPEND SANITIZER_FLAGS -fsanitize=leak)
set_property(TARGET LIB_LIEF_STATIC LIB_LIEF_SHARED APPEND PROPERTY LINK_FLAGS -fsanitize=leak)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS -fsanitize=leak)
target_link_libraries(LIB_LIEF_STATIC INTERFACE lsan)
target_link_libraries(LIB_LIEF_SHARED INTERFACE lsan)
target_link_libraries(LIB_LIEF INTERFACE lsan)
endif()
if (LIEF_TSAN)
if(LIEF_TSAN)
message(STATUS "Thread sanitizer enabled")
list(APPEND SANITIZER_FLAGS -fsanitize=thread)
set_property(TARGET LIB_LIEF_STATIC LIB_LIEF_SHARED APPEND PROPERTY LINK_FLAGS -fsanitize=thread)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS -fsanitize=thread)
target_link_libraries(LIB_LIEF_STATIC INTERFACE tsan)
target_link_libraries(LIB_LIEF_SHARED INTERFACE tsan)
target_link_libraries(LIB_LIEF INTERFACE tsan)
endif()
if (LIEF_USAN)
if(LIEF_USAN)
message(STATUS "Undefined sanitizer enabled")
list(APPEND SANITIZER_FLAGS -fsanitize=undefined)
set_property(TARGET LIB_LIEF_STATIC LIB_LIEF_SHARED APPEND PROPERTY LINK_FLAGS -fsanitize=undefined)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS -fsanitize=undefined)
target_link_libraries(LIB_LIEF_STATIC INTERFACE ubsan)
target_link_libraries(LIB_LIEF_SHARED INTERFACE ubsan)
target_link_libraries(LIB_LIEF INTERFACE ubsan)
endif()
if (LIEF_ASAN OR LIEF_LSAN OR LIEF_TSAN OR LIEF_USAN)
#message(STATUS "${SANITIZER_FLAGS}")
target_compile_options(LIB_LIEF_STATIC PRIVATE ${SANITIZER_FLAGS})
target_compile_options(LIB_LIEF_SHARED PRIVATE ${SANITIZER_FLAGS})
if(LIEF_ASAN
OR LIEF_LSAN
OR LIEF_TSAN
OR LIEF_USAN)
target_compile_options(LIB_LIEF PRIVATE ${SANITIZER_FLAGS})
endif()
# Fuzzing
# ~~~~~~~
if (LIEF_FUZZING)
set_property(TARGET LIB_LIEF_STATIC LIB_LIEF_SHARED APPEND PROPERTY LINK_FLAGS ${FUZZING_LINKER_FLAGS})
# ~~~
if(LIEF_FUZZING)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS ${FUZZING_LINKER_FLAGS})
target_compile_options(LIB_LIEF_STATIC PRIVATE ${FUZZING_FLAGS})
target_compile_options(LIB_LIEF_SHARED PRIVATE ${FUZZING_FLAGS})
target_compile_options(LIB_LIEF PRIVATE ${FUZZING_FLAGS})
target_link_libraries(LIB_LIEF_STATIC asan pthread)
target_link_libraries(LIB_LIEF_SHARED asan pthread)
target_link_libraries(LIB_LIEF asan pthread)
add_dependencies(LIB_LIEF_STATIC lief_libfuzzer)
add_dependencies(LIB_LIEF_SHARED lief_libfuzzer)
add_dependencies(LIB_LIEF lief_libfuzzer)
endif()
# Compile Flags
@@ -397,135 +467,155 @@ include(LIEFCompilerFlags)
# Profiling flags
# ---------------
if (LIEF_PROFILING)
if(LIEF_PROFILING)
set(PROFILING_FLAGS
-fno-builtin-malloc
-fno-builtin-calloc
-fno-builtin-realloc
-fno-builtin-free
-fno-omit-frame-pointer
-g
)
target_compile_options(LIB_LIEF_STATIC PUBLIC ${PROFILING_FLAGS})
target_compile_options(LIB_LIEF_SHARED PUBLIC ${PROFILING_FLAGS})
-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc
-fno-builtin-free -fno-omit-frame-pointer -g)
target_compile_options(LIB_LIEF PUBLIC ${PROFILING_FLAGS})
add_executable(elf_profiler profiling/elf_profiler.cpp)
target_compile_options(elf_profiler PUBLIC ${PROFILING_FLAGS})
target_link_libraries(elf_profiler PRIVATE LIB_LIEF_STATIC)
target_link_libraries(elf_profiler PRIVATE LIB_LIEF)
endif()
# Coverage flags
# --------------
if(LIEF_COVERAGE)
target_compile_options(LIB_LIEF_STATIC PRIVATE -g -O0 --coverage -fprofile-arcs -ftest-coverage)
target_compile_options(LIB_LIEF_SHARED PRIVATE -g -O0 --coverage -fprofile-arcs -ftest-coverage)
target_link_libraries(LIB_LIEF_STATIC gcov)
target_link_libraries(LIB_LIEF_SHARED gcov)
target_compile_options(LIB_LIEF PRIVATE -g -O0 --coverage -fprofile-arcs
-ftest-coverage)
target_link_libraries(LIB_LIEF gcov)
endif()
find_package(cppcheck)
set_target_properties(LIB_LIEF PROPERTIES OUTPUT_NAME LIEF CLEAN_DIRECT_OUTPUT 1)
set_target_properties(
LIB_LIEF_STATIC
PROPERTIES OUTPUT_NAME LIEF
CLEAN_DIRECT_OUTPUT 1)
set_target_properties(
LIB_LIEF_SHARED
PROPERTIES OUTPUT_NAME LIEF
CLEAN_DIRECT_OUTPUT 1)
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
"MinSizeRel" "RelWithDebInfo")
endif()
message(STATUS "Configuration Types: ${CMAKE_CONFIGURATION_TYPES}")
message(STATUS "Build Types: ${CMAKE_BUILD_TYPE}")
if(APPLE)
set_target_properties(LIB_LIEF_STATIC PROPERTIES MACOSX_RPATH ".")
set_target_properties(LIB_LIEF_SHARED PROPERTIES MACOSX_RPATH ".")
set_target_properties(LIB_LIEF PROPERTIES
MACOSX_RPATH ON
)
endif()
# API
# ===
# ======================
include(LIEFApi)
# Examples
# ========
# ======================
if(LIEF_EXAMPLES)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/examples")
endif()
# Tests
# =====
# ======================
if(LIEF_TESTS)
enable_testing()
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/tests")
endif()
# CPP Check
# =========
set(CPPCHECK_TEMPLATE_ARG "[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)")
set(_cppcheck_args "--enable=warning,performance,portability,information")
#add_cppcheck(LIB_LIEF_STATIC FORCE)
# Documentation
# =============
if (LIEF_DOC)
# ======================
if(LIEF_DOC)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/doc)
endif()
# Find Package Config
# ======================
configure_package_config_file(
LIEFConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
INSTALL_DESTINATION share/LIEF/cmake)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
# Post-build operations
# ======================
if (BUILD_SHARED_LIBS AND CMAKE_BUILD_TYPE MATCHES "Release")
if (UNIX AND NOT APPLE)
add_custom_command(
TARGET LIB_LIEF
COMMENT "Strip LIEF shared library"
POST_BUILD
COMMAND ${CMAKE_STRIP} --strip-all $<TARGET_FILE:LIB_LIEF>
)
endif()
if (APPLE)
add_custom_command(
TARGET LIB_LIEF
COMMENT "Strip LIEF shared library"
POST_BUILD
COMMAND ${CMAKE_STRIP} -x -S $<TARGET_FILE:LIB_LIEF>
)
endif()
endif()
# Install Prefix
# ==============
# ======================
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND UNIX)
if (UNIX AND NOT APPLE)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Install path prefix prepended on to install directories." FORCE)
elseif (APPLE)
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "" FORCE)
if(UNIX AND NOT APPLE)
set(CMAKE_INSTALL_PREFIX
"/usr"
CACHE PATH "Install path prefix prepended on to install directories."
FORCE)
elseif(APPLE)
set(CMAKE_INSTALL_PREFIX
"/usr/local"
CACHE PATH "" FORCE)
endif()
endif()
# Installation
# ============
# ======================
install(TARGETS LIB_LIEF_STATIC
ARCHIVE
DESTINATION lib
LIBRARY
DESTINATION lib
COMPONENT libraries)
if(LIEF_SHARED_LIB)
install(TARGETS LIB_LIEF_SHARED
ARCHIVE
DESTINATION lib
LIBRARY
DESTINATION lib
COMPONENT libraries)
endif()
install(
TARGETS LIB_LIEF
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib COMPONENT libraries)
install(
DIRECTORY ${LIEF_PUBLIC_INCLUDE_DIR}
DESTINATION include
COMPONENT headers
FILES_MATCHING REGEX "(.*).(hpp|h|def)$")
FILES_MATCHING
REGEX "(.*).(hpp|h|def)$")
install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/FindLIEF.cmake
DESTINATION share/LIEF/cmake
COMPONENT CMakeScripts
)
COMPONENT CMakeScripts)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
DESTINATION share/LIEF/cmake
COMPONENT config)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
DESTINATION lib/pkgconfig
COMPONENT libraries)
export(TARGETS LIB_LIEF lief_spdlog FILE LIEFExport.cmake)
# Package
# ======================
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/package")
+21
View File
@@ -0,0 +1,21 @@
# Docker file used to compile LIEF on Linux x86-64 compliant with Python tag: manylinux1
# docker build -t liefproject/manylinux1_x86_64:latest -f ./Dockerfile .
FROM quay.io/pypa/manylinux1_x86_64:2020-12-30-e2b3664
RUN yum update -y \
&& yum install -y ccache \
&& yum clean all
RUN /opt/python/cp37-cp37m/bin/pip install cmake==3.13.3 ninja==1.10.0.post2
ENV PATH=$PATH:/opt/python/cp37-cp37m/bin/
RUN curl --output /tmp/gcc-6.3.0-binutils-2.27-x86_64.tar.bz2 -L https://github.com/squeaky-pl/centos-devtools/releases/download/6.3/gcc-6.3.0-binutils-2.27-x86_64.tar.bz2 && \
echo "ca3e9f92411507018c839c8cc2b496f14956a49fcf6df0cdcb356de7161bcbc5 /tmp/gcc-6.3.0-binutils-2.27-x86_64.tar.bz2" | sha256sum --check --status && \
tar -C / -xj -f /tmp/gcc-6.3.0-binutils-2.27-x86_64.tar.bz2 && \
rm -rf /tmp/gcc-6.3.0-binutils-2.27-x86_64.tar.bz2
ENV CC=/opt/devtools-6.3/bin/gcc
ENV CXX=/opt/devtools-6.3/bin/g++
ENV CXXFLAGS="-static-libstdc++ -static-libgcc"
WORKDIR /src
+2 -2
View File
@@ -186,8 +186,8 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2017 R. Thomas
Copyright 2017 Quarkslab
Copyright 2017 - 2021 R. Thomas
Copyright 2017 - 2021 Quarkslab
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
+14
View File
@@ -0,0 +1,14 @@
prefix="@CMAKE_INSTALL_PREFIX@"
exec_prefix="${prefix}"
libdir="${prefix}/lib"
includedir="${prefix}/include"
Name: LIEF
Description: Library to Instrument Executable Formats
URL: https://github.com/lief-project/LIEF
Version: @LIEF_VERSION_MAJOR@.@LIEF_VERSION_MINOR@.@LIEF_VERSION_PATCH@
Requires: @PKGCONF_REQ_PUB@
Requires.private: @PKGCONF_REQ_PRIV@
Cflags: -I"${includedir}"
Libs: -L"${libdir}" -lLIEF
Libs.private: -L"${libdir}" -lLIEF @PKGCONF_LIBS_PRIV@
+4
View File
@@ -0,0 +1,4 @@
@PACKAGE_INIT@
set(LIEF_DIR "${PACKAGE_PREFIX_DIR}")
include("${CMAKE_CURRENT_LIST_DIR}/FindLIEF.cmake")
+26
View File
@@ -0,0 +1,26 @@
include README.md LICENSE setup.cfg CMakeLists.txt LIEF.pc.in LIEFConfig.cmake.in
# Examples
recursive-include examples *
# LIEF Sources
recursive-include src *
recursive-include include *
recursive-include third-party *
recursive-include cmake *
recursive-include scripts *
# Bindings
recursive-include api *
prune api/python/build
# Global exclude
recursive-exclude *.egg-info *.so
# Install script
recursive-include package *
# Documentation
recursive-include doc *
+135 -103
View File
@@ -4,24 +4,41 @@
<p align="center">
<a href="https://gitter.im/lief-project">
<img src="https://img.shields.io/gitter/room/gitterHQ/gitter.svg">
<img src="https://img.shields.io/gitter/room/gitterHQ/gitter.svg?style=flat-square">
</a>
&nbsp;
<a href="https://travis-ci.org/lief-project/LIEF">
<img src="https://travis-ci.org/lief-project/LIEF.svg?branch=master">
<a href="https://travis-ci.com/lief-project/LIEF">
<img alt="Linux CI status" src="https://img.shields.io/travis/com/lief-project/LIEF/master?label=Linux%20x86-64&logo=travis">
</a>
&nbsp;
<a href="https://circleci.com/gh/lief-project/LIEF/tree/master">
<img src="https://circleci.com/gh/lief-project/LIEF/tree/master.svg?style=svg">
<a href="https://github.com/lief-project/LIEF/actions?query=workflow%3A%22Linux+AArch64%22">
<img alt="Linux AArch64 CI status" src="https://img.shields.io/github/workflow/status/lief-project/LIEF/Linux%20AArch64/master?label=Linux%20AArch64&logo=github">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/actions?query=workflow%3AAndroid">
<img alt="Android CI status" src="https://img.shields.io/github/workflow/status/lief-project/LIEF/Android/master?label=Android&logo=github">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/actions?query=workflow%3AmacOS">
<img alt="macOS CI status" src="https://img.shields.io/github/workflow/status/lief-project/LIEF/macOS/master?label=macOS&logo=github">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/actions?query=workflow%3AiOS">
<img alt="iOS CI status" src="https://img.shields.io/github/workflow/status/lief-project/LIEF/iOS/master?label=iOS&logo=github">
</a>
&nbsp;
<a href="https://ci.appveyor.com/project/Romain/lief/branch/master">
<img src="https://ci.appveyor.com/api/projects/status/0ijlcujac5vh8cas/branch/master?svg=true">
<img alt="Windows CI status" src="https://img.shields.io/appveyor/build/Romain/LIEF/master?label=Windows&logo=appveyor">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/releases">
<img src="https://img.shields.io/badge/release-0.9.0-brightgreen.svg?style=default">
<img src="https://img.shields.io/github/v/release/lief-project/LIEF?style=flat-square">
</a>
&nbsp;
<a href="https://twitter.com/LIEF_project">
<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/lief_project?color=1da1f2&label=Follow&logo=twitter&logoColor=white&style=flat-square">
</a>
</p>
# About
@@ -30,12 +47,13 @@ The purpose of this project is to provide a cross platform library which can par
Main features:
* **Parsing**: LIEF can parse ELF, PE, MachO and provides an user-friendly API to access to format internals.
* **Parsing**: LIEF can parse ELF, PE, MachO, OAT, DEX, VDEX, ART and provides an user-friendly API to access to format internals.
* **Modify**: LIEF enables to modify some parts of these formats
* **Abstract**: Three formats have common features like sections, symbols, entry point... LIEF factors them.
* **API**: LIEF can be used in C, C++ and Python
# Content
- [About](#about)
- [Download / Install](#downloads--install)
- [Getting started](#getting-started)
@@ -53,140 +71,154 @@ Main features:
- [Transforming an ELF executable into a library](https://lief.quarkslab.com/doc/latest/tutorials/08_elf_bin2lib.html)
- [How to use frida on a non-rooted device](https://lief.quarkslab.com/doc/latest/tutorials/09_frida_lief.html)
- [Android formats](https://lief.quarkslab.com/doc/latest/tutorials/10_android_formats.html)
- [Mach-O modification](https://lief.quarkslab.com/doc/latest/tutorials/11_macho_modification.html)
- [ELF Coredump](https://lief.quarkslab.com/doc/latest/tutorials/12_elf_coredump.html)
- [PE Authenticode](https://lief.quarkslab.com/doc/latest/tutorials/13_pe_authenticode.html)
- [Contact](#contact)
- [Authors](#authors)
- [About](#about)
- [Authors](#authors)
- [License](#license)
- [Bibtex](#bibtex)
## Downloads / Install
First:
First, make sure to have an updated version of setuptools:
```bash
```console
pip install setuptools --upgrade
```
To install the latest **version**:
To install the latest **version** (release):
```python
```console
pip install lief
```
To install the latest **commit**:
To install nightlty build:
```python
pip install https://github.com/lief-project/packages/raw/lief-master-latest/pylief-0.9.0.dev.zip
```console
pip install [--user] --index-url https://lief.quarkslab.com/packages lief==0.12.0.dev0
```
### Packages
<table>
<tr><td colspan="4"><img src="https://img.shields.io/badge/release-master-brightgreen.svg?style=default"></td></tr>
<tr>
<th>Linux</th>
<th>Windows - x86</th>
<th>Windows - x86-64</th>
<th>OSX</th>
</tr>
* **Nightly**: https://github.com/lief-project/packages/tree/gh-pages
* **v0.11.4**: https://github.com/lief-project/LIEF/releases/tag/0.11.4
<tr>
<td><a href="https://github.com/lief-project/packages/raw/lief-master-latest/LIEF-0.9.0-Linux.tar.gz">SDK</a></td>
<td><a href="https://github.com/lief-project/packages/raw/lief-master-latest/LIEF-0.9.0-win32.zip">SDK</a></td>
<td><a href="https://github.com/lief-project/packages/raw/lief-master-latest/LIEF-0.9.0-win64.zip">SDK</a></td>
<td><a href="https://github.com/lief-project/packages/raw/lief-master-latest/LIEF-0.9.0-Darwin.tar.gz">SDK</a></td>
</tr>
Here are guides to install or integrate LIEF:
<tr>
<td colspan="4"><p align="center"><a href="https://github.com/lief-project/packages/raw/lief-master-latest/pylief-0.9.0.dev.zip">Python</a></p></td>
</tr>
</table>
<table>
<tr><td colspan="6"><b><img src="https://img.shields.io/badge/release-0.9.0-brightgreen.svg?style=default"></b></td></tr>
<tr>
<th>Linux</th>
<th>Windows</th>
<th>OSX</th>
<th>CentOS</th>
<th>Android</th>
<th>Documentation</th>
</tr>
<tr>
<td><a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/LIEF-0.9.0-Linux.tar.gz">SDK</a></td>
<td>
<a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/LIEF-0.9.0-win32.zip">SDK - x86</a>
<br />
<a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/LIEF-0.9.0-win64.zip">SDK - x86-64</a>
</td>
<td><a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/LIEF-0.9.0-Darwin.tar.gz">SDK</a></td>
<td><a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/LIEF-0.9.0-CentOS.tar.gz">SDK</a></td>
<td>
<a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/LIEF-0.9.0-Android_x86_64.tar.gz">SDK - x86-64</a>
<br />
<a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/LIEF-0.9.0-Android_x86.tar.gz">SDK - x86</a>
<br />
<a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/LIEF-0.9.0-Android_armeabi-v7a.tar.gz">SDK - ARM</a>
<br />
<a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/LIEF-0.9.0-Android_aarch64.tar.gz">SDK - AARCH64</a>
</td>
<td><a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/documentation-0.9.0.tar.gz">Sphinx + Doxygen</a></td>
</tr>
<tr>
<td colspan="3"><p align="center"><a href="https://github.com/lief-project/LIEF/releases/download/0.9.0/pylief-0.9.0.zip">Python</a></p></td>
</tr>
</table>
Here one can find guides to install or integrate LIEF:
* [Python](https://lief.quarkslab.com/doc/installation.html#python)
* [VisualStudio](https://lief.quarkslab.com/doc/installation.html#visual-studio-integration)
* [XCode](https://lief.quarkslab.com/doc/installation.html#xcode-integration)
* [CMake](https://lief.quarkslab.com/doc/installation.html#cmake-integration)
* [Python](https://lief.quarkslab.com/doc/latest/installation.html#python)
* [VisualStudio](https://lief.quarkslab.com/doc/latest/installation.html#visual-studio-integration)
* [XCode](https://lief.quarkslab.com/doc/latest/installation.html#xcode-integration)
* [CMake](https://lief.quarkslab.com/doc/latest/installation.html#cmake-integration)
## Getting started
### Python
<p align="center" >
<img width="100%" src="https://github.com/lief-project/LIEF/blob/master/.github/images/pythonapi.png"/><br />
</p>
```python
import lief
# ELF
binary = lief.parse("/usr/bin/ls")
print(binary)
# PE
binary = lief.parse("C:\\Windows\\explorer.exe")
print(binary)
# Mach-O
binary = lief.parse("/usr/bin/ls")
print(binary)
```
### C++
<p align="center" >
<img width="100%" src="https://github.com/lief-project/LIEF/blob/master/.github/images/cpp.png"/><br />
</p>
```cpp
#include <LIEF/LIEF.hpp>
### C
int main(int argc, char** argv) {
// ELF
try {
std::unique_ptr<LIEF::ELF::Binary> elf = LIEF::ELF::Parser::parse("/bin/ls");
std::cout << *elf << std::endl;
} catch (const LIEF::exception& err) {
std::cerr << err.what() << std::endl;
}
<p align="center" >
<img width="100%" src="https://github.com/lief-project/LIEF/blob/master/.github/images/capi.png"/><br />
</p>
// PE
try {
std::unique_ptr<LIEF::PE::Binary> pe = LIEF::PE::Parser::parse("C:\\Windows\\explorer.exe");
std::cout << *pe << std::endl;
} catch (const LIEF::exception& err) {
std::cerr << err.what() << std::endl;
}
// Mach-O
try {
std::unique_ptr<LIEF::MachO::FatBinary> macho = LIEF::MachO::Parser::parse("/bin/ls");
std::cout << *macho << std::endl;
} catch (const LIEF::exception& err) {
std::cerr << err.what() << std::endl;
}
return 0;
}
```
### C (Limited API)
```cpp
#include <LIEF/LIEF.h>
int main(int argc, char** argv) {
Elf_Binary_t* elf = elf_parse("/usr/bin/ls");
Elf_Section_t** sections = elf->sections;
for (size_t i = 0; sections[i] != NULL; ++i) {
printf("%s\n", sections[i]->name);
}
elf_binary_destroy(elf);
return 0;
}
```
## Documentation
* [Main documentation](http://lief.quarkslab.com/doc/index.html)
* [Tutorial](http://lief.quarkslab.com/doc/tutorials/index.html)
* [API](http://lief.quarkslab.com/doc/api/index.html)
* [Doxygen](http://lief.quarkslab.com/doxygen/index.html)
* [Main documentation](https://lief.quarkslab.com/doc/latest/index.html)
* [Tutorial](https://lief.quarkslab.com/doc/latest/tutorials/index.html)
* [API](https://lief.quarkslab.com/doc/latest/api/index.html)
* [Doxygen](https://lief.quarkslab.com/doc/latest/doxygen/index.html)
## Contact
* **Mail**: lief at quarkslab com
* **Gitter**: [lief-project](https://gitter.im/lief-project)
## Authors
## About
### Authors
Romain Thomas ([@rh0main](https://twitter.com/rh0main)) - [Quarkslab](https://www.quarkslab.com)
---------------
### License
LIEF is provided under the [Apache 2.0 license](https://github.com/lief-project/LIEF/blob/0.11.2/LICENSE).
### Bibtex
```latex
@MISC {LIEF,
author = "Romain Thomas",
title = "LIEF - Library to Instrument Executable Formats",
howpublished = "https://lief.quarkslab.com/",
month = "April",
year = "2017",
}
```
<p align="center" >
<img width="40%" src="http://lief.quarkslab.com/resources/QB-big.png"/>
</p>
+1 -2
View File
@@ -28,6 +28,5 @@ endif()
source_group("Header Files\\C API" FILES ${LIEF_C_INCLUDE_FILES})
target_sources(LIB_LIEF_STATIC PRIVATE "${LIEF_C_SRC}" ${LIEF_C_INCLUDE_FILES})
target_sources(LIB_LIEF_SHARED PRIVATE "${LIEF_C_SRC}" ${LIEF_C_INCLUDE_FILES})
target_sources(LIB_LIEF PRIVATE "${LIEF_C_SRC}" ${LIEF_C_INCLUDE_FILES})
+3 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cstring>
#include "LIEF/ELF/Binary.h"
#include "LIEF/ELF/Section.h"
#include "LIEF/ELF/Segment.h"
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+1 -6
View File
@@ -42,9 +42,4 @@ set(LIEF_C_ELF_INC "${LIEF_API_C_ELF_INCLUDE_FILES_C}" "${LIEF_API_C_ELF_INCLUDE
source_group("Source Files\\C API\\ELF" FILES ${LIEF_API_C_ELF_SRC})
source_group("Header Files\\C API\\ELF" FILES ${LIEF_C_ELF_INC})
target_sources(LIB_LIEF_STATIC PRIVATE "${LIEF_C_ELF_SRC}" "${LIEF_C_ELF_INC}")
target_sources(LIB_LIEF_SHARED PRIVATE "${LIEF_C_ELF_SRC}" "${LIEF_C_ELF_INC}")
target_sources(LIB_LIEF PRIVATE "${LIEF_C_ELF_SRC}" "${LIEF_C_ELF_INC}")
+9 -3
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,13 @@
*/
#include "DynamicEntry.hpp"
#include "LIEF/ELF/DynamicEntryFlags.hpp"
#include "LIEF/ELF/DynamicSharedObject.hpp"
#include "LIEF/ELF/DynamicEntryLibrary.hpp"
#include "LIEF/ELF/DynamicEntryRpath.hpp"
#include "LIEF/ELF/DynamicEntryRunPath.hpp"
#include "LIEF/ELF/DynamicEntryArray.hpp"
namespace LIEF {
namespace ELF {
@@ -39,7 +46,6 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
break;
// cppcheck-suppress memleak
}
case DYNAMIC_TAGS::DT_SONAME:
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+1 -4
View File
@@ -43,7 +43,4 @@ set(LIEF_C_MACHO_INC "${LIEF_API_C_MACHO_INCLUDE_FILES_C}" "${LIEF_API_C_MACHO_I
source_group("Source Files\\C API\\MachO" FILES ${LIEF_API_C_MACHO_SRC})
source_group("Header Files\\C API\\MachO" FILES ${LIEF_C_MACHO_INC})
target_sources(LIB_LIEF_STATIC PRIVATE "${LIEF_API_C_MACHO_SRC}" ${LIEF_C_MACHO_INC})
target_sources(LIB_LIEF_SHARED PRIVATE "${LIEF_API_C_MACHO_SRC}" ${LIEF_C_MACHO_INC})
target_sources(LIB_LIEF PRIVATE "${LIEF_API_C_MACHO_SRC}" ${LIEF_C_MACHO_INC})
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
#include "LIEF/MachO/Binary.h"
#include "LIEF/MachO/Parser.hpp"
#include "LIEF/MachO/FatBinary.hpp"
#include "Binary.hpp"
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +44,7 @@ void init_c_segments(Macho_Binary_t* c_binary, Binary* binary) {
c_binary->segments[i]->numberof_sections = segment.numberof_sections();
c_binary->segments[i]->flags = segment.flags();
c_binary->segments[i]->content = content;
c_binary->segments[i]->size = segment_content.size();
c_binary->segments[i]->sections = nullptr; //TODO
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+1 -3
View File
@@ -46,6 +46,4 @@ set(LIEF_C_PE_INC "${LIEF_API_C_PE_INCLUDE_FILES_C}" "${LIEF_API_C_PE_INCLUDE_FI
source_group("Source Files\\C API\\PE" FILES ${LIEF_API_C_PE_SRC})
source_group("Header Files\\C API\\PE" FILES ${LIEF_C_PE_INC})
target_sources(LIB_LIEF_STATIC PRIVATE "${LIEF_API_C_PE_SRC}" "${LIEF_C_PE_INC}")
target_sources(LIB_LIEF_SHARED PRIVATE "${LIEF_API_C_PE_SRC}" "${LIEF_C_PE_INC}")
target_sources(LIB_LIEF PRIVATE "${LIEF_API_C_PE_SRC}" "${LIEF_C_PE_INC}")
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+12 -7
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,11 +28,15 @@ void init_c_sections(Pe_Binary_t* c_binary, Binary* binary) {
Section& b_section = sections[i];
c_binary->sections[i] = static_cast<Pe_Section_t*>(malloc(sizeof(Pe_Section_t)));
std::vector<uint8_t> section_content = b_section.content();
uint8_t* content = static_cast<uint8_t*>(malloc(section_content.size() * sizeof(uint8_t)));
std::move(
std::begin(section_content),
std::end(section_content),
content);
uint8_t* content = nullptr;
if (section_content.size() > 0) {
content = static_cast<uint8_t*>(malloc(section_content.size() * sizeof(uint8_t)));
std::move(
std::begin(section_content),
std::end(section_content),
content);
}
c_binary->sections[i]->name = b_section.name().c_str();
c_binary->sections[i]->virtual_address = b_section.virtual_address();
@@ -43,6 +47,7 @@ void init_c_sections(Pe_Binary_t* c_binary, Binary* binary) {
c_binary->sections[i]->pointerto_line_numbers = b_section.pointerto_line_numbers();
c_binary->sections[i]->characteristics = b_section.characteristics();
c_binary->sections[i]->content = content;
c_binary->sections[i]->content_size = section_content.size();
c_binary->sections[i]->entropy = b_section.entropy();
}
c_binary->sections[sections.size()] = nullptr;
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -3
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
#include "LIEF/ELF/enums.h"
#include "LIEF/types.h"
/* @defgroup elf_symbol_c_api Symbol
/** @defgroup elf_symbol_c_api Symbol
* @ingroup elf_c_api
* @addtogroup elf_symbol_c_api
* @brief Symbol C API
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,6 +41,7 @@ struct Macho_Segment_t {
uint32_t numberof_sections;
uint32_t flags;
uint8_t* content;
uint64_t size;
Macho_Section_t** sections;
};
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+12
View File
@@ -6,6 +6,18 @@
extern "C" {
#endif
#ifdef _LIEF_EN
#undef _LIEF_EN
#endif
#ifdef _LIEF_EN_2
#undef _LIEF_EN_2
#endif
#ifdef _LIEF_EI
#undef _LIEF_EI
#endif
#define _LIEF_EN(N) LIEF_MACHO_##N // enum LIEF_N {
#define _LIEF_EN_2(N, TYPE) LIEF_MACHO_##N // enum LIEF_N {
#define _LIEF_EI(X) LIEF_MACHO_##X // LIEF_X
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -3
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ struct Pe_Binary_t {
typedef struct Pe_Binary_t Pe_Binary_t;
/** @brief Wrapper on LIEF::PE::Parser::parse */
/** Wrapper on LIEF::PE::Parser::parse */
LIEF_API Pe_Binary_t* pe_parse(const char *file);
LIEF_API void pe_binary_destroy(Pe_Binary_t* binary);
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

Some files were not shown because too many files have changed in this diff Show More