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
Romain Thomas a448c5ef31 Add changelog and update README according to v0.9.0 2018-06-10 18:22:12 +02:00
Romain Thomas f4e2d81bfe Add Mach-O encryption info command 2018-06-08 16:39:11 +02:00
Romain Thomas 311c7951e6 Fix missing builder 2018-06-08 15:34:21 +02:00
Romain Thomas cc5617dd75 Fix missing dyldinfo 2018-06-08 15:23:03 +02:00
Romain Thomas 33a2af4b18 Enhance Python binding 2018-06-08 14:58:00 +02:00
Romain Thomas 3cdfb29612 Bug fix 2018-06-08 11:06:21 +02:00
Romain Thomas cd1cc457cf Resolve #119 and enhance ELF Python bindings 2018-06-08 10:48:33 +02:00
Romain Thomas 163cd3bcc9 Expose ELF relocation info 2018-06-06 14:13:07 +02:00
Romain Thomas c8404450b7 Update doc 2018-06-01 09:45:02 +02:00
Romain Thomas 4fd3513151 Fix #178 2018-05-31 08:06:30 +02:00
Romain Thomas c765d086cc Fix infinite loop in export-trie parser 2018-05-30 11:14:36 +02:00
Romain Thomas 809d002c7d Replace unsupported code point 2018-05-24 07:11:21 +02:00
Romain Thomas f9276bb416 Handle mutf8 properly 2018-05-23 17:31:44 +02:00
Romain Thomas 7abca35e49 Disable abort() on fatal log 2018-05-23 12:57:49 +02:00
Romain Thomas dc909a174e Fix #172 2018-05-21 17:26:09 +02:00
Romain Thomas 4fcfba0cbf Enhance Dylib version API 2018-05-16 10:35:51 +02:00
Romain Thomas 68b0958a2a Set default python version to 3.5
Resolve: #127
2018-05-16 10:32:05 +02:00
Romain Thomas e8389fc98a Update references 2018-05-15 17:17:45 +02:00
Romain Thomas 2de4bab4b2 Merge branch 'pr/166' 2018-05-15 11:39:07 +02:00
yd0b0N e794ac1502 Add support for endianness 2018-05-15 11:38:56 +02:00
Romain Thomas 9e3b5b45f7 Support new Mach-O command:
* Segment split info
  * Sub framework
  * Dyld environment
2018-05-14 16:34:45 +02:00
Romain Thomas d1a7252d29 Fix parsing error 2018-05-14 11:23:30 +02:00
Romain Thomas e7c45a1778 Fix typo 2018-05-10 22:43:30 +02:00
Romain Thomas 4511a37f9c Enable JSON serialization for MachO format 2018-05-10 12:46:32 +02:00
Romain Thomas 63e17580a7 Remove json.cpp from default source files 2018-05-10 12:11:25 +02:00
Romain Thomas 1d539bbe95 Fix conversion issue 2018-05-10 12:10:58 +02:00
Romain Thomas 7e98df346d Fix missing break 2018-05-10 12:08:17 +02:00
Romain Thomas f97751f075 Fix typo 2018-05-10 11:23:21 +02:00
Romain Thomas 8dc9de59f7 Update examples 2018-05-10 10:57:38 +02:00
Romain Thomas 833b0439b4 Fix error 2018-05-10 10:57:38 +02:00
Romain Thomas 21ccc1d865 Add missing enum 2018-05-10 10:57:38 +02:00
Romain Thomas 6a53074e01 Remove unsed file 2018-05-10 10:57:38 +02:00
Romain Thomas f020fafb07 Add vdexExtractor 2018-05-10 10:57:38 +02:00
Romain Thomas 1d8ba8a42a Update C++ doc 2018-05-10 10:57:38 +02:00
Romain Thomas e7e0b4678b Update doc 2018-05-10 10:57:38 +02:00
Romain Thomas 5d9645847b Change logging level from DEBUG to INFO 2018-05-10 10:57:38 +02:00
Romain bc26443b62 Merge pull request #167 from aurelianito/harden-pe
Fix possible out of bound reads in utils.cpp
2018-05-09 06:09:51 +02:00
Aure 67eb7187ed Fix possible out of bound reads in utils.cpp 2018-05-08 23:39:36 -03:00
Romain Thomas 97c6d6dc65 Remove scale 2018-05-08 19:02:51 +02:00
Romain Thomas 3a381ca5fc Fix typo 2018-05-08 18:24:05 +02:00
Romain Thomas ab029fa75b Update Readme 2018-05-08 18:22:03 +02:00
Romain Thomas 8d3ff39239 Fix typo 2018-05-08 18:21:53 +02:00
Romain Thomas 10cad1973b New tutorial about Android formats 2018-05-08 18:03:28 +02:00
Romain Thomas 1f32b25329 read_array and peek_array now throw an error if data are out of bound.
This behaviour can be disabled by specifying explicitly a bool value.
2018-05-08 13:15:41 +02:00
Romain Thomas c8f49ac013 Enhance bounds checking.
- read and peek throw an exception if the data are out of bound
  - read_array, peek_array return a nullptr if the data
    are out of bound and the **caller** is responsible to handle
    the behaviour.

Related to #165
2018-05-08 10:12:26 +02:00
Romain 6fb715a919 Update README.md 2018-05-07 09:47:00 +02:00
Romain Thomas b181034e25 Update architecture 2018-05-07 09:33:17 +02:00
Romain Thomas 8023aa2ce5 Update python doc 2018-05-07 07:57:07 +02:00
Romain Thomas eb9f7e3a7e Default style 2018-05-07 07:20:20 +02:00
Romain Thomas 6fee8532fd Update DEX file output 2018-05-07 06:49:06 +02:00
Romain Thomas 60c042fa6e Update OAT doc 2018-05-05 16:07:32 +02:00
Romain Thomas a47ff2ea66 Update OAT doc 2018-05-05 15:59:43 +02:00
Romain Thomas 4018724224 Update OAT doc 2018-05-05 15:27:09 +02:00
Romain Thomas 85023ba94b Fix error 2018-05-05 11:12:54 +02:00
Romain Thomas a4f220c171 Add blog reference 2018-05-05 11:06:01 +02:00
Romain Thomas d3fe00cc48 Include modules according to cmake options 2018-05-05 11:02:41 +02:00
Romain Thomas 9d7604a1ae Fix disable of JSON and LOGGING 2018-05-04 20:29:50 +02:00
Romain Thomas 4ef1bb845f Add new formats: OAT, DEX, VDEX, ART 2018-05-04 12:46:28 +02:00
Romain Thomas 6b8f8c11d3 Merge branch 'pr/162' 2018-05-03 07:46:08 +02:00
yd0b0N 0bbeaa81e9 Add applies_to field to Relocation
The field contains a pointer to the Section object
the OBJECT Relocation applies to.
2018-05-03 07:34:46 +02:00
Romain 55e99450f4 Merge pull request #163 from Naios/master
Remove a hardcoded dependency to easylogging++
2018-05-02 15:22:14 +02:00
Denis Blank d2e85e92d6 Remove a hardcoded dependency to easylogging++
* So easylogging++ isn't required anymore when
  undefining LIEF_LOGGING_SUPPORT.
2018-05-02 15:19:18 +02:00
Romain Thomas eeae4c9d1f Merge branch 'pr/161' 2018-05-02 15:16:25 +02:00
yd0b0N 08b514191f Add support for PPC32/64 relocations 2018-05-02 15:15:33 +02:00
Romain Thomas 2031956cc2 Fix #159 2018-04-29 07:40:27 +02:00
Romain Thomas 0f2855d6c3 Fix: Update dynamic section when adding a relocation 2018-04-29 06:12:03 +02:00
Romain Thomas 9a2ef208bb Update iterators tests 2018-04-23 09:55:09 +02:00
Romain Thomas db26017872 Remove debug message 2018-04-23 09:37:41 +02:00
Romain Thomas 30f34a6952 Include static symbols in exported/imported 2018-04-23 09:34:18 +02:00
Romain Thomas cda91aec7a Disable logging by default 2018-04-20 09:34:35 +02:00
Romain 29623d8725 Merge pull request #158 from zatherz/master
Windows compilation support (fix missing -lws2_32)
2018-04-16 07:25:42 +02:00
Zatherz 569dc591aa Windows compilation support (fix missing -lws2_32)
Provide `-DWINDOWS=1` to cmake to include necessary dependency ws2_32 in the build process.
2018-04-15 21:21:07 +02:00
Romain Thomas 4ef839c3d8 Enhance BinaryStream Interface 2018-04-15 08:55:23 +02:00
Romain Thomas a16e1c4d13 Expose DataInCode 2018-04-02 08:21:15 +02:00
Romain Thomas 9cadce30e7 Expose basic structure of code signature 2018-04-02 08:21:15 +02:00
Romain Thomas 70a18e8246 Merge branch 'pr/153' 2018-03-30 05:33:44 +02:00
Aure 04be950eab Add LIEF_SHARED_LIB option (default ON)
If LIEF_SHARED_LIB=off and LIEF_EXAMPLES=off and LIEF_PYTHON_API=off it works around bug #152 (Error compiling LIEF with VS2015 (fatal error C1001)) when calling the INSTALL build target
2018-03-30 05:32:59 +02:00
Romain Thomas 237611f859 Expose the Dynamic symbol command 2018-03-28 16:14:56 +02:00
Romain Thomas 9c24533356 Enhance logging module 2018-03-28 09:39:37 +02:00
Romain Thomas 4ee01e5de5 Enable profiling 2018-03-28 07:29:05 +02:00
Romain Thomas 262af07311 Use Frozen for static const containers.
Thanks to https://github.com/serge-sans-paille/frozen

By default, Frozen is used if the compiler support C++14. It can be disabled by
using the "LIEF_DISABLE_FROZEN" option during the CMake configuration
step
2018-03-28 05:57:22 +02:00
Romain Thomas 8660060064 Fix doxygen doc 2018-03-27 21:27:08 +02:00
Romain Thomas 6676d6c91d Fix typo 2018-03-27 21:26:52 +02:00
Romain Thomas 73acf00288 Rephrase 2018-03-27 21:26:19 +02:00
Romain Thomas 5a6448c00d Explicit is better than implicit:
Add api to specify if the virtual address given to
LIEF::Binary::patch_address or
LIEF::Binary::get_content_from_virtual_address
is relative or absolute
2018-03-27 15:36:08 +02:00
Romain Thomas 508a1bd0c8 Add ELFKickers 2018-03-26 15:15:41 +02:00
Romain Thomas d42c675040 Add tutorial #9 2018-03-26 11:05:32 +02:00
Romain Thomas 00d35616f4 Add mithril 2018-03-20 20:56:01 +01:00
Romain Thomas 30544b095b Fix #151 2018-03-20 17:37:31 +01:00
Romain Thomas 4969a4c55a Expose MachO SymbolCommand (LC_SYMTAB) 2018-03-19 16:46:48 +01:00
Romain Thomas e6e6801e95 Cleanup Doxyfile 2018-03-19 11:07:01 +01:00
Romain Thomas 21e6c72563 Remove unneeded files 2018-03-19 11:06:44 +01:00
Romain Thomas 47a03223aa Fix Mach-O bound errors 2018-03-19 08:23:30 +01:00
Romain Thomas 6273c6f065 Fix typo 2018-03-18 20:30:31 +01:00
Romain Thomas 3a4406fcfe Add LANG_BOSNIAN 2018-03-18 20:16:07 +01:00
Romain Thomas c6ac39bc7c Add LANG_BANGLA 2018-03-18 19:59:00 +01:00
Romain Thomas 3029c9620f Update PE 'undef' 2018-03-18 19:10:27 +01:00
Romain Thomas fda5f65d1c Fix test 2018-03-18 18:52:57 +01:00
Romain Thomas 46fa0e9747 Fix #139
API added:
  * PE::ResourceDialog::lang
  * PE::ResourceDialog::sub_lang
2018-03-18 18:16:19 +01:00
Romain Thomas 4e3e87eea4 Fix #136 2018-03-18 18:15:21 +01:00
Romain Thomas 17f391febc Remove exceptions and print a warning 2018-03-18 09:26:29 +01:00
Romain Thomas 79a5d0e93b Add Virus Disinfector KIT 2018-03-16 16:26:59 +01:00
Romain Thomas 0ebd8a78b1 Update references 2018-03-16 10:47:25 +01:00
Romain Thomas 3b17aba10e Refactor some parts of the Architecture:
* JSON visitor are located in the format namespace
  * Visitor are *real* visitor
  * Visitable class has been renamed to Object
  * Due to a bug in Visual Studio 2015, we move to VS2017
2018-03-13 16:49:02 +01:00
Romain a5c2922c83 Merge pull request #150 from fdfalcon/patch-1
LoadConfigurationV5 doc fix
2018-03-11 15:12:35 -04:00
Francisco Falcon eaf1713b81 LoadConfigurationV5 doc fix
Tiny documentation fix: LoadConfigurationV5 was showing the documentation for the LoadConfigurationV4 class.
2018-03-09 22:46:23 -03:00
Romain Thomas d26fdb41ec Use /MTd when Debug build
Fix: #147
2018-03-09 08:29:31 +01:00
Romain Thomas 251676a0a2 Hide 'is' and 'as' implementation 2018-03-07 12:52:12 +01:00
Romain Thomas 2a5f1519f8 Fix bug with gcc-4.9 2018-03-07 12:52:12 +01:00
Romain Thomas df3d269e23 Enhance ELF symbols 2018-03-07 12:51:28 +01:00
Romain Thomas 5d56141061 Show Mach-O opcodes and export-trie 2018-03-02 09:24:59 +01:00
Romain 135aeab50f Update README.md 2018-03-02 07:10:57 +01:00
Romain Thomas c6d79c0da5 Add images 2018-03-02 07:06:22 +01:00
Romain Thomas a40da3e3b4 Enable to export and create dynamic symbols
New API:

  * Binary::{has_dynamic_symbol, has_static_symbol}
  * Binary::{get_dynamic_symbol, get_static_symbol}
  * Binary::add_exported_function
  * Binary::export_symbol

  * Symbol::visibility
  * SymbolVersion::local / SymbolVersion::global

Resolve #112
2018-02-28 16:18:33 +01:00
Romain Thomas 253c2b5e62 Fix type (tuple to list) 2018-02-28 16:17:32 +01:00
Romain Thomas d13db18214 Support the '.note.android.ident' section 2018-02-28 15:45:46 +01:00
Romain Thomas 3cf0ec92c3 Undef some IMAGE_DEBUG_*
close #144
2018-02-28 09:47:12 +01:00
Romain Thomas 1418272c2c Expose item iterator 2018-02-19 09:32:01 +01:00
Romain Thomas 49a2e40bf3 Add CODE_VIEW_SIGNATURES in the doc 2018-02-17 14:06:29 +01:00
Romain Thomas eab4a7614f Parse PE Code View (PDB 7.0)
Resolve: #138
2018-02-17 12:50:10 +01:00
Romain Thomas 6cb9519728 Log error 2018-02-15 17:01:49 +01:00
Romain Thomas b9237bf027 Fix infinite loop 2018-02-15 11:35:02 +01:00
Romain Thomas 2042b750e0 Fix bug in windows 2018-02-15 11:09:38 +01:00
Romain Thomas dee5c07784 Remove depth limit 2018-02-15 09:29:38 +01:00
Romain Thomas 463e471b33 Fix extra spaces 2018-02-15 09:06:47 +01:00
Romain Thomas 3e704e78c5 Add "ResourceDialogItem" in the Python PE documentation
Related to #139
2018-02-14 22:16:24 +01:00
Romain Thomas d93b235e03 Fix error in PE TLS parser 2018-02-14 21:56:38 +01:00
Romain Thomas fbdefff46e Update ref usage 2018-02-14 21:21:34 +01:00
Romain Thomas 4382fea62e Fix swap const issue 2018-02-14 06:41:46 +01:00
Romain Thomas 1e701344c2 Fix missing include 2018-02-13 13:47:58 +01:00
Romain Thomas d910cc4034 Move from ssize_t to ptrdiff_t 2018-02-13 13:37:59 +01:00
Romain Thomas 1891655459 Fix error in iterator size 2018-02-13 10:34:17 +01:00
Romain Thomas 75744cfd1c update iterators tests 2018-02-11 08:33:31 +01:00
Romain Thomas 4d18af12e9 Improve LIEF iterators 2018-02-11 08:31:14 +01:00
Romain Thomas 210b03b9d3 Fix #135 2018-02-10 12:41:16 +01:00
Romain baaeab316b Merge pull request #134 from srcr/patch-1
Added FreeBSD references to solve install issues
2018-02-10 06:28:45 -05:00
Peter 2fca982c8d Added FreeBSD references to solve install issues
Added FreeBSD as possible target OS. Python3.6 install --user was throwing error about unknown OS. 
these fixes worked on my end.
2018-02-09 10:28:28 +01:00
Romain Thomas c0c9fc3863 Fix bound check 2018-02-01 14:21:10 +01:00
Romain Thomas 1d27cac3f9 Install requests 2018-02-01 13:49:44 +01:00
Romain Thomas 531ec1c8b4 Improve CI 2018-02-01 09:59:06 +01:00
Romain Thomas 83e390f7ce Remove unshallow 2018-01-31 17:19:39 +01:00
Romain Thomas f4d174c9f1 Resolve #132 2018-01-19 17:36:52 +01:00
Romain Thomas 6443b43434 Fix checkout 2018-01-19 17:30:46 +01:00
Romain Thomas 42102fe5b2 Full clone of LIEF 2018-01-19 16:19:01 +01:00
Romain Thomas 6b62777aa1 Enhance versioning with cmake 2018-01-18 16:47:01 +01:00
Romain Thomas 9d93cc5ec4 Update API for MachO RPath. Related to 27575527db 2018-01-18 14:41:48 +01:00
Romain 09f4a4019c Merge pull request #128 from 0xbf00/master
Parse the MachO LC_RPATH command
2017-12-17 13:55:06 -05:00
Jakob Rieck 27575527db Added test for RPathCommand 2017-12-17 12:36:58 +01:00
Jakob Rieck 196994dc08 Parse the MachO LC_RPATH command 2017-12-15 00:14:00 +01:00
Romain Thomas 23d4e82384 Fix #125 2017-12-12 06:24:18 +01:00
Romain Thomas ae4c2a95ee Fix #126 2017-12-11 08:55:40 +01:00
Romain Thomas 92a601190c Fix typo in tutorial 01 2017-12-10 16:03:13 +01:00
Romain Thomas b045f7d4cd Fix OSX Python 3.6 Path 2017-12-10 15:57:20 +01:00
Romain Thomas 66b484938a Fix typo 2017-12-01 16:50:24 +01:00
Romain Thomas d6327dd0fe Change OSX Python 3.6 version 2017-12-01 16:41:52 +01:00
Romain Thomas 24cc485038 Add JSON headers only if JSON module is enabled 2017-12-01 16:39:18 +01:00
Romain Thomas b9c50dce34 WIP 2017-11-30 17:41:20 +01:00
Romain Thomas 9125b146cd Disable lief logger by default and export C API for logger
C API Changes (Added):
  * lief_logging_disable
  * lief_logging_enable
  * lief_logging_set_level
  * lief_logging_set_verbose_level
2017-11-30 16:58:40 +01:00
Romain Thomas 201a6c144d Catch exception when number of ELF dynamic symbols is too large 2017-11-26 21:02:41 +01:00
Romain Thomas 1c722d9ff2 Add new ELF relocations 2017-11-25 11:42:00 +01:00
Romain Thomas e3e3eb8bc6 Fix missing include 2017-11-22 09:17:49 +01:00
Romain Thomas fe7e426f7b Merge branch 'pr/116' 2017-11-22 09:03:44 +01:00
illera88 93a4b2e2b2 Reorg so when LIEF_LOGGING=off easylogging++ does not get included at all 2017-11-22 09:02:52 +01:00
Romain Thomas 4e38d9cf99 Fix #117 2017-11-21 16:59:39 +01:00
Romain Thomas 404e0ecca3 Enhance LIEF 'modules' separation 2017-11-18 18:07:14 +01:00
Romain Thomas d96fd16ecd Change logging_config to a 'private' scope 2017-11-18 09:56:18 +01:00
Romain Thomas bf97d22b35 Add Dyld tests 2017-11-04 21:08:44 +01:00
Romain Thomas ba7dfeab39 Update doc 2017-11-01 20:34:20 +01:00
Romain Thomas aa70e07791 Handle Python BytesIO, TextIO for LIEF' parsers
Resolve: #49
2017-11-01 16:44:39 +01:00
Romain Thomas 49fdb8dc8f Add 'shell' and 'breakp' for the Python API
* 'lief.shell()' spawns an IPython interpreter with the current
     context
  * 'lief.breakp()' launchs pdb.set_trace()
2017-11-01 16:38:48 +01:00
Romain Thomas 5778bae34c Use Pybind11 C++ API instead of 'eval' 2017-11-01 16:38:03 +01:00
Romain Thomas a18e22f2cb Sanitize 'read_string' 2017-11-01 15:04:01 +01:00
Romain Thomas 4cee3fa240 Some improvements in the CMake build
* cache dependencies in the 'third-party' directory.
  * Enhance Python 'find_library'
2017-11-01 10:12:05 +01:00
Romain Thomas 49c2d089dd Downgrade the setuptools requirement to 31.0.0 2017-10-30 15:34:53 +01:00
Romain Thomas 7dd2e82e42 Update README according to new version 2017-10-30 15:34:53 +01:00
Romain Thomas d421f12e32 Update doc for symbols 2017-10-30 15:34:53 +01:00
Romain Thomas 880b99aeef Provide MachO::ParserConfig to parametrize the parsing.
Resolve: #105
2017-10-30 15:34:53 +01:00
Romain Thomas c61caaecce Update changelog 2017-10-30 15:30:25 +01:00
Romain Thomas 18d5b75d57 Bump to 0.8.3 2017-10-29 15:48:56 +01:00
Romain Thomas abbc264833 Fix bug on comparaison 2017-10-29 15:46:55 +01:00
Romain Thomas 745e272577 Move to 0.8.2 2017-10-23 14:42:16 +02:00
1210 changed files with 105187 additions and 59512 deletions
+86 -98
View File
@@ -1,59 +1,25 @@
version: 0.7.{build}
image: Visual Studio 2015
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,88 +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
-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
Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

+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()
+138
View File
@@ -0,0 +1,138 @@
# Launch Docker CI when committing
# Inspired from https://medium.com/@zypherman/my-experiences-with-travis-ci-7f5ea26a87c0
import requests
import json
import time
import sys
import logging
import pprint
import os
LOG_LEVEL = logging.INFO
logging.getLogger().addHandler(logging.StreamHandler())
logging.getLogger().setLevel(LOG_LEVEL)
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.error("No token found!")
sys.exit(1)
LIEF_ID = 12579556
DOCKER_ID = 15139981
ENDPOINT = 'https://api.travis-ci.org'
LIEF = f"{ENDPOINT}/repo/{LIEF_ID}"
DOCKER = f"{ENDPOINT}/repo/{DOCKER_ID}"
DOCKER_ENV_VARS_ENDPOINT = f"{DOCKER}/env_vars"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'User-Agent': 'API Explorer',
'Travis-API-Version': '3',
'Authorization': f'token {AUTH_TOKEN}'
}
def last_docker_build():
response = requests.get(f"{DOCKER}/branch/master", headers=headers)
if not response.ok:
logging.error("Error while getting last_docker_build")
sys.exit(1)
href = response.json()["last_build"]["@href"]
build_info = requests.get(f"{ENDPOINT}{href}", headers=headers)
if not build_info.ok:
logging.error("Error while getting build_info")
sys.exit(1)
return build_info.json()
def trigger_build():
response = requests.get(f"{DOCKER}/branch/master", headers=headers)
build_info = last_docker_build()
pprint.pprint(build_info)
# Get last build info
last_build_id = build_info["id"]
last_build_status = build_info["state"]
# Create env variables
env_vars = [
{
"env_var.name": "TRIGGER_COMMIT",
"env_var.value": os.getenv("TRAVIS_COMMIT"),
"env_var.public": False,
},
{
"env_var.name": "TRIGGER_REPO",
"env_var.value": os.getenv("TRAVIS_REPO_SLUG"),
"env_var.public": False,
},
{
"env_var.name": "TRIGGER_ACTION",
"env_var.value": "build-doc",
"env_var.public": False,
},
{
"env_var.name": "DEPENDENT_BUILD",
"env_var.value": "true",
"env_var.public": False,
},
]
env_vars_results = requests.get(DOCKER_ENV_VARS_ENDPOINT, headers=headers)
if not env_vars_results.ok:
logger.error("Error while getting Docker env variables")
sys.exit(1)
env_vars_remote = env_vars_results.json()["env_vars"]
# Set env variables
for env_var in env_vars:
remote_var = next(filter(lambda v : v["name"] == env_var["env_var.name"], env_vars_remote), None)
if remote_var:
r = requests.patch(f"{DOCKER}/env_var/{remote_var['id']}", data=json.dumps(env_var), headers=headers)
if not r.ok:
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:
logger.error(f"Error while setting variable: '{env_var['env_var.name']}'")
sys.exit(1)
# (Re)Start build
result = requests.post(f"{ENDPOINT}/build/{last_build_id}/restart", headers=headers)
if not result.ok:
logger.error("Error while restarting the build")
sys.exit(1)
return 0
def main():
is_pull_request = not (os.getenv("TRAVIS_PULL_REQUEST", "false") == "false")
if is_pull_request:
logger.info("Skipping pull request build...")
return 0
return trigger_build()
if __name__ == "__main__":
sys.exit(main())
+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
+292 -201
View File
@@ -1,231 +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.0b4; 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.0b4/include/python3.6m ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "3.6" ]]; then export PYTHON_LIBRARY=$(pyenv root)/versions/3.6.0b4/lib/libpython3.dylib ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$PYTHON_VERSION" == "3.6" ]]; then export PYTHON_BINARY=$(pyenv root)/versions/3.6.0b4/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 --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
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
+444 -589
View File
File diff suppressed because it is too large Load Diff
+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 *
+131 -128
View File
@@ -1,130 +1,116 @@
<p align="center" >
<img width="40%" src="http://romainthomas.fr/logo_blue_with_name_500.png"/><br />
<img width="90%" src="https://github.com/lief-project/LIEF/blob/master/.github/images/architecture.png"/><br />
</p>
<hr>
<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.8.1-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
The purpose of this project is to provide a cross platform library which can parse, modify and abstract ELF, PE and MachO formats.
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)
- [Documentation](#documentation)
- [Sphinx](https://lief.quarkslab.com/doc/stable/index.html)
- [Doxygen](https://lief.quarkslab.com/doc/latest/doxygen/index.html)
- Tutorials:
- [Parse and manipulate formats](https://lief.quarkslab.com/doc/latest/tutorials/01_play_with_formats.html)
- [Create a PE from scratch](https://lief.quarkslab.com/doc/latest/tutorials/02_pe_from_scratch.html)
- [Play with ELF symbols](https://lief.quarkslab.com/doc/latest/tutorials/03_elf_change_symbols.html)
- [ELF Hooking](https://lief.quarkslab.com/doc/latest/tutorials/04_elf_hooking.html)
- [Infecting the plt/got](https://lief.quarkslab.com/doc/latest/tutorials/05_elf_infect_plt_got.html)
- [PE Hooking](https://lief.quarkslab.com/doc/latest/tutorials/06_pe_hooking.html)
- [PE Resources](https://lief.quarkslab.com/doc/latest/tutorials/07_pe_resource.html)
- [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)
- [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.8.1.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.8.1-Linux.tar.gz">SDK</a></td>
<td><a href="https://github.com/lief-project/packages/raw/lief-master-latest/LIEF-0.8.1-win32.zip">SDK</a></td>
<td><a href="https://github.com/lief-project/packages/raw/lief-master-latest/LIEF-0.8.1-win64.zip">SDK</a></td>
<td><a href="https://github.com/lief-project/packages/raw/lief-master-latest/LIEF-0.8.1-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.8.1.dev.zip">Python</a></p></td>
</tr>
</table>
<table>
<tr><td colspan="6"><b><img src="https://img.shields.io/badge/release-0.8.1-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.8.1/LIEF-0.8.1-Linux.tar.gz">SDK</a></td>
<td>
<a href="https://github.com/lief-project/LIEF/releases/download/0.8.1/LIEF-0.8.1-win32.zip">SDK - x86</a>
<br />
<a href="https://github.com/lief-project/LIEF/releases/download/0.8.1/LIEF-0.8.1-win64.zip">SDK - x86-64</a>
</td>
<td><a href="https://github.com/lief-project/LIEF/releases/download/0.8.1/LIEF-0.8.1-Darwin.tar.gz">SDK</a></td>
<td><a href="https://github.com/lief-project/LIEF/releases/download/0.8.1/LIEF-0.8.1-CentOS.tar.gz">SDK</a></td>
<td>
<a href="https://github.com/lief-project/LIEF/releases/download/0.8.1/LIEF-0.8.1-Android_x86_64.tar.gz">SDK - x86-64</a>
<br />
<a href="https://github.com/lief-project/LIEF/releases/download/0.8.1/LIEF-0.8.1-Android_x86.tar.gz">SDK - x86</a>
<br />
<a href="https://github.com/lief-project/LIEF/releases/download/0.8.1/LIEF-0.8.1-Android_armeabi-v7a.tar.gz">SDK - ARM</a>
<br />
<a href="https://github.com/lief-project/LIEF/releases/download/0.8.1/LIEF-0.8.1-Android_aarch64.tar.gz">SDK - AARCH64</a>
</td>
<td><a href="https://github.com/lief-project/LIEF/releases/download/0.8.1/documentation-0.8.1.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.8.1/pylief-0.8.1.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
@@ -132,90 +118,107 @@ Here one can find guides to install or integrate LIEF:
```python
import lief
# ELF
binary = lief.parse("/usr/bin/ls")
print(binary)
# PE
# PE
binary = lief.parse("C:\\Windows\\explorer.exe")
print(binary)
# Mach-O
binary = lief.parse("/usr/bin/ls")
print(binary)
```
### C++
```cpp
#include <LIEF/LIEF.hpp>
int main(int argc, const char** argv) {
LIEF::ELF::Binary* elf = LIEF::ELF::Parser::parse("/usr/bin/ls");
LIEF::PE::Binary* pe = LIEF::PE::Parser::parse("C:\\Windows\\explorer.exe");
LIEF::MachO::Binary* macho = LIEF::MachO::Parser::parse("/usr/bin/ls");
std::cout << *elf << std::endl;
std::cout << *pe << std::endl;
std::cout << *macho << std::endl;
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;
}
delete elf;
delete pe;
delete macho;
// 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
### C (Limited API)
```cpp
#include <LIEF/LIEF.h>
int main(int argc, const char** argv) {
Elf_Binary_t* elf_binary = elf_parse("/usr/bin/ls");
Pe_Binary_t* pe_binary = pe_parse("C:\\Windows\\explorer.exe");
Macho_Binary_t** macho_binaries = macho_parse("/usr/bin/ls");
int main(int argc, char** argv) {
Elf_Binary_t* elf = elf_parse("/usr/bin/ls");
Pe_Section_t** pe_sections = pe_binary->sections;
Elf_Section_t** elf_sections = elf_binary->sections;
Macho_Section_t** macho_sections = macho_binaries[0]->sections;
Elf_Section_t** sections = elf->sections;
for (size_t i = 0; pe_sections[i] != NULL; ++i) {
printf("%s\n", pe_sections[i]->name)
for (size_t i = 0; sections[i] != NULL; ++i) {
printf("%s\n", sections[i]->name);
}
for (size_t i = 0; elf_sections[i] != NULL; ++i) {
printf("%s\n", elf_sections[i]->name)
}
for (size_t i = 0; macho_sections[i] != NULL; ++i) {
printf("%s\n", macho_sections[i]->name)
}
elf_binary_destroy(elf_binary);
pe_binary_destroy(pe_binary);
macho_binaries_destroy(macho_binaries);
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>
+3 -3
View File
@@ -8,10 +8,11 @@ set(LIEF_C_INCLUDE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/LIEF.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/logging.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/types.h"
)
set(LIEF_C_SRC ${LIEF_C_INCLUDE_FILES})
set(LIEF_C_SRC "${CMAKE_CURRENT_LIST_DIR}/logging.cpp")
if (LIEF_ELF)
include("${CMAKE_CURRENT_LIST_DIR}/ELF/CMakeLists.txt")
@@ -27,6 +28,5 @@ endif()
source_group("Header Files\\C API" FILES ${LIEF_C_INCLUDE_FILES})
target_sources(LIB_LIEF_STATIC PRIVATE "${LIEF_C_SRC}")
target_sources(LIB_LIEF_SHARED PRIVATE "${LIEF_C_SRC}")
target_sources(LIB_LIEF PRIVATE "${LIEF_C_SRC}" ${LIEF_C_INCLUDE_FILES})
+5 -4
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"
@@ -36,7 +37,7 @@ namespace ELF {
void init_c_binary(Elf_Binary_t* c_binary, Binary* binary) {
c_binary->handler = reinterpret_cast<void*>(binary);
c_binary->name = binary->name().c_str();
c_binary->type = static_cast<enum ::ELF_CLASS>(binary->type());
c_binary->type = static_cast<enum LIEF_ELF_ELF_CLASS>(binary->type());
c_binary->interpreter = nullptr;
if (binary->has_interpreter()) {
std::string interp = binary->interpreter();
@@ -63,7 +64,7 @@ void init_c_binary(Elf_Binary_t* c_binary, Binary* binary) {
}
Elf_Binary_t* elf_parse(const char *file) {
Binary* binary = Parser::parse(file);
Binary* binary = Parser::parse(file).release();
Elf_Binary_t* c_binary = static_cast<Elf_Binary_t*>(malloc(sizeof(Elf_Binary_t)));
memset(c_binary, 0, sizeof(Elf_Binary_t));
init_c_binary(c_binary, 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.
+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}")
+26 -20
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 {
@@ -33,13 +40,12 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
Elf_DynamicEntry_Library_t* e = static_cast<Elf_DynamicEntry_Library_t*>(
malloc(sizeof(Elf_DynamicEntry_Library_t)));
e->tag = static_cast<enum ::DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
e->name = dynamic_cast<DynamicEntryLibrary*>(&entry)->name().c_str();
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
break;
// cppcheck-suppress memleak
}
case DYNAMIC_TAGS::DT_SONAME:
@@ -47,7 +53,7 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
Elf_DynamicEntry_SharedObject_t* e = static_cast<Elf_DynamicEntry_SharedObject_t*>(
malloc(sizeof(Elf_DynamicEntry_SharedObject_t)));
e->tag = static_cast<enum ::DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
e->name = dynamic_cast<DynamicSharedObject*>(&entry)->name().c_str();
@@ -60,7 +66,7 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
Elf_DynamicEntry_Rpath_t* e = static_cast<Elf_DynamicEntry_Rpath_t*>(
malloc(sizeof(Elf_DynamicEntry_Rpath_t)));
e->tag = static_cast<enum ::DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
e->rpath = dynamic_cast<DynamicEntryRpath*>(&entry)->name().c_str();
@@ -74,7 +80,7 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
Elf_DynamicEntry_RunPath_t* e = static_cast<Elf_DynamicEntry_RunPath_t*>(
malloc(sizeof(Elf_DynamicEntry_RunPath_t)));
e->tag = static_cast<enum ::DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
e->runpath = dynamic_cast<DynamicEntryRunPath*>(&entry)->name().c_str();
@@ -90,7 +96,7 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
Elf_DynamicEntry_Array_t* e = static_cast<Elf_DynamicEntry_Array_t*>(
malloc(sizeof(Elf_DynamicEntry_Array_t)));
e->tag = static_cast<enum ::DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
const std::vector<uint64_t>& array = dynamic_cast<DynamicEntryArray*>(&entry)->array();
e->array = static_cast<uint64_t*>(malloc((array.size() + 1) * sizeof(uint64_t)));
@@ -108,19 +114,19 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
Elf_DynamicEntry_Flags_t* e = static_cast<Elf_DynamicEntry_Flags_t*>(
malloc(sizeof(Elf_DynamicEntry_Flags_t)));
e->tag = static_cast<enum ::DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
const dynamic_flags_list_t& flags = dynamic_cast<DynamicEntryFlags*>(&entry)->flags();
e->flags = static_cast<enum ::DYNAMIC_FLAGS*>(malloc((flags.size() + 1) * sizeof(DYNAMIC_FLAGS)));
const DynamicEntryFlags::flags_list_t& flags = dynamic_cast<DynamicEntryFlags*>(&entry)->flags();
e->flags = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS*>(malloc((flags.size() + 1) * sizeof(enum LIEF_ELF_DYNAMIC_FLAGS)));
e->flags_1 = nullptr;
auto&& it = std::begin(flags);
for (size_t i = 0; it != std::end(flags); ++i, ++it) {
e->flags[i] = static_cast<enum ::DYNAMIC_FLAGS>(*it);
e->flags[i] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS>(*it);
}
e->flags[flags.size()] = static_cast<enum ::DYNAMIC_FLAGS>(0);
e->flags[flags.size()] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS>(0);
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
break;
@@ -131,19 +137,19 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
Elf_DynamicEntry_Flags_t* e = static_cast<Elf_DynamicEntry_Flags_t*>(
malloc(sizeof(Elf_DynamicEntry_Flags_t)));
e->tag = static_cast<enum ::DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
const dynamic_flags_list_t& flags = dynamic_cast<DynamicEntryFlags*>(&entry)->flags();
e->flags_1 = static_cast<enum ::DYNAMIC_FLAGS_1*>(malloc((flags.size() + 1) * sizeof(DYNAMIC_FLAGS_1)));
const DynamicEntryFlags::flags_list_t& flags = dynamic_cast<DynamicEntryFlags*>(&entry)->flags();
e->flags_1 = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS_1*>(malloc((flags.size() + 1) * sizeof(enum LIEF_ELF_DYNAMIC_FLAGS_1)));
e->flags = nullptr;
auto&& it = std::begin(flags);
for (size_t i = 0; it != std::end(flags); ++i, ++it) {
e->flags_1[i] = static_cast<enum ::DYNAMIC_FLAGS_1>(*it);
e->flags_1[i] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS_1>(*it);
}
e->flags_1[flags.size()] = static_cast<enum ::DYNAMIC_FLAGS_1>(0);
e->flags_1[flags.size()] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS_1>(0);
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
break;
@@ -156,7 +162,7 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
{
c_binary->dynamic_entries[i] =
static_cast<Elf_DynamicEntry_t*>(malloc(sizeof(Elf_DynamicEntry_t)));
c_binary->dynamic_entries[i]->tag = static_cast<enum ::DYNAMIC_TAGS>(entry.tag());
c_binary->dynamic_entries[i]->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
c_binary->dynamic_entries[i]->value = entry.value();
}
@@ -173,7 +179,7 @@ void destroy_dynamic_entries(Elf_Binary_t* c_binary) {
Elf_DynamicEntry_t **dynamic_entries = c_binary->dynamic_entries;
for (size_t idx = 0; dynamic_entries[idx] != NULL; ++idx) {
switch(dynamic_entries[idx]->tag) {
switch(static_cast<DYNAMIC_TAGS>(dynamic_entries[idx]->tag)) {
case DYNAMIC_TAGS::DT_NEEDED:
{
free(reinterpret_cast<Elf_DynamicEntry_Library_t*>(dynamic_entries[idx]));
+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.
+16 -16
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.
@@ -22,59 +22,59 @@
extern "C"
{
const char* E_TYPE_to_string(enum E_TYPE e) {
const char* E_TYPE_to_string(enum LIEF_ELF_E_TYPE e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::E_TYPE>(e));
}
const char* SYMBOL_BINDINGS_to_string(enum SYMBOL_BINDINGS e) {
const char* SYMBOL_BINDINGS_to_string(enum LIEF_ELF_SYMBOL_BINDINGS e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::SYMBOL_BINDINGS>(e));
}
const char* VERSION_to_string(enum VERSION e) {
const char* VERSION_to_string(enum LIEF_ELF_VERSION e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::VERSION>(e));
}
const char* ARCH_to_string(enum ARCH e) {
const char* ARCH_to_string(enum LIEF_ELF_ARCH e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ARCH>(e));
}
const char* SEGMENT_TYPES_to_string(enum SEGMENT_TYPES e) {
const char* SEGMENT_TYPES_to_string(enum LIEF_ELF_SEGMENT_TYPES e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::SEGMENT_TYPES>(e));
}
const char* DYNAMIC_TAGS_to_string(enum DYNAMIC_TAGS e) {
const char* DYNAMIC_TAGS_to_string(enum LIEF_ELF_DYNAMIC_TAGS e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::DYNAMIC_TAGS>(e));
}
const char* ELF_SECTION_TYPES_to_string(enum ELF_SECTION_TYPES e) {
const char* ELF_SECTION_TYPES_to_string(enum LIEF_ELF_ELF_SECTION_TYPES e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SECTION_TYPES>(e));
}
const char* ELF_SECTION_FLAGS_to_string(enum ELF_SECTION_FLAGS e) {
const char* ELF_SECTION_FLAGS_to_string(enum LIEF_ELF_ELF_SECTION_FLAGS e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SECTION_FLAGS>(e));
}
const char* ELF_SYMBOL_TYPES_to_string(enum ELF_SYMBOL_TYPES e) {
const char* ELF_SYMBOL_TYPES_to_string(enum LIEF_ELF_ELF_SYMBOL_TYPES e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SYMBOL_TYPES>(e));
}
const char* ELF_CLASS_to_string(enum ELF_CLASS e) {
const char* ELF_CLASS_to_string(enum LIEF_ELF_ELF_CLASS e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_CLASS>(e));
}
const char* ELF_DATA_to_string(enum ELF_DATA e) {
const char* ELF_DATA_to_string(enum LIEF_ELF_ELF_DATA e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_DATA>(e));
}
const char* OS_ABI_to_string(enum OS_ABI e) {
const char* OS_ABI_to_string(enum LIEF_ELF_OS_ABI e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::OS_ABI>(e));
}
const char* DYNAMIC_FLAGS_to_string(enum DYNAMIC_FLAGS e) {
const char* DYNAMIC_FLAGS_to_string(enum LIEF_ELF_DYNAMIC_FLAGS e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::DYNAMIC_FLAGS>(e));
}
const char* DYNAMIC_FLAGS_1_to_string(enum DYNAMIC_FLAGS_1 e) {
const char* DYNAMIC_FLAGS_1_to_string(enum LIEF_ELF_DYNAMIC_FLAGS_1 e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::DYNAMIC_FLAGS_1>(e));
}
+5 -5
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.
@@ -21,9 +21,9 @@ namespace ELF {
void init_c_header(Elf_Binary_t* c_binary, Binary* binary) {
const Header& hdr = binary->header();
c_binary->header.file_type = static_cast<enum ::E_TYPE>(hdr.file_type());
c_binary->header.machine_type = static_cast<enum ::ARCH>(hdr.machine_type());
c_binary->header.object_file_version = static_cast<enum ::VERSION>(hdr.object_file_version());
c_binary->header.file_type = static_cast<enum LIEF_ELF_E_TYPE>(hdr.file_type());
c_binary->header.machine_type = static_cast<enum LIEF_ELF_ARCH>(hdr.machine_type());
c_binary->header.object_file_version = static_cast<enum LIEF_ELF_VERSION>(hdr.object_file_version());
c_binary->header.program_headers_offset = hdr.program_headers_offset();
c_binary->header.section_headers_offset = hdr.section_headers_offset();
c_binary->header.processor_flags = hdr.processor_flag();
+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.
@@ -36,7 +36,7 @@ void init_c_sections(Elf_Binary_t* c_binary, Binary* binary) {
c_binary->sections[i]->name = b_section.name().c_str();
c_binary->sections[i]->flags = b_section.flags();
c_binary->sections[i]->type = static_cast<enum ::ELF_SECTION_TYPES>(b_section.type());
c_binary->sections[i]->type = static_cast<enum LIEF_ELF_ELF_SECTION_TYPES>(b_section.type());
c_binary->sections[i]->virtual_address = b_section.virtual_address();
c_binary->sections[i]->offset = b_section.file_offset();
c_binary->sections[i]->original_size = b_section.original_size();
+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.
+4 -4
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.
@@ -34,8 +34,8 @@ void init_c_segments(Elf_Binary_t* c_binary, Binary* binary) {
content);
c_binary->segments[i] = static_cast<Elf_Segment_t*>(malloc(sizeof(Elf_Segment_t)));
c_binary->segments[i]->type = static_cast<enum ::SEGMENT_TYPES>(segment.type());
c_binary->segments[i]->flags = segment.flags();
c_binary->segments[i]->type = static_cast<enum LIEF_ELF_SEGMENT_TYPES>(segment.type());
c_binary->segments[i]->flags = static_cast<uint32_t>(segment.flags());
c_binary->segments[i]->virtual_address = segment.virtual_address();
c_binary->segments[i]->virtual_size = segment.virtual_size();
c_binary->segments[i]->offset = segment.file_offset();
+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.
+6 -6
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,8 +28,8 @@ void init_c_dynamic_symbols(Elf_Binary_t* c_binary, Binary* binary) {
Symbol& b_sym = dyn_symb[i];
c_binary->dynamic_symbols[i] = static_cast<Elf_Symbol_t*>(malloc(sizeof(Elf_Symbol_t)));
c_binary->dynamic_symbols[i]->name = b_sym.name().c_str();
c_binary->dynamic_symbols[i]->type = static_cast<enum ::ELF_SYMBOL_TYPES>(b_sym.type());
c_binary->dynamic_symbols[i]->binding = static_cast<enum ::SYMBOL_BINDINGS>(b_sym.binding());
c_binary->dynamic_symbols[i]->type = static_cast<enum LIEF_ELF_ELF_SYMBOL_TYPES>(b_sym.type());
c_binary->dynamic_symbols[i]->binding = static_cast<enum LIEF_ELF_SYMBOL_BINDINGS>(b_sym.binding());
c_binary->dynamic_symbols[i]->other = b_sym.other();
c_binary->dynamic_symbols[i]->shndx = b_sym.shndx();
c_binary->dynamic_symbols[i]->value = b_sym.value();
@@ -55,8 +55,8 @@ void init_c_static_symbols(Elf_Binary_t* c_binary, Binary* binary) {
Symbol& b_sym = static_symb[i];
c_binary->static_symbols[i] = static_cast<Elf_Symbol_t*>(malloc(sizeof(Elf_Symbol_t)));
c_binary->static_symbols[i]->name = b_sym.name().c_str();
c_binary->static_symbols[i]->type = static_cast<enum ::ELF_SYMBOL_TYPES>(b_sym.type());
c_binary->static_symbols[i]->binding = static_cast<enum ::SYMBOL_BINDINGS>(b_sym.binding());
c_binary->static_symbols[i]->type = static_cast<enum LIEF_ELF_ELF_SYMBOL_TYPES>(b_sym.type());
c_binary->static_symbols[i]->binding = static_cast<enum LIEF_ELF_SYMBOL_BINDINGS>(b_sym.binding());
c_binary->static_symbols[i]->other = b_sym.other();
c_binary->static_symbols[i]->shndx = b_sym.shndx();
c_binary->static_symbols[i]->value = b_sym.value();
+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})
+11 -11
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.
@@ -23,47 +23,47 @@
extern "C"
{
const char* LOAD_COMMAND_TYPES_to_string(enum LOAD_COMMAND_TYPES e) {
const char* LOAD_COMMAND_TYPES_to_string(enum LIEF_MACHO_LOAD_COMMAND_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::LOAD_COMMAND_TYPES>(e));
}
const char* MACHO_TYPES_to_string(enum MACHO_TYPES e) {
const char* MACHO_TYPES_to_string(enum LIEF_MACHO_MACHO_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::MACHO_TYPES>(e));
}
const char* FILE_TYPES_to_string(enum FILE_TYPES e) {
const char* FILE_TYPES_to_string(enum LIEF_MACHO_FILE_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::FILE_TYPES>(e));
}
const char* CPU_TYPES_to_string(enum CPU_TYPES e) {
const char* CPU_TYPES_to_string(enum LIEF_MACHO_CPU_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::CPU_TYPES>(e));
}
const char* HEADER_FLAGS_to_string(enum HEADER_FLAGS e) {
const char* HEADER_FLAGS_to_string(enum LIEF_MACHO_HEADER_FLAGS e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::HEADER_FLAGS>(e));
}
const char* MACHO_SECTION_TYPES_to_string(enum MACHO_SECTION_TYPES e) {
const char* MACHO_SECTION_TYPES_to_string(enum LIEF_MACHO_MACHO_SECTION_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::MACHO_SECTION_TYPES>(e));
}
const char* MACHO_SYMBOL_TYPES_to_string(enum MACHO_SYMBOL_TYPES e) {
const char* MACHO_SYMBOL_TYPES_to_string(enum LIEF_MACHO_MACHO_SYMBOL_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::MACHO_SYMBOL_TYPES>(e));
}
const char* N_LIST_TYPES_to_string(enum N_LIST_TYPES e) {
const char* N_LIST_TYPES_to_string(enum LIEF_MACHO_N_LIST_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::N_LIST_TYPES>(e));
}
const char* SYMBOL_DESCRIPTIONS_to_string(enum SYMBOL_DESCRIPTIONS e) {
const char* SYMBOL_DESCRIPTIONS_to_string(enum LIEF_MACHO_SYMBOL_DESCRIPTIONS e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::SYMBOL_DESCRIPTIONS>(e));
}
+5 -5
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.
@@ -19,10 +19,10 @@ namespace LIEF {
namespace MachO {
void init_c_header(Macho_Binary_t* c_binary, Binary* binary) {
Header& header = binary->header();
c_binary->header.magic = header.magic();
c_binary->header.cpu_type = static_cast<enum ::CPU_TYPES>(header.cpu_type());
c_binary->header.magic = static_cast<uint32_t>(header.magic());
c_binary->header.cpu_type = static_cast<enum LIEF_MACHO_CPU_TYPES>(header.cpu_type());
c_binary->header.cpu_subtype = header.cpu_subtype();
c_binary->header.file_type = static_cast<enum ::FILE_TYPES>(header.file_type());
c_binary->header.file_type = static_cast<enum LIEF_MACHO_FILE_TYPES>(header.file_type());
c_binary->header.nb_cmds = header.nb_cmds();
c_binary->header.sizeof_cmds = header.sizeof_cmds();
c_binary->header.flags = header.flags();
+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.
@@ -34,7 +34,7 @@ void init_c_commands(Macho_Binary_t* c_binary, Binary* binary) {
std::end(cmd_content),
content);
c_binary->commands[i]->command = static_cast<enum ::LOAD_COMMAND_TYPES>(cmd.command());
c_binary->commands[i]->command = static_cast<enum LIEF_MACHO_LOAD_COMMAND_TYPES>(cmd.command());
c_binary->commands[i]->size = cmd.size();
c_binary->commands[i]->data = content;
c_binary->commands[i]->offset = cmd.command_offset();
+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.
+4 -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.
@@ -17,13 +17,14 @@
#include "LIEF/MachO/Binary.h"
#include "LIEF/MachO/Parser.hpp"
#include "LIEF/MachO/FatBinary.hpp"
#include "Binary.hpp"
using namespace LIEF::MachO;
Macho_Binary_t** macho_parse(const char *file) {
FatBinary* macho_binaries = Parser::parse(file);
FatBinary* macho_binaries = Parser::parse(file).release();
Macho_Binary_t** c_macho_binaries = static_cast<Macho_Binary_t**>(
malloc((macho_binaries->size() + 1) * sizeof(Macho_Binary_t**)));
+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.
@@ -39,7 +39,7 @@ void init_c_sections(Macho_Binary_t* c_binary, Binary* binary) {
c_binary->sections[i]->relocation_offset = section.relocation_offset();
c_binary->sections[i]->numberof_relocations = section.numberof_relocations();
c_binary->sections[i]->flags = section.flags();
c_binary->sections[i]->type = static_cast<enum ::MACHO_SECTION_TYPES>(section.type());
c_binary->sections[i]->type = static_cast<enum LIEF_MACHO_MACHO_SECTION_TYPES>(section.type());
c_binary->sections[i]->reserved1 = section.reserved1();
c_binary->sections[i]->reserved2 = section.reserved2();
c_binary->sections[i]->reserved3 = section.reserved3();
+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.
+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.
@@ -50,7 +50,7 @@ void init_c_binary(Pe_Binary_t* c_binary, Binary* binary) {
}
Pe_Binary_t* pe_parse(const char *file) {
Binary* binary = Parser::parse(file);
Binary* binary = Parser::parse(file).release();
Pe_Binary_t* c_binary = static_cast<Pe_Binary_t*>(malloc(sizeof(Pe_Binary_t)));
std::memset(c_binary, 0, sizeof(Pe_Binary_t));
init_c_binary(c_binary, 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.
+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.
+5 -5
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.
@@ -23,17 +23,17 @@
extern "C"
{
const char* PE_TYPES_to_string(enum PE_TYPES e) {
const char* PE_TYPES_to_string(enum LIEF_PE_PE_TYPES e) {
return LIEF::PE::to_string(static_cast<LIEF::PE::PE_TYPE>(e));
}
const char* MACHINE_TYPES_to_string(enum MACHINE_TYPES e) {
const char* MACHINE_TYPES_to_string(enum LIEF_PE_MACHINE_TYPES e) {
return LIEF::PE::to_string(static_cast<LIEF::PE::MACHINE_TYPES>(e));
}
const char* SUBSYSTEM_to_string(enum SUBSYSTEM e) {
const char* SUBSYSTEM_to_string(enum LIEF_PE_SUBSYSTEM e) {
return LIEF::PE::to_string(static_cast<LIEF::PE::SUBSYSTEM>(e));
}
+4 -4
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.
@@ -24,13 +24,13 @@ void init_c_header(Pe_Binary_t* c_binary, Binary* binary) {
const Header::signature_t& signature = header.signature();
c_binary->header.machine = static_cast<enum ::MACHINE_TYPES>(header.machine());
c_binary->header.machine = static_cast<enum LIEF_PE_MACHINE_TYPES>(header.machine());
c_binary->header.numberof_sections = header.numberof_sections();
c_binary->header.time_date_stamp = header.time_date_stamp();
c_binary->header.pointerto_symbol_table = header.pointerto_symbol_table();
c_binary->header.numberof_symbols = header.numberof_symbols();
c_binary->header.sizeof_optional_header = header.sizeof_optional_header();
c_binary->header.characteristics = header.characteristics();
c_binary->header.characteristics = static_cast<uint16_t>(header.characteristics());
std::copy(
std::begin(signature),
+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.
+4 -4
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.
@@ -21,7 +21,7 @@ namespace PE {
void init_c_optional_header(Pe_Binary_t* c_binary, Binary* binary) {
const OptionalHeader& optional_header = binary->optional_header();
c_binary->optional_header.magic = static_cast<enum PE_TYPES>(optional_header.magic());
c_binary->optional_header.magic = static_cast<enum LIEF_PE_PE_TYPES>(optional_header.magic());
c_binary->optional_header.major_linker_version = optional_header.major_linker_version();
c_binary->optional_header.minor_linker_version = optional_header.minor_linker_version();
c_binary->optional_header.sizeof_code = optional_header.sizeof_code();
@@ -47,7 +47,7 @@ void init_c_optional_header(Pe_Binary_t* c_binary, Binary* binary) {
c_binary->optional_header.sizeof_image = optional_header.sizeof_image();
c_binary->optional_header.sizeof_headers = optional_header.sizeof_headers();
c_binary->optional_header.checksum = optional_header.checksum();
c_binary->optional_header.subsystem = static_cast<enum ::SUBSYSTEM>(optional_header.subsystem());
c_binary->optional_header.subsystem = static_cast<enum LIEF_PE_SUBSYSTEM>(optional_header.subsystem());
c_binary->optional_header.dll_characteristics = optional_header.dll_characteristics();
c_binary->optional_header.sizeof_stack_reserve = optional_header.sizeof_stack_reserve();
c_binary->optional_header.sizeof_stack_commit = optional_header.sizeof_stack_commit();
+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.
+13 -8
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.
@@ -27,12 +27,16 @@ void init_c_sections(Pe_Binary_t* c_binary, Binary* binary) {
for (size_t i = 0; i < sections.size(); ++i) {
Section& b_section = sections[i];
c_binary->sections[i] = static_cast<Pe_Section_t*>(malloc(sizeof(Pe_Section_t)));
const std::vector<uint8_t>& section_content = b_section.content();
uint8_t* content = static_cast<uint8_t*>(malloc(section_content.size() * sizeof(uint8_t)));
std::copy(
std::begin(section_content),
std::end(section_content),
content);
std::vector<uint8_t> section_content = b_section.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.
+6 -6
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.
@@ -45,7 +45,7 @@ struct Elf_Binary_t {
void* handler;
const char* name;
const char* interpreter;
enum ELF_CLASS type;
enum LIEF_ELF_ELF_CLASS type;
Elf_Header_t header;
Elf_Section_t **sections;
Elf_Segment_t **segments;
@@ -57,16 +57,16 @@ struct Elf_Binary_t {
typedef struct Elf_Binary_t Elf_Binary_t;
/** @brief Wrapper for LIEF::ELF::Parser::parse */
DLL_PUBLIC Elf_Binary_t* elf_parse(const char *file);
LIEF_API Elf_Binary_t* elf_parse(const char *file);
DLL_PUBLIC void elf_binary_destroy(Elf_Binary_t* binary);
LIEF_API void elf_binary_destroy(Elf_Binary_t* binary);
/* ELF::Binary methods
* ==================
*/
/** @brief Update LIEF::ELF::Header object */
DLL_PUBLIC int elf_binary_save_header(Elf_Binary_t* binary);
LIEF_API int elf_binary_save_header(Elf_Binary_t* binary);
+11 -11
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.
@@ -34,46 +34,46 @@ extern "C" {
#endif
struct Elf_DynamicEntry_t {
enum DYNAMIC_TAGS tag;
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
};
struct Elf_DynamicEntry_Library_t {
enum DYNAMIC_TAGS tag;
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
const char* name;
};
struct Elf_DynamicEntry_SharedObject_t {
enum DYNAMIC_TAGS tag;
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
const char* name;
};
struct Elf_DynamicEntry_Array_t {
enum DYNAMIC_TAGS tag;
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
uint64_t* array;
};
struct Elf_DynamicEntry_Rpath_t {
enum DYNAMIC_TAGS tag;
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
const char* rpath;
};
struct Elf_DynamicEntry_RunPath_t {
enum DYNAMIC_TAGS tag;
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
const char* runpath;
};
struct Elf_DynamicEntry_Flags_t {
enum DYNAMIC_TAGS tag;
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
enum DYNAMIC_FLAGS *flags;
enum DYNAMIC_FLAGS_1 *flags_1;
enum LIEF_ELF_DYNAMIC_FLAGS *flags;
enum LIEF_ELF_DYNAMIC_FLAGS_1 *flags_1;
};
typedef struct Elf_DynamicEntry_t Elf_DynamicEntry_t;
+16 -16
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.
@@ -24,20 +24,20 @@
extern "C" {
#endif
DLL_PUBLIC const char* SYMBOL_BINDINGS_to_string(enum SYMBOL_BINDINGS e);
DLL_PUBLIC const char* E_TYPE_to_string(enum E_TYPE e);
DLL_PUBLIC const char* VERSION_to_string(enum VERSION e);
DLL_PUBLIC const char* ARCH_to_string(enum ARCH e);
DLL_PUBLIC const char* SEGMENT_TYPES_to_string(enum SEGMENT_TYPES e);
DLL_PUBLIC const char* DYNAMIC_TAGS_to_string(enum DYNAMIC_TAGS e);
DLL_PUBLIC const char* ELF_SECTION_TYPES_to_string(enum ELF_SECTION_TYPES e);
DLL_PUBLIC const char* ELF_SECTION_FLAGS_to_string(enum ELF_SECTION_FLAGS e);
DLL_PUBLIC const char* ELF_SYMBOL_TYPES_to_string(enum ELF_SYMBOL_TYPES e);
DLL_PUBLIC const char* ELF_CLASS_to_string(enum ELF_CLASS e);
DLL_PUBLIC const char* ELF_DATA_to_string(enum ELF_DATA e);
DLL_PUBLIC const char* OS_ABI_to_string(enum OS_ABI e);
DLL_PUBLIC const char* DYNAMIC_FLAGS_to_string(enum DYNAMIC_FLAGS e);
DLL_PUBLIC const char* DYNAMIC_FLAGS_1_to_string(enum DYNAMIC_FLAGS_1 e);
LIEF_API const char* SYMBOL_BINDINGS_to_string(enum LIEF_ELF_SYMBOL_BINDINGS e);
LIEF_API const char* E_TYPE_to_string(enum LIEF_ELF_E_TYPE e);
LIEF_API const char* VERSION_to_string(enum LIEF_ELF_VERSION e);
LIEF_API const char* ARCH_to_string(enum LIEF_ELF_ARCH e);
LIEF_API const char* SEGMENT_TYPES_to_string(enum LIEF_ELF_SEGMENT_TYPES e);
LIEF_API const char* DYNAMIC_TAGS_to_string(enum LIEF_ELF_DYNAMIC_TAGS e);
LIEF_API const char* ELF_SECTION_TYPES_to_string(enum LIEF_ELF_ELF_SECTION_TYPES e);
LIEF_API const char* ELF_SECTION_FLAGS_to_string(enum LIEF_ELF_ELF_SECTION_FLAGS e);
LIEF_API const char* ELF_SYMBOL_TYPES_to_string(enum LIEF_ELF_ELF_SYMBOL_TYPES e);
LIEF_API const char* ELF_CLASS_to_string(enum LIEF_ELF_ELF_CLASS e);
LIEF_API const char* ELF_DATA_to_string(enum LIEF_ELF_ELF_DATA e);
LIEF_API const char* OS_ABI_to_string(enum LIEF_ELF_OS_ABI e);
LIEF_API const char* DYNAMIC_FLAGS_to_string(enum LIEF_ELF_DYNAMIC_FLAGS e);
LIEF_API const char* DYNAMIC_FLAGS_1_to_string(enum LIEF_ELF_DYNAMIC_FLAGS_1 e);
#ifdef __cplusplus
}
+6 -6
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.
@@ -31,10 +31,10 @@ extern "C" {
#endif
struct Elf_Header_t {
uint8_t identity[EI_NIDENT];
enum E_TYPE file_type;
enum ARCH machine_type;
enum VERSION object_file_version;
uint8_t identity[LIEF_ELF_EI_NIDENT];
enum LIEF_ELF_E_TYPE file_type;
enum LIEF_ELF_ARCH machine_type;
enum LIEF_ELF_VERSION object_file_version;
uint64_t entrypoint;
uint64_t program_headers_offset;
uint64_t section_headers_offset;
+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.
@@ -35,7 +35,7 @@ extern "C" {
struct Elf_Section_t {
const char* name;
uint32_t flags;
enum ELF_SECTION_TYPES type;
enum LIEF_ELF_ELF_SECTION_TYPES type;
uint64_t virtual_address;
uint64_t offset;
uint64_t original_size;
+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.
@@ -32,7 +32,7 @@ extern "C" {
#endif
struct Elf_Segment_t {
enum SEGMENT_TYPES type;
enum LIEF_ELF_SEGMENT_TYPES type;
uint32_t flags;
uint64_t virtual_address;
uint64_t virtual_size;
+5 -5
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
@@ -34,8 +34,8 @@ extern "C" {
struct Elf_Symbol_t {
const char* name;
enum ELF_SYMBOL_TYPES type;
enum SYMBOL_BINDINGS binding;
enum LIEF_ELF_ELF_SYMBOL_TYPES type;
enum LIEF_ELF_SYMBOL_BINDINGS binding;
uint8_t information;
uint8_t other;
uint16_t shndx;
+10
View File
@@ -1,11 +1,21 @@
#ifndef LIEF_ELF_C_ENUMS_H_
#define LIEF_ELF_C_ENUMS_H_
#include "LIEF/ELF/undef.h"
#ifdef __cplusplus
extern "C" {
#endif
#define _LIEF_EN(N) LIEF_ELF_##N // enum LIEF_N {
#define _LIEF_EN_2(N, TYPE) LIEF_ELF_##N // enum LIEF_N {
#define _LIEF_EI(X) LIEF_ELF_##X // LIEF_X
@LIEF_ELF_ENUMS@
#undef _LIEF_EN
#undef _LIEF_EN_2
#undef _LIEF_EI
#ifdef __cplusplus
}
#endif
+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.
@@ -35,7 +35,7 @@ extern "C" {
#endif
/** @brief Check if the given file is an ELF one. */
DLL_PUBLIC bool is_elf(const char* file);
LIEF_API bool is_elf(const char* file);
#ifdef __cplusplus
}
+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.
@@ -19,5 +19,6 @@
#include <LIEF/MachO.h>
#include <LIEF/PE.h>
#include <LIEF/ELF.h>
#include <LIEF/logging.h>
#endif
+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.
+4 -4
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,9 +55,9 @@ struct Macho_Binary_t {
typedef struct Macho_Binary_t Macho_Binary_t;
/** @brief Wrapper on LIEF::MachO::Parser::parse */
DLL_PUBLIC Macho_Binary_t** macho_parse(const char *file);
LIEF_API Macho_Binary_t** macho_parse(const char *file);
DLL_PUBLIC void macho_binaries_destroy(Macho_Binary_t** binaries);
LIEF_API void macho_binaries_destroy(Macho_Binary_t** binaries);
#ifdef __cplusplus
}
+11 -11
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.
@@ -23,15 +23,15 @@
extern "C" {
#endif
DLL_PUBLIC const char* LOAD_COMMAND_TYPES_to_string(enum LOAD_COMMAND_TYPES e);
DLL_PUBLIC const char* MACHO_TYPES_to_string(enum MACHO_TYPES e);
DLL_PUBLIC const char* FILE_TYPES_to_string(enum FILE_TYPES e);
DLL_PUBLIC const char* CPU_TYPES_to_string(enum CPU_TYPES e);
DLL_PUBLIC const char* HEADER_FLAGS_to_string(enum HEADER_FLAGS e);
DLL_PUBLIC const char* MACHO_SECTION_TYPES_to_string(enum MACHO_SECTION_TYPES e);
DLL_PUBLIC const char* MACHO_SYMBOL_TYPES_to_string(enum MACHO_SYMBOL_TYPES e);
DLL_PUBLIC const char* N_LIST_TYPES_to_string(enum N_LIST_TYPES e);
DLL_PUBLIC const char* SYMBOL_DESCRIPTIONS_to_string(enum SYMBOL_DESCRIPTIONS e);
LIEF_API const char* LOAD_COMMAND_TYPES_to_string(enum LIEF_MACHO_LOAD_COMMAND_TYPES e);
LIEF_API const char* MACHO_TYPES_to_string(enum LIEF_MACHO_MACHO_TYPES e);
LIEF_API const char* FILE_TYPES_to_string(enum LIEF_MACHO_FILE_TYPES e);
LIEF_API const char* CPU_TYPES_to_string(enum LIEF_MACHO_CPU_TYPES e);
LIEF_API const char* HEADER_FLAGS_to_string(enum LIEF_MACHO_HEADER_FLAGS e);
LIEF_API const char* MACHO_SECTION_TYPES_to_string(enum LIEF_MACHO_MACHO_SECTION_TYPES e);
LIEF_API const char* MACHO_SYMBOL_TYPES_to_string(enum LIEF_MACHO_MACHO_SYMBOL_TYPES e);
LIEF_API const char* N_LIST_TYPES_to_string(enum LIEF_MACHO_N_LIST_TYPES e);
LIEF_API const char* SYMBOL_DESCRIPTIONS_to_string(enum LIEF_MACHO_SYMBOL_DESCRIPTIONS e);
#ifdef __cplusplus
}
+4 -4
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.
@@ -32,9 +32,9 @@ extern "C" {
struct Macho_Header_t {
uint32_t magic;
enum CPU_TYPES cpu_type;
enum LIEF_MACHO_CPU_TYPES cpu_type;
uint32_t cpu_subtype;
enum FILE_TYPES file_type;
enum LIEF_MACHO_FILE_TYPES file_type;
uint32_t nb_cmds;
uint32_t sizeof_cmds;
uint32_t flags;
+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.
@@ -31,7 +31,7 @@ extern "C" {
#endif
struct Macho_Command_t {
enum LOAD_COMMAND_TYPES command;
enum LIEF_MACHO_LOAD_COMMAND_TYPES command;
uint32_t size;
uint8_t* data;
uint32_t offset;
+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.
@@ -37,7 +37,7 @@ struct Macho_Section_t {
uint32_t relocation_offset;
uint32_t numberof_relocations;
uint32_t flags;
enum MACHO_SECTION_TYPES type;
enum LIEF_MACHO_MACHO_SECTION_TYPES type;
uint32_t reserved1;
uint32_t reserved2;
uint32_t reserved3;
+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.
+22
View File
@@ -1,11 +1,33 @@
#ifndef LIEF_MACHO_C_ENUMS_H_
#define LIEF_MACHO_C_ENUMS_H_
#include "LIEF/MachO/undef.h"
#ifdef __cplusplus
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
@LIEF_MACHO_ENUMS@
#undef _LIEF_EN
#undef _LIEF_EN_2
#undef _LIEF_EI
#ifdef __cplusplus
}
#endif
+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.
+5 -5
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,10 +55,10 @@ struct Pe_Binary_t {
typedef struct Pe_Binary_t Pe_Binary_t;
/** @brief Wrapper on LIEF::PE::Parser::parse */
DLL_PUBLIC Pe_Binary_t* pe_parse(const char *file);
/** Wrapper on LIEF::PE::Parser::parse */
LIEF_API Pe_Binary_t* pe_parse(const char *file);
DLL_PUBLIC void pe_binary_destroy(Pe_Binary_t* binary);
LIEF_API void pe_binary_destroy(Pe_Binary_t* binary);
#ifdef __cplusplus
}
+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