Compare commits

...
Author SHA1 Message Date
Romain Thomas 2d9855fc7f Bump version 2023-06-17 13:39:34 +02:00
Romain Thomas 45d772ad45 Fix typo 2023-06-17 13:39:34 +02:00
Farid Zakaria 790e628b56 Add additional missing undef for ELF
Add missing undef for ELF that cause failures if
lib/elf.h is included before LIEF.
2023-06-17 13:30:03 +02:00
Romain Thomas 88bbd410e6 Fix #932 2023-06-17 13:30:03 +02:00
Romain Thomas 1347dec367 Disable static link with libstdc++ 2023-05-28 12:28:12 +02:00
Romain Thomas b85e785f62 Add OSX arm64 workflow 2023-05-28 11:35:36 +02:00
Romain Thomas b9a5f970b2 Fix #916 2023-05-28 08:38:49 +02:00
Romain Thomas ac98429d75 Set version 2023-05-27 20:58:53 +02:00
Romain Thomas 19af291ab6 Fix C99 comment style (#916) 2023-05-27 20:50:41 +02:00
Romain Thomas ebbc55fd69 Resolve #904 2023-05-21 16:11:58 +02:00
Romain Thomas 1ea659535e Fix #912 2023-05-20 10:32:14 +02:00
Romain Thomas 6ed889e8cf Fix missing include 2023-05-20 10:31:56 +02:00
Romain Thomas b3d6a0737f Resolve #909 2023-05-20 10:31:29 +02:00
Romain Thomas 966a66c78a Set date 2023-04-09 16:06:06 +02:00
Romain Thomas f8f38b6075 Update stubs 2023-04-09 12:40:24 +02:00
Romain Thomas e05ba11196 Add support for new LoadConfiguration 2023-04-09 12:20:18 +02:00
Romain Thomas 7f8898c853 Resolve #893 2023-04-08 19:26:36 +02:00
Romain Thomas b54bece30d Resolve #291 2023-04-08 14:46:31 +02:00
Romain Thomas 705cc95d7f Fix CI 2023-04-08 12:14:50 +02:00
Romain Thomas 1f7d55cffb Fix typo 2023-04-08 12:14:49 +02:00
Romain Thomas bc772aa9a3 Merge pull request #890 from navytux/y/hook-ifunc
doc/04_elf_hooking: Fix segmentation fault on systems where libm.so is built with GNU_IFUNC symbols
2023-04-08 07:51:17 +00:00
Romain Thomas 383dc0f7ae Merge pull request #891 from topazus/fix-dep-in-gcc133
Fix missing <cstdint> header for gcc 13
2023-04-08 07:46:45 +00:00
Romain Thomas 961cc44049 Merge branch 'master' into fix-dep-in-gcc133 2023-04-08 07:46:30 +00:00
Romain Thomas 4e318dabf0 Update leaf & Frozen 2023-04-08 09:40:03 +02:00
Romain Thomas 7583aeb55f Remove unused files 2023-04-08 09:15:44 +02:00
Romain Thomas be62792593 Update header guards 2023-04-08 09:11:20 +02:00
Romain Thomas 644e9b70bd Fix header guard 2023-04-08 07:46:56 +02:00
Romain Thomas cb0b6f65ac Fix header guard 2023-04-08 07:32:08 +02:00
Romain Thomas 71237bdb1c Remove the Profiler class 2023-04-08 07:30:07 +02:00
Romain Thomas a75aec0b99 Fix includes (related to #889) 2023-04-08 07:21:23 +02:00
Romain Thomas 7c66ae09b7 Remove setup.py 2023-04-08 07:00:23 +02:00
topazus a32f9a0127 Fix missing <cstdint> header for gcc 13 2023-04-07 10:34:39 +08:00
Kirill Smelkov a92c3148f6 doc/04_elf_hooking: Fix segmentation fault on systems where libm.so is built with GNU_IFUNC symbols
Hello up there. First of all thanks for LIEF - it looks to be very
handy. I've discovered it recently and started to go through the
tutorial, but quickly hit Segmentation Fault instead of successful
result in 04_elf_hooking, and in https://github.com/lief-project/tutorials/tree/master/04_ELF_hooking

    (1.venv) kirr@deca:~/src/tools/exe/LIEF-tutorials/04_ELF_hooking$ make run
    unset LD_LIBRARY_PATH
    ./do_math.bin 2
    cos(2) = -0.416147
    python insert_hook.py
    Hook inserted at VA: 0x344000
    Change cos!33640 -> cos!3440d0
    LD_LIBRARY_PATH=. ./do_math.bin 2
    make: *** [Makefile:17: run] Segmentation fault (core dumped)

Inspecting with gdb showed that this segmentation fault happens
because cos@got.plt entry is being set with 0x0000000a address even
though everything looks more or less ok in readelf output of updated
libm.so . Further running the example in gdb with setting hardware
watchpoint on cos@got.plt lead to seeing it is being set, expectedly, by
_dl_fixup in ld.so . To investigate I've built glibc with ld.so from
sources, added debugging prints and saw the following:

	...
        219551:     XXX DL_FIXUP 70
        219551:     symbol=cos;  lookup in file=./do_math.bin [0]
        219551:     symbol=cos;  lookup in file=./libm.so.6 [0]
        219551:       -> found it:
        219551:       sym @7f1020de6e88:
        219551:       .st_shndx: 15
        219551:       .st_value: 3440d0
        219551:       .st_size:  4b
        219551:       (weak)
        219551:       (global)
        219551:       map @7f10211260c0:
        219551:       .l_name ./libm.so.6:
        219551:       .l_addr 7f1020de1000:
        219551:       .l_ld:
        219551:         .d_tag 1:
        219551:         .d_val 1:
        219551:         .d_ptr 1:
        219551:     binding file ./do_math.bin [0] to ./libm.so.6 [0]: normal symbol `cos' [GLIBC_2.2.5]
        219551:     .ref @7f1020de6e88:
        219551:     .map @7f10211260c0:
        219551:     (after lookup)
        219551:     value:  7f10211250d0  (= addr)    <-- NOTE
        219551:     value': 7f10211250d0              <-- NOTE
        219551:     ivalue: a                         <-- NOTE
        219551:     (before fixup_plt)
        219551:     (after fixup_plt)
    Segmentation fault (core dumped)

Here we see that address of updated `cos` symbol is first correctly computed,
but after seeing that cos.st_type is GNU_IFUNC, ld.so invokes its code and uses
return value as the address to actually put into got.plt:

    https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/dl-runtime.c;h=d35a725415554337746f562c3f9b16ae8295613c#l123

Since the code we built in hook uses regular FUNC - not GNU_IFUNC - binding
protocol for dynamic linking, this leads to crashes, as `hook.cos` code is used
as ifunc resolver which it did not intended to be.

The fix is simple: explicitly update hooked symbol type to be normal FUNC. Then
ld.so will use regular binding procedure for injected code irregardless of
whether libm.cos was FUNC or GNU_IFUNC.

Fixes:   https://github.com/lief-project/LIEF/issues/380
Updates: https://github.com/lief-project/tutorials/issues/4

Appendix I. ld.so debug print patch
-----------------------------------

```diff
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 05f36a2507..0cb3695bdc 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -456,22 +456,34 @@ do_lookup_x (const char *undef_name, unsigned int new_hash,
       if (sym != NULL)
 	{
 	found_it:
+	  _dl_debug_printf("  -> found it:\n");
+	  _dl_debug_printf("  sym @%lx:\n", (unsigned long)sym);
+	  _dl_debug_printf("  .st_shndx: %d\n", sym->st_shndx);
+	  _dl_debug_printf("  .st_value: %lx\n", sym->st_value);
+	  _dl_debug_printf("  .st_size:  %lx\n", sym->st_size);
+
 	  /* Hidden and internal symbols are local, ignore them.  */
-	  if (__glibc_unlikely (dl_symbol_visibility_binds_local_p (sym)))
+	  if (__glibc_unlikely (dl_symbol_visibility_binds_local_p (sym))) {
+	    _dl_debug_printf("  (local -> skip)\n");
 	    goto skip;
+	  }

-	  if (ELFW(ST_VISIBILITY) (sym->st_other) == STV_PROTECTED)
+	  if (ELFW(ST_VISIBILITY) (sym->st_other) == STV_PROTECTED) {
+	    _dl_debug_printf("  (protected)\n");
 	    _dl_check_protected_symbol (undef_name, undef_map, ref, map,
 					type_class);
+          }

 	  switch (ELFW(ST_BIND) (sym->st_info))
 	    {
 	    case STB_WEAK:
+	      _dl_debug_printf("  (weak)\n");
 	      /* Weak definition.  Use this value if we don't find another.  */
 	      if (__glibc_unlikely (GLRO(dl_dynamic_weak)))
 		{
 		  if (! result->s)
 		    {
+	              _dl_debug_printf("  (weak -> already)\n");
 		      result->s = sym;
 		      result->m = (struct link_map *) map;
 		    }
@@ -479,18 +491,30 @@ do_lookup_x (const char *undef_name, unsigned int new_hash,
 		}
 	      /* FALLTHROUGH */
 	    case STB_GLOBAL:
+	      _dl_debug_printf("  (global)\n");
 	      /* Global definition.  Just what we need.  */
 	      result->s = sym;
 	      result->m = (struct link_map *) map;
+
+	      _dl_debug_printf("  map @%lx:\n", (unsigned long)map);
+	      _dl_debug_printf("  .l_name %s:\n", map->l_name);
+	      _dl_debug_printf("  .l_addr %lx:\n", map->l_addr);
+	      _dl_debug_printf("  .l_ld:\n");
+	      _dl_debug_printf("    .d_tag %lx:\n", map->l_ld->d_tag);
+	      _dl_debug_printf("    .d_val %lx:\n", map->l_ld->d_un.d_val);
+	      _dl_debug_printf("    .d_ptr %lx:\n", map->l_ld->d_un.d_ptr);
+
 	      return 1;

 	    case STB_GNU_UNIQUE:;
+	      _dl_debug_printf("  (unique)\n");
 	      do_lookup_unique (undef_name, new_hash, (struct link_map *) map,
 				result, type_class, sym, strtab, ref,
 				undef_map, flags);
 	      return 1;

 	    default:
+	      _dl_debug_printf("  (default)\n");
 	      /* Local symbols are ignored.  */
 	      break;
 	    }
@@ -871,6 +895,9 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
    }

+  _dl_debug_printf(".ref @%lx:\n", (unsigned long)current_value.s);
+  _dl_debug_printf(".map @%lx:\n", (unsigned long)current_value.m);
+
   *ref = current_value.s;
   return LOOKUP_VALUE (current_value.m);
 }
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index d35a725415..3f2771c5de 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -59,6 +59,8 @@ _dl_fixup (
   lookup_t result;
   DL_FIXUP_VALUE_TYPE value;

+  _dl_debug_printf("XXX DL_FIXUP %d\n", sym->st_name);
+
   /* Sanity check that we're really looking at a PLT relocation.  */
   assert (ELFW(R_TYPE)(reloc->r_info) == ELF_MACHINE_JMP_SLOT);

@@ -95,6 +97,8 @@ _dl_fixup (
       result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym, l->l_scope,
 				    version, ELF_RTYPE_CLASS_PLT, flags, NULL);

+      _dl_debug_printf("(after lookup)\n");
+
       /* We are done with the global scope.  */
       if (!RTLD_SINGLE_THREAD_P)
 	THREAD_GSCOPE_RESET_FLAG ();
@@ -108,9 +112,11 @@ _dl_fixup (
 	 offset.  */
       value = DL_FIXUP_MAKE_VALUE (result,
 				   SYMBOL_ADDRESS (result, sym, false));
+      _dl_debug_printf("value:  %lx  (= addr)\n", value);
     }
   else
     {
+      _dl_debug_printf("(make value branch 2)\n");
       /* We already found the symbol.  The module (and therefore its load
 	 address) is also known.  */
       value = DL_FIXUP_MAKE_VALUE (l, SYMBOL_ADDRESS (l, sym, true));
@@ -119,10 +125,14 @@ _dl_fixup (

   /* And now perhaps the relocation addend.  */
   value = elf_machine_plt_value (l, reloc, value);
+  _dl_debug_printf("value': %lx\n", value);

+  // XXX here
   if (sym != NULL
-      && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0))
+      && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)) {
     value = elf_ifunc_invoke (DL_FIXUP_VALUE_ADDR (value));
+    _dl_debug_printf("ivalue: %lx\n", value);
+  }

 #ifdef SHARED
   /* Auditing checkpoint: we have a new binding.  Provide the auditing
@@ -159,7 +169,12 @@ _dl_fixup (
   if (__glibc_unlikely (GLRO(dl_bind_not)))
     return value;

-  return elf_machine_fixup_plt (l, result, refsym, sym, reloc, rel_addr, value);
+  _dl_debug_printf("(before fixup_plt)\n");
+  //return elf_machine_fixup_plt (l, result, refsym, sym, reloc, rel_addr, value);
+  DL_FIXUP_VALUE_TYPE xxx;
+  xxx = elf_machine_fixup_plt (l, result, refsym, sym, reloc, rel_addr, value);
+  _dl_debug_printf("(after fixup_plt)\n");
+  return xxx;
 }

 #ifndef PROF
@@ -175,6 +190,8 @@ _dl_profile_fixup (
 {
   void (*mcount_fct) (ElfW(Addr), ElfW(Addr)) = _dl_mcount;

+  _dl_debug_printf("XXX DL_PROFILE_FIXUP ...\n");
+
   if (l->l_reloc_result == NULL)
     {
       /* BZ #14843: ELF_DYNAMIC_RELOCATE is called before l_reloc_result
```
2023-04-06 16:38:04 +03:00
Romain Thomas 8c5d2e378e Update doc 2023-04-02 14:52:11 +02:00
Romain Thomas 3f3a39168c Update doc 2023-04-02 14:25:18 +02:00
Romain Thomas d2fe82a6b4 Resolve #880 2023-04-02 07:23:52 +02:00
Romain Thomas 62aed5f014 Fix include 2023-04-01 18:36:34 +02:00
Romain Thomas ff08b85528 Fix includes 2023-04-01 18:22:55 +02:00
Romain Thomas 5341906d83 Merge pull request #883 from nikitalita/fix-elf-strings
ELF: fix assertion failure in `Binary::strings()`
2023-04-01 16:17:29 +00:00
Romain Thomas 3564d6f7a9 Fix missing includes 2023-04-01 14:51:57 +02:00
Romain Thomas 58a756460a Clean headers 2023-04-01 09:18:43 +02:00
Romain Thomas cf06502b17 Resolve #884 2023-04-01 09:17:59 +02:00
nikitalita e9caa7dc23 ELF: fix assertion failure in Binary::strings()
`std::isprint()` will assert if the integer checked is < 0.
Have it check the uint8_t value instead.
2023-03-28 19:14:57 -07:00
Romain Thomas df9a91a267 Limit the number of reserved entries 2023-03-26 11:23:27 +02:00
Romain Thomas 23305900c5 Fix link 2023-03-26 11:20:13 +02:00
Romain Thomas 7a87f7405f Include abstract tests 2023-03-26 10:29:47 +02:00
Romain Thomas 2daaf38cb3 Fix missing include 2023-03-26 10:27:03 +02:00
Romain Thomas 3497515a94 Enhance code profiling 2023-03-26 08:16:25 +02:00
Romain Thomas 683fc6cea7 Enhance mypy stubs (related to #650) 2023-03-25 10:45:37 +01:00
Romain Thomas bc588849f8 Fix style 2023-03-25 08:57:38 +01:00
Romain Thomas 8a6b579029 Merge pull request #878 from nsurbay/fix-brokenLink
Fix broken link in documentation
2023-03-25 07:27:59 +00:00
Romain Thomas 574b4d9b3c Merge pull request #879 from nsurbay/liefInstallOpt
Add LIEF_INSTALL option
2023-03-25 07:27:13 +00:00
Romain Thomas 656c6b4fdd Fix warning 2023-03-25 07:19:39 +01:00
Nicolas Surbayrole 0c1a3360fa Add LIEF_INSTALL option to disable cmake install and export 2023-03-23 13:31:35 +01:00
Nicolas Surbayrole 3119d39deb Fix broken link in documentation
see https://github.com/microsoft/vcpkg/commit/547c030e68163025534ca3cfa372a95a88fefe24
2023-03-22 18:47:32 +01:00
Romain Thomas 2de5816f04 Update stubs 2023-03-19 20:21:51 +01:00
Romain Thomas 363f1a1b07 Add API to setup a log file sink (fix #875) 2023-03-18 11:16:34 +01:00
Romain Thomas a3ec9dc89e FILE_END is a Windows macro [...] so let's change it. 2023-03-18 10:41:21 +01:00
Romain Thomas 9320303fb3 Enhance the methods to relocate the segments table
This commit resolves #872
2023-03-18 07:30:23 +01:00
Romain Thomas 8aa5b1bdec Update doc 2023-03-18 06:30:23 +01:00
Romain Thomas 0875ee2467 Narrowing issue 2023-03-11 18:01:33 +01:00
Romain Thomas 6357c6370b Use the span interface 2023-03-11 16:37:09 +01:00
Romain Thomas e9d1116c79 Fix expired certificate 2023-03-11 16:31:15 +01:00
Romain Thomas 47b131303f Fix fuzzer 2023-03-11 16:27:58 +01:00
Romain Thomas 8396a9a6c1 Sanitize inputs 2023-03-05 09:54:54 +01:00
Romain Thomas 0d631bf0a0 Clean code for the Melkor fuzzer 2023-03-05 09:54:53 +01:00
Romain Thomas d3aa0f4f93 Remove exceptions 2023-03-05 09:54:48 +01:00
Romain Thomas 86411a3611 Fix typo 2023-03-04 10:54:09 +01:00
Romain Thomas c8ece33fc9 Move files to cmake/ 2023-03-04 10:41:47 +01:00
Romain Thomas f68f6dec50 Remove legcy ci config 2023-03-04 09:48:20 +01:00
Romain Thomas 98b5f5fc5a Update changelog 2023-03-04 08:39:00 +01:00
Romain Thomas f2a2bf4ca6 Localize static constructors to limit the overhad while loading the library 2023-03-04 08:35:20 +01:00
Romain Thomas 56151b85aa Update README 2023-02-25 07:26:46 +01:00
Romain Thomas e9045bc6e9 Move from iostream to ostream 2023-02-25 07:23:41 +01:00
Romain Thomas 2aad8e8de3 Update changelog 2023-02-19 20:32:41 +01:00
Romain Thomas 9da2466609 Improve the LIEF Python build system by using pyproject.toml
- It also provides typing info (close #650)
- Enhance the test suite
- Remove deprecated PE functions
2023-02-19 20:19:03 +01:00
Romain Thomas 047facb618 Add sanity checks 2023-02-18 07:17:26 +01:00
Romain Thomas 988d862a9e Update changelog 2023-02-11 09:23:31 +01:00
Romain Thomas 69e9fd39a5 Remove PE hooking 2023-02-11 09:21:21 +01:00
Romain Thomas b7b50c245d Remove duplicated entry 2023-02-11 09:15:42 +01:00
Romain Thomas f495235196 Add test case for #863 2023-02-04 18:24:50 +01:00
Romain Thomas 797ff2687c Fix #863 2023-02-04 18:17:37 +01:00
Romain Thomas 6986f4998c Fix linker flags 2023-02-04 16:06:09 +01:00
Romain Thomas 6f84e2f6c4 Fix linker flags 2023-02-04 15:35:29 +01:00
Romain Thomas 47f8e708c6 Reword/fix the tutorial 2023-02-04 10:17:58 +01:00
Romain Thomas aab02fc335 Link against liblog when building a dynamic version of libLIEF 2023-02-04 08:45:42 +01:00
Romain Thomas c91b7c2de1 Update code to ease Python stub files (related #650) 2023-02-04 08:45:40 +01:00
Romain Thomas 7101b7f1be Update README 2023-01-29 17:12:44 +01:00
Romain Thomas cfb2ecbc41 Update tests 2023-01-29 17:11:23 +01:00
Romain Thomas f6f5d2bb19 Update tests 2023-01-29 17:09:23 +01:00
Romain Thomas 6594b7d1ab Allows Binary::write to take a Builder::config_t parameter 2023-01-29 17:09:11 +01:00
Romain Thomas af371d50ba Disable automatic .note building 2023-01-29 16:52:30 +01:00
Romain Thomas 601232f730 Fix Windows build path
Thanks to Laurent Laubin
2023-01-21 16:40:26 +01:00
Romain Thomas ab8d2dc2a7 Merge pull request #856 from ekilmer/cmake-config-fix-uninit-variable
CMake config: check whether variable is DEFINED
2023-01-21 15:17:23 +00:00
Eric Kilmer 205c1c5891 CMake config: check whether variable is DEFINED
When running CMake with `-Werror=dev` on an external project that uses/finds
LIEF, there is an error if the user did not define the `LIEF_INCLUDE_DIR`
variable. This variable is not defined by default.

This commit adds a check for whether the variable is defined.
2023-01-17 11:46:43 -05:00
Romain Thomas 50eaed3ae5 Update tag (#855) 2023-01-17 05:47:28 +01:00
Romain Thomas b8a9a5ae6e Resolve #853 2023-01-11 09:47:29 +01:00
Romain Thomas 7735c35f16 Merge pull request #854 from fanquake/has_elf_typo
ELF: fix typo in has() description
2023-01-11 07:28:37 +00:00
fanquake 6389d5d718 ELF: fix typo in has() description 2023-01-09 17:32:17 +00:00
Romain Thomas 0e72048685 Fix memory parsing issue 2023-01-09 11:02:51 +01:00
Romain Thomas d8f42d74bf Init values 2023-01-03 10:45:54 +01:00
Romain Thomas 969411f8ef Welcome 2023 2023-01-03 10:38:09 +01:00
Romain Thomas 9633e297d8 Cleanup setup.py 2023-01-03 10:38:08 +01:00
Romain Thomas 1149e81c2b Merge pull request #849 from mrexodia/msvc-runtime
Fix MSVC runtime selection
2023-01-03 09:20:42 +00:00
Romain Thomas 641f10688e Update cache action 2023-01-03 10:19:40 +01:00
Romain Thomas 19d395197d Address #704 2023-01-03 10:15:48 +01:00
Romain Thomas 4ffc81c99f Upgrade Docker image 2023-01-03 10:15:00 +01:00
Duncan Ogilvie bbdc62f691 Fix MSVC runtime selection 2023-01-02 17:30:42 +01:00
Romain Thomas 60f90b60ba Bump version 2023-01-02 17:12:01 +01:00
Romain Thomas ce935d7455 Update changelog 2023-01-02 17:09:06 +01:00
Romain Thomas de63b5721f Update spdlog version 2023-01-02 17:08:17 +01:00
Romain Thomas 9311f0d61c Fix badges 2022-12-17 13:47:41 +01:00
Romain Thomas bdea945ca7 Bump version of setup-python 2022-12-17 13:37:45 +01:00
Romain Thomas 62c9d75020 Update changelog 2022-12-17 13:32:10 +01:00
Romain Thomas f9a56161ed Add test for #845 2022-12-17 13:31:12 +01:00
Romain Thomas 54178656e8 Fix overflow issue 2022-12-17 13:22:43 +01:00
Romain Thomas a12a522410 Backport check from #846 2022-12-17 13:22:17 +01:00
Romain Thomas f8fa944cd8 Update style 2022-12-17 13:21:43 +01:00
Romain Thomas d0b70f096d Add unnecessary copy 2022-12-17 11:22:15 +01:00
Romain Thomas eac0bd7141 Backport check from liyansong2018 (#845 / #846) 2022-12-17 11:19:38 +01:00
Romain Thomas 167843a5f8 Avoid unnecessary allocation 2022-12-17 11:19:30 +01:00
Romain Thomas c0da465f74 Resolve #843 2022-12-14 08:59:29 +01:00
Romain Thomas 30ef3a7ce8 Fix missing include 2022-12-14 08:48:23 +01:00
Romain Thomas e218cc3061 Update changelog 2022-12-11 09:02:38 +01:00
Romain Thomas b3167cb78b Fix missing relationship between symbols and sections
See: #841
2022-12-11 09:01:31 +01:00
Romain 91ccdad497 Merge pull request #842 from liyansong2018/master
Suggestion for #840
2022-12-11 07:52:51 +00:00
liyansong2018 b42b5e68be Check ELF section 2022-12-09 22:12:54 -05:00
Romain Thomas 2a10494b8a Enhance the Python IO interface
Related to #832
2022-12-09 10:22:53 +01:00
Romain Thomas 15d8b2ffaf Cross compile for Apple M1
Fix: #834, #827, #778
2022-12-08 17:45:33 +01:00
Romain 57fcff35c5 Merge pull request #837 from liyansong2018/master
Avoid null pointer in c-api
2022-12-07 11:42:48 +00:00
liyansong2018 0d21ae733e Avoid null pointer in c-api 2022-12-07 04:25:43 -05:00
Romain Thomas 81fd78e81e Use the span/bytes interface (#833) 2022-12-07 08:22:25 +01:00
Romain Thomas cc3297fe2c Update changelog 2022-12-07 08:22:25 +01:00
Romain Thomas 85ce881011 Process #833 2022-12-07 08:22:25 +01:00
Romain 0d813b41a0 Merge pull request #831 from aeflores/avoid-memory-leak-in-c-api
Avoid memory leak for Dynamic entries in C API
2022-12-05 07:03:17 +00:00
Antonio Flores Montoya 15addc8105 Avoid memory leak for Dynamic entries in C API 2022-12-02 13:39:58 -05:00
Romain Thomas 655789e5ae Update changelog 2022-11-29 06:54:23 +01:00
Romain Thomas 1b39ad1ab2 Resolve #830 2022-11-29 06:53:09 +01:00
Romain Thomas 583131153e Fix typo 2022-11-27 11:37:07 +01:00
Romain e8e85732d0 Update issue templates 2022-11-27 10:18:29 +00:00
Romain fef4d9961b Update issue templates 2022-11-27 09:53:49 +00:00
Romain Thomas 3ea3e2e15c Update changelog 2022-11-27 09:25:54 +01:00
Romain Thomas 94613e81e3 Add test 2022-11-27 09:24:02 +01:00
Romain Thomas 2d5dd862e5 Resolve #828 2022-11-26 09:23:51 +01:00
Romain Thomas 77755e5a36 Print the actual version, not the pointer 2022-11-24 05:00:04 +01:00
Romain Thomas d17880fce2 Disable test 2022-11-24 04:23:00 +01:00
Romain Thomas d445beaac3 Expose 'remove_dynamic_symbol' 2022-11-24 04:22:22 +01:00
Romain Thomas 91d5162be4 Enable support for parsing a Mach-O from memory 2022-11-22 10:55:15 +01:00
Romain Thomas cd5f0ede27 Fix offset to virtual address conversion 2022-11-22 07:29:05 +01:00
Romain Thomas c35c23ef2c Bump limit (c.f. #821) 2022-11-21 17:18:45 +01:00
Romain Thomas fe09a71580 Enhance condition 2022-11-17 17:27:06 +01:00
Romain Thomas 6a244e1368 Fix conflict 2022-11-17 17:26:49 +01:00
Romain Thomas 86a13f2756 Fix constructor 2022-11-17 16:52:27 +01:00
Romain Thomas 84c921ebbf Fix extra comma 2022-11-17 16:52:27 +01:00
Romain 2eafce19bb Merge pull request #823 from mrexodia/unqualified-name-fix
Fix ambiguous name error with `using namespace std;`
2022-11-17 15:41:12 +00:00
Romain Thomas 94ebabcca8 Fix tests 2022-11-17 16:20:02 +01:00
Romain Thomas abc6c2d46c Revert "Run tests with Python 3.10"
This reverts commit 72e2393bcf.
2022-11-17 15:48:24 +01:00
Romain Thomas 72e2393bcf Run tests with Python 3.10 2022-11-14 07:06:24 +01:00
Romain Thomas 7458db97ed Refactor test to use pytest 2022-11-14 06:26:39 +01:00
Romain Thomas f4601fc86a Fix semi-colon 2022-11-13 09:57:40 +01:00
Romain Thomas 064a9093d5 Move PE tests to pytest 2022-11-12 20:37:14 +01:00
Romain Thomas ff400de5bc Remove the original test file 2022-11-12 19:44:45 +01:00
Romain Thomas 664b096e52 Move VDEX tests to pytest 2022-11-12 19:44:17 +01:00
Romain Thomas 4359051d4a Move OAT tests to pytest 2022-11-12 15:21:02 +01:00
Romain Thomas 02b1c043c1 Move ART tests to pytest 2022-11-12 15:06:03 +01:00
Romain Thomas 5f12f27335 Move DEX tests to pytest 2022-11-12 10:59:38 +01:00
Romain Thomas e7eaa8e753 Print the warning once 2022-11-12 10:42:52 +01:00
Romain Thomas 784cef9f63 Update changelog 2022-11-10 10:26:57 +01:00
Romain Thomas 803127cf52 Resolve #816 2022-11-09 17:55:54 +01:00
Romain Thomas 2fd6ac9538 Fix typo 2022-11-09 06:56:24 +01:00
Romain Thomas 2c96eab4b3 Add 0.12.3 changelog 2022-11-08 06:20:14 +01:00
Romain 773f97f0b7 Merge pull request #819 from mgunyho/tutorial-fixes
Fixes to tutorials
2022-11-08 04:54:48 +00:00
mgunyho f24df1dfbd Add a connecting sentence 2022-11-06 15:27:51 +02:00
mgunyho 94c5e1ce7e Fix a typo 2022-11-06 15:27:36 +02:00
mgunyho 33b14a50c9 Fix math 2022-11-06 15:26:56 +02:00
mgunyho f60c7521c7 Fix a typo in the shell example 2022-11-06 15:26:56 +02:00
mgunyho 0be18d4a9f Fix typo in link 2022-11-06 15:26:56 +02:00
mgunyho d4d0ff19a2 Make Python example in tutorial stand-alone 2022-11-06 15:26:56 +02:00
Romain Thomas 510105d51f Use Python final release 2022-11-01 09:34:24 +01:00
Romain Thomas 9dbbc39c65 Update dependencies 2022-11-01 08:16:36 +01:00
Marcel dd48e47d98 Fix ambiguous name error with using namespace std; 2022-10-31 17:45:01 +01:00
Romain Thomas 12a60d54e9 Fix #813 2022-10-25 06:49:32 +02:00
Romain Thomas 6be45c9bcf Fix log 2022-10-25 06:34:43 +02:00
Romain b74e1e1020 Merge pull request #815 from toge/support-gcc5
Fix name lookup issue on older gcc
2022-10-25 04:30:52 +00:00
toge 66e80b31aa solve name lookup issue on older gcc 2022-10-24 17:18:38 +09:00
Romain Thomas 100917541f Silently fail 2022-10-21 11:26:07 +02:00
Romain Thomas 288b4b75c8 Fix error 2022-10-21 11:12:00 +02:00
Romain Thomas 39bbd66193 Fix typo 2022-10-21 10:32:34 +02:00
Romain Thomas 6497d02b28 Fix #812 2022-10-21 09:24:10 +02:00
Romain Thomas 8f06f47fc9 Fix coding style 2022-10-21 09:08:06 +02:00
Romain fddaf96f67 Merge pull request #807 from ahawad/master
Updates the .dynamic section's contents after rebuilding it.
2022-10-21 07:05:50 +00:00
Romain Thomas 3a3e32760b Add test case 2022-10-21 09:05:26 +02:00
Romain 0e863c5bd1 Merge pull request #809 from redspot/master
Bugfix for ImportEntry to accept PE_TYPE
2022-10-21 07:01:47 +00:00
Romain Thomas 8a555be07b Resolve #808 2022-10-19 10:05:35 +02:00
Wilson Martin 7e624c997a Bugfix for ImportEntry to accept PE_TYPE
In the Python bindings, a new instance of ImportEntry
has it's type hard-coded to PE_TYPE::PE32, with no
way to change the type once created.

This prevents adding new ordinal imports to PE32+,
aka 64-bit, binaries.

The fix is to allow ImportEntry to also accept PE_TYPE.
In addition, the unittest also documents how to add an ordinal
using LIEF.

* Update ImportEntry to accept PE_TYPE
* Update python bindings for ImportEntry
* Add unittest for ImportEntry and ordinals
2022-10-12 14:38:56 -04:00
Romain Thomas 88d18b7342 Fix #804 2022-10-11 15:09:46 +02:00
Romain Thomas aa24163cca Update gitignore 2022-10-11 14:48:48 +02:00
ahawad ab7421e9e4 Updates the .dynamic section's contents after rebuilding it. 2022-10-09 19:08:44 +01:00
Romain Thomas 76742cd93b Update changelog 2022-10-09 19:04:54 +02:00
Romain Thomas 27a3fc6356 Resolve #806 2022-10-09 18:52:21 +02:00
Romain 84b0909170 Merge pull request #798 from its0x08/patch-1
chore: Add gitignore
2022-09-28 04:24:52 +00:00
Romain c272b2535d Merge pull request #800 from RaisinTen/fix-warning
Fix compiler warning in `LIEF::BinaryStream::peek_u16string()`
2022-09-28 04:24:20 +00:00
Darshan Sen af971ccea4 Fix compiler warning in LIEF::BinaryStream::peek_u16string()
This change fixes this compiler warning:

```sh
[218/228] Building CXX object vendor/lief/CMakeFiles/LIB_LIEF.dir/src/BinaryStream/BinaryStream.cpp.o
/Users/raisinten/Desktop/git/postject/vendor/lief/src/BinaryStream/BinaryStream.cpp:232:10: warning: variable 'count' set but not used [-Wunused-but-set-variable]
  size_t count = 0;
         ^
1 warning generated.
```

by removing all uses of count because it is unused.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
2022-09-27 11:49:01 +05:30
0x08 bf70bcaedf chore: Add gitignore
- Create `.gitignore` file to avoid overflowing VSCode with changed, that belong to the building process, after having built the project.
2022-09-23 11:06:37 +03:00
Romain Thomas b502b8d32f Update changelog 2022-09-23 08:25:22 +02:00
Romain Thomas 527c019c0f Fix #793 2022-09-23 08:22:41 +02:00
Romain Thomas f7ad93dec0 Resolve #787 2022-09-23 07:55:49 +02:00
Romain Thomas c4ef9f0efc Fix #786 2022-09-21 07:22:27 +02:00
Romain Thomas b183666a08 Fix #785 2022-09-20 04:59:23 +02:00
Romain Thomas e6512ce080 Fix missing copy_file (related to #770) 2022-09-20 04:45:41 +02:00
Romain Thomas 24935f654f Fix #784 2022-09-12 07:10:18 +02:00
Romain Thomas 98d33929de Fix #782 2022-09-12 07:06:08 +02:00
Romain Thomas fde2c48986 Fix #781 2022-09-12 06:32:57 +02:00
Romain Thomas f29aa6ba0d Fix DOWNLOAD_EXTRACT_TIMESTAMP warning 2022-09-12 06:31:28 +02:00
Romain 39b592d3b8 Merge pull request #780 from dsanders11/matcho-64-to-32-fixes
Fix some conversions of 64-bit to 32-bit types in MachO code
2022-09-12 02:44:05 +00:00
Romain 23397f5913 Merge pull request #779 from dsanders11/patch-3
Fix LIEF_VDEX option description
2022-09-11 14:11:34 +00:00
David Sanders ba57e54d5c Fix some conversions of 64-bit to 32-bit types in MachO code 2022-09-10 06:56:15 -07:00
David Sanders acda2974bf Fix LIEF_VDEX option description 2022-09-10 06:17:47 -07:00
Romain Thomas ad81191667 Enable to release binaries 2022-08-13 05:27:53 +02:00
Romain Thomas 27754bc698 Update bindings 2022-08-13 04:53:27 +02:00
Romain Thomas 0033b6312f Resolve #767 2022-08-13 04:51:09 +02:00
Romain Thomas ca93874026 Fix #766 2022-08-13 04:50:33 +02:00
Romain Thomas 4937a24a0b Fix #765 2022-08-13 04:49:47 +02:00
Romain Thomas 9e21e8d36d Resolve #770 2022-08-13 04:03:24 +02:00
Romain Thomas 365a16a564 Update changelog 2022-08-10 08:05:07 +02:00
Romain Thomas 53bf680ef4 Fix #763 2022-08-10 08:02:29 +02:00
Romain Thomas 7acf0bc422 Resolve #764 2022-08-10 07:26:49 +02:00
Romain Thomas 5d1d643a0c Fix #760 2022-08-03 16:45:24 +02:00
Romain 6bbb37ca07 Merge pull request #758 from rafael-santiago/master
Avoid using -1u constant and fix conflict with max() macro from Windows API
2022-07-30 04:18:44 +00:00
Romain ee548255f4 Merge pull request #757 from ZehMatt/mbedtls-preprocessor
Remove preprocessor macros for mbedtls
2022-07-30 04:18:13 +00:00
rafael-santiago c6b54cb045 Avoid using -1u constant and fix conflict with max() macro from Windows API
This commit introduces one improvement to make easy to build
softwares that depends on `LIEF` when treating warnings as error and
also a fix to a conflict between `std::numeric_limits::max()` and `max()`
function from `Windows API`. If a `LIEF`'s client includes parts of
`Windows` headers that will hit on `max` macro and after including
some `LIEF` headers, some compilation errors complaining about
this conflict will show up.

    The improvement related to silent up the `MSVC` "unary minus
operator applied to unsigned type, result still unsigned" is
about stop using the hardcoded `-1u` and start using the
suitable constants defined in `climits` (i.e.: `limits.h`). Being
`UINT_MAX` for `uint32_t` and `SIZE_MAX` for `size_t`.

    The fix related to the compilation error produced
by the conflict with `max()` macro from `Windows API` was merely wrap
`std::numeric_limits::max()` statement with `(...)`.
2022-07-28 17:09:33 -03:00
ζeh Matt 194089bcba Remove preprocessor macros, mbedtls uses config.h 2022-07-28 17:02:41 +03:00
Romain Thomas 95e78e880c Update hashs 2022-07-28 07:47:34 +02:00
Romain Thomas 8882068501 Update tests 2022-07-28 07:47:34 +02:00
Romain Thomas 8870247fae Keep the hash value on a ptr size 2022-07-28 07:47:34 +02:00
ζeh Matt 102aad8394 Revert back the hash function but silence warnings 2022-07-28 07:47:34 +02:00
ζeh Matt aee865386f Fix some compiler warnings 2022-07-28 07:47:34 +02:00
Romain 1cae649d7b Merge pull request #755 from floitsch/patch-1
Fix hasme typos
2022-07-28 04:52:47 +00:00
Florian Loitsch 84a293950f Fix hasme typos 2022-07-27 14:33:08 +02:00
Romain Thomas ddbf40f6e4 Only check the output 2022-07-22 08:18:05 +02:00
Romain Thomas f93029f2c2 Fix #753 2022-07-22 06:43:57 +02:00
Romain Thomas ee898650ba Update changelog 2022-07-22 06:39:46 +02:00
ζeh Matt 6085bbc949 Use explicit function signature for python bindings on write function 2022-07-22 06:36:35 +02:00
ζeh Matt 9d55f53860 Add overloads to write output to std::ostream 2022-07-21 18:16:53 +03:00
Romain Thomas 1730a680b4 Fix typo 2022-07-20 07:10:26 +02:00
Romain Thomas 11e307fc0d Fix test 2022-07-20 06:56:22 +02:00
Romain Thomas e6ecff7006 Add tests 2022-07-20 06:50:54 +02:00
Romain Thomas 6e3d640c1a Update the changelog 2022-07-20 06:41:11 +02:00
Antonio Flores Montoya 05e52e11bf Only assign a SymbolVersionAux to a SymbolVersion if it does not yet contain one.
This makes sure that whenever we have a SymbolVersionDefinition with multiple
entries only the first entry gets associated to the SymbolVersion.
Subsequent entries represent version predecessors, not the main version of the symbol
definition.
2022-07-20 06:36:18 +02:00
Romain Thomas 1624c4446f Resolve #747 2022-07-20 06:23:29 +02:00
Romain 28cd6ec1ca Merge pull request #750 from orca-repos/orca-patches
Correction of an ambiguous symbol in the binary API
2022-07-19 04:29:58 +00:00
William Roy c753e0cf10 Fix Binary API conflict from redundant qualifier
Signed-off-by: William Roy <wroy@proton.me>
2022-07-16 16:41:20 -04:00
Romain Thomas 212c04557f Does not fatally fail 2022-07-14 19:11:46 +02:00
Romain Thomas 64ead975b8 Fix 745 2022-07-14 16:11:55 +02:00
Romain Thomas dcf32cbf17 Fix f-string 2022-07-05 11:35:23 +02:00
Romain Thomas 18759849e7 Fix #739 2022-07-03 07:16:48 +02:00
Romain Thomas 0c244dab90 Fix #735 2022-07-03 06:41:38 +02:00
Romain Thomas d1ab0c71f5 Fix regression from #736 2022-07-03 06:36:47 +02:00
Romain c377d5c799 Merge pull request #741 from Pilphe/fix/dex_print_method_return_type
Fix return_type_ string while printing a DEX method
2022-07-03 04:25:32 +00:00
mbourget 16bd9d27de Fix return_type_ string while printing a DEX method 2022-06-30 15:31:29 +02:00
Romain 9cf3b56cf0 Merge pull request #736 from robertgzr/master
Pass jobs value to ninja as well
2022-06-23 04:04:04 +00:00
Robert Günzler 84f3acc5aa Pass jobs value to ninja as well
Signed-off-by: Robert Günzler <r@gnzler.io>
2022-06-23 04:03:54 +00:00
Romain ddaf96805c Merge pull request #734 from ZehMatt/fix-733
Fix #733: Use correct count for data directories (PE)
2022-06-23 04:02:32 +00:00
ζeh Matt 8ad11c21e5 Fix #733: Use correct count for data directories (PE) 2022-06-21 23:29:52 +03:00
Romain 7fa0d95f25 Merge pull request #732 from dsanders11/macho-binary-page-size
Improve Mach-O handling of page size
2022-06-19 18:22:17 +00:00
David Sanders 10f8d01b8d Improve Mach-O handling of page size 2022-06-18 11:00:27 -07:00
Romain Thomas c52a39850c Fix #731 2022-06-18 10:39:20 +02:00
Romain ad2d53d15a Merge pull request #730 from dsanders11/fix-macho-segment-numberof-sections
Increase numberof_sections when adding section to Mach-O segment
2022-06-18 07:47:38 +00:00
Romain a201a75498 Merge branch 'master' into fix-macho-segment-numberof-sections 2022-06-18 07:47:17 +00:00
Romain 256b43c6f9 Merge pull request #729 from dsanders11/fix-issue-728
Set correct virtual size when adding Mach-O segment
2022-06-18 07:45:12 +00:00
David Sanders 261b8e66a6 Set correct virtual size when adding Mach-O segment 2022-06-18 07:45:03 +00:00
Romain Thomas 2d0525257a Merge branch 'ci/python311' 2022-06-18 09:13:27 +02:00
Romain Thomas d84dd57127 Add Python 3.11 2022-06-18 09:13:01 +02:00
Marcelo Duarte 1b2e841502 Add Python 3.11 b3 to Win64 build 2022-06-18 09:11:01 +02:00
Romain ee66264a6a Merge pull request #727 from dsanders11/fix-issue-726
Align __LINKEDIT virtual size
2022-06-18 07:09:41 +00:00
David Sanders abd804a552 Increase numberof_sections when adding section to Mach-O segment 2022-06-17 21:01:58 -07:00
Romain a6c557855e Merge pull request #723 from dsanders11/pe-resource-node-ordering
Fix ordering of resource node childs in PE
2022-06-17 05:08:54 +00:00
David Sanders 06d492b8f6 Fix ordering of resource node childs in PE 2022-06-17 05:07:57 +00:00
Romain Thomas fa306af477 Bump pybind11 version 2022-06-17 06:48:58 +02:00
Romain 7a2f606c48 Merge pull request #724 from marcelotduarte/msys2
Fix build in MSYS2
2022-06-17 04:35:50 +00:00
David Sanders 1a631cebfe Align __LINKEDIT virtual size 2022-06-15 23:55:07 -07:00
Marcelo Duarte df32d17a25 Fix build in MSYS2 2022-06-16 01:13:38 -03:00
Romain 39da57cf6b Merge pull request #722 from dsanders11/patch-2
Remove extraneous semicolon
2022-06-15 05:39:00 +00:00
David Sanders f7ffbfb6ce Remove extraneous semicolon 2022-06-14 18:28:04 -07:00
Romain Thomas 55b4808666 Try importing from setuptools's vendor 2022-06-14 08:52:29 +02:00
Romain Thomas 9437acb2c3 Add CI step to upgrade pip 2022-06-14 08:40:19 +02:00
Romain Thomas 0af845c324 Modernize with f-string 2022-06-14 06:07:05 +02:00
Romain Thomas 26fd41b56e Resolve #719 2022-06-14 05:58:30 +02:00
Romain 82419fb435 Merge pull request #718 from laanwj/2022-06-ppc64-nx
Correct default for Binary::has_nx on ppc64
2022-06-14 03:46:51 +00:00
laanwj c06af2d15b Correct default for Binary::has_nx on ppc64
From the Linux kernel source:

     * This is the default if a program doesn't have a PT_GNU_STACK
     * program header entry. The PPC64 ELF ABI has a non executable stack
     * stack by default, so in the absence of a PT_GNU_STACK program header
     * we turn execute permission off.

Resolve #717
2022-06-13 14:39:06 +02:00
Romain Thomas ced4499bf8 Remove the hard limit on the number of ELF sections
Resolve #706
2022-06-12 09:47:51 +02:00
Romain Thomas 6ccdffe221 Resolve #703 2022-06-12 09:42:32 +02:00
Romain 08f3c80fae Merge pull request #716 from dsanders11/macho-remove-section
Add API to remove a section from a segment & section names
2022-06-12 07:04:08 +00:00
David Sanders 0ecd6682c7 Add API to remove a section from a segment & section names 2022-06-12 07:03:48 +00:00
Romain 79909cbed9 Merge pull request #713 from ZehMatt/fix-712
Fix #712: Guard json includes with LIEF_JSON_SUPPORT
2022-06-12 07:02:07 +00:00
ζeh Matt 79bc4818c7 Fix #712: Guard json includes with LIEF_JSON_SUPPORT 2022-06-12 07:02:00 +00:00
Romain a57543c950 Merge pull request #714 from ZehMatt/fix-cmake-multiconfig
Fix CMake error using multi-configuration generator
2022-06-12 07:01:02 +00:00
Romain 0e518017d3 Merge branch 'master' into fix-cmake-multiconfig 2022-06-12 07:00:53 +00:00
Romain 10714e3215 Merge pull request #715 from dsanders11/patch-1
Use consistent parameter name
2022-06-12 07:00:33 +00:00
David Sanders 45cb65e2ca Use consistent parameter name 2022-06-10 22:42:43 -07:00
ζeh Matt 336165fc96 Fix CMake error using multi-configuration generator 2022-06-11 06:56:36 +03:00
Romain Thomas f8c711dd94 Update sanitize check API 2022-06-04 13:54:53 +02:00
Romain 378233570b Merge pull request #707 from rafael-santiago/master
Detect data section end's before going ahead on accessing it
2022-06-04 06:57:27 +00:00
rafael-santiago f230094d58 Detect data section end's before going ahead on accessing it 2022-05-19 20:26:33 -03:00
Romain Thomas 0fdc183551 Early check on the nlist.str_idx 2022-05-02 19:54:48 +02:00
Romain Thomas 722ed6c403 Fix #699 2022-04-22 18:52:47 +02:00
Romain 51d8182047 Merge pull request #698 from pive/master
using CMAKE_CURRENT_SOURCE_DIR in place of CMAKE_SOURCE_DIR for Fetch…
2022-04-21 00:01:05 +00:00
pive 3339248b47 using CMAKE_CURRENT_SOURCE_DIR in place of CMAKE_SOURCE_DIR for FetchContent 2022-04-20 11:52:41 +02:00
Romain Thomas b5a5940b6b Fix checksum 2022-04-20 06:29:18 +02:00
Romain Thomas e726b3d0ba Update spdlog 2022-04-20 06:23:02 +02:00
Romain Thomas b490f97987 Check that the ptr is not null 2022-04-20 05:59:44 +02:00
Romain Thomas 534d1824e5 Prepare for parsing from memory 2022-04-20 05:58:45 +02:00
Romain Thomas e1a8244b92 Enhance Mach-O's builder and add support for recent LC commands 2022-04-16 15:10:56 +02:00
Romain Thomas 3020cc66de Update ScopedStream interface 2022-04-15 06:15:30 +02:00
Romain Thomas c9a4d3335c Fix missing entry 2022-04-13 05:37:18 +02:00
Romain Thomas bafa32f146 Update README 2022-04-13 05:34:02 +02:00
Romain c776d5994c Merge pull request #695 from abraaocsantana/patch-1
Fix project using deprecated iterator base class
2022-04-11 17:15:34 +00:00
Abraão de Santana e4455d7193 Fix project using deprecated iterator base class
Fixes https://github.com/lief-project/LIEF/issues/694
2022-04-08 17:16:08 -03:00
Romain Thomas 57647bb05b Update changelog 2022-04-08 08:33:01 +02:00
Romain Thomas 4f4f636598 Move Builder::optimize to internal utils 2022-04-06 06:31:28 +02:00
Romain Thomas 261c49ebf5 Handle missing __LINKEDIT segment$ 2022-04-06 05:49:33 +02:00
Romain Thomas 7627a1d5da Update sanitizer 2022-04-05 22:07:54 +02:00
Romain Thomas 9cb5c191b4 Add missing else 2022-04-05 22:07:43 +02:00
Romain Thomas 6ae50e517f Fix warnings 2022-04-05 21:56:34 +02:00
Romain Thomas 8e9246992c Fix typo 2022-04-05 04:13:10 +02:00
Romain Thomas 7faf465af5 Fix test 2022-04-04 06:45:05 +02:00
Romain Thomas 208f2debbf Enhance testing 2022-04-04 06:44:54 +02:00
Romain Thomas 7412a4c50c Add API to get a section from a segment & section names 2022-04-04 06:24:37 +02:00
Romain Thomas bef99ccff3 Update test 2022-04-04 06:22:41 +02:00
Romain Thomas 06a8525837 Update env variable setup 2022-04-04 06:04:25 +02:00
Romain Thomas 06db1d29af Only run on Linux 2022-04-03 19:57:38 +02:00
Romain Thomas 266f989e52 Enable support for modifying section-less ELF binaries 2022-04-03 19:34:44 +02:00
Romain Thomas 1307d34b55 Fix memory issues 2022-04-03 11:27:34 +02:00
Romain Thomas 18d7334fbe Update 2022-04-03 10:15:28 +02:00
Romain Thomas 96d39a0834 Add non regression tests 2022-04-03 10:12:18 +02:00
Romain Thomas 7607ce36db Add non regression tests 2022-04-03 09:53:42 +02:00
Romain Thomas 17e40a7de6 Fix env variables 2022-04-03 08:11:30 +02:00
Romain Thomas 31551749e4 Fix #693 2022-04-02 20:02:58 +02:00
Romain Thomas c2dc898a01 Improve the LIEF tests integration 2022-04-02 19:47:51 +02:00
Romain 325ed27f32 Merge pull request #692 from kjackiewicz/master
Fix ELF section inclusion calculations
2022-04-01 19:32:26 +02:00
Krzysztof Jackiewicz fb772b1c67 Fix section inclusion calculations 2022-04-01 09:54:39 +02:00
Romain Thomas ef27ca91b6 Enable release branch 2022-04-01 06:21:52 +02:00
Romain Thomas 7137c4b7e2 Update changelog 2022-04-01 05:39:14 +02:00
Romain Thomas baa023b914 Remove exceptions 2022-04-01 05:38:30 +02:00
Romain Thomas f75718ccd9 Resolve #691 2022-04-01 05:19:12 +02:00
Romain Thomas f944b0a917 Enable manual workflow 2022-04-01 05:06:12 +02:00
Romain Thomas 7c7d8e4585 Add a 'sanitize' workflow 2022-04-01 05:04:40 +02:00
Romain Thomas 946b66550c Fix Python life time issue
Resolve #688
2022-03-31 07:15:46 +02:00
Romain Thomas c6bd124537 Build Python 3.6 on new release 2022-03-31 07:13:25 +02:00
Romain Thomas 0ad27bf799 Fix sphinx warnings 2022-03-31 07:08:25 +02:00
Romain Thomas d2a9e94a51 Update changelog 2022-03-31 05:20:44 +02:00
Romain Thomas c11d6acf77 Force the destination 2022-03-30 21:31:38 +02:00
Romain Thomas 820b663c41 Update the Linux CI image to manylinux_2_24_x86_64
Resolve #683
2022-03-30 21:30:04 +02:00
Romain Thomas 6fc45a5656 Fix #689 2022-03-30 20:30:14 +02:00
Romain Thomas 87689bec78 Resolve #684 2022-03-30 07:35:15 +02:00
Romain Thomas d65f3333c0 Fix export parsing regression
Resolve #685
2022-03-30 07:33:43 +02:00
Romain Thomas 430df66954 Fix PE parsing dialogs
Resolve #687
2022-03-30 07:30:49 +02:00
Romain Thomas ac23b9bdb5 Add log message 2022-03-30 07:26:36 +02:00
Romain Thomas 9eec02d575 Resolve #686 2022-03-30 06:55:05 +02:00
Romain Thomas ac6dabe3e1 Upload nightly builds to S3 bucket
Resolve #534
2022-03-29 20:45:28 +02:00
Romain Thomas 59e936b884 Fix typo 2022-03-29 06:10:09 +02:00
Romain Thomas 63b2c8e836 Update CI config 2022-03-29 06:03:28 +02:00
Romain Thomas cadb803b1c Use Gitlab PyPi package 2022-03-28 07:03:18 +02:00
Romain Thomas 2e9ed7c147 Fix workflow 2022-03-27 17:50:15 +02:00
Romain Thomas dfeaa20a39 Move nightly builds to Gitlab packages 2022-03-27 16:44:11 +02:00
Romain Thomas af2297bb8f Bump version 2022-03-26 12:10:33 +01:00
Romain Thomas cff8c4211a Update action's version 2022-03-26 12:07:02 +01:00
Romain Thomas f891891191 More artifacts 2022-03-26 09:39:00 +01:00
Romain Thomas aa5800876f Add artifacts 2022-03-26 09:28:09 +01:00
Romain Thomas 239f78dc33 Fix changelog date 2022-03-25 21:22:24 +01:00
Romain Thomas e03bf4974e Fix typo 2022-03-24 06:47:30 +01:00
Romain Thomas 496c13bf42 Update doc 2022-03-24 06:46:01 +01:00
Romain Thomas b314235b0f Update Link 2022-03-24 06:41:24 +01:00
Romain Thomas 15a1246a73 Fix LIEF.dll destination 2022-03-13 08:44:58 +01:00
Romain Thomas 4a58cc18fd Update CI script 2022-03-11 20:48:34 +01:00
Romain Thomas b421535b8e Re-compute the OptionalHeader's checksum
Resolve #660
2022-03-07 07:44:28 +01:00
Romain Thomas 5e4d6f7ee0 Fix wrong undef place 2022-03-06 09:34:43 +01:00
Romain Thomas cae1367190 Add undef 2022-03-05 21:44:49 +01:00
Romain Thomas 7f878f40ee Enable to re-compute the PE rich header
Resolve #587
2022-03-05 21:29:53 +01:00
Wolf Vollprecht a15c6d1240 allow external pybind11 2022-03-05 11:42:04 +01:00
Romain Thomas bd8e8368b4 Fix warning 2022-03-05 10:27:45 +01:00
Romain Thomas 9511d9fccf Update doc according to #675 2022-03-05 10:19:12 +01:00
Romain Thomas 8f12ec939d Comment unused variable 2022-03-01 06:42:22 +01:00
Romain Thomas 724cf995f3 Check if the binary is None 2022-03-01 06:34:41 +01:00
Romain Thomas ba54ea632b Add support for PE delayed imports
Resolve #664
2022-03-01 06:18:44 +01:00
Romain Thomas b065900497 Update changelog 2022-03-01 06:18:37 +01:00
Romain 3416ca4d9d Merge pull request #674 from ekilmer/use-generated-cmake-target-export
Use generated CMake export target(s)
2022-03-01 06:10:58 +01:00
Eric Kilmer 79b9caf424 Minor fixup/cleanup for consistency in example(s) 2022-02-27 19:46:01 -05:00
Romain Thomas 57294452a1 Increase maximum export name len 2022-02-27 10:11:10 +01:00
Romain Thomas 0b1ac7bfcb Update references 2022-02-27 09:53:58 +01:00
Eric Kilmer a2a9d1b137 Export LIEF targets with CMake
With these changes, we no longer need to manually find the LIEF library
by filename. CMake takes care of generating the LIEF::LIEF target and
library location for us in the exported target set. This is basically a
requirement when using external dependencies because the original
functionality did not take care of this.

I have updated the example projects to make sure that they will work
with this new setup. In doing so, I changed quite a bit to more closely
follow CMake best practices that I hope we can agree on to both improve
reliability and reduce maintenance and support questions for people who
configure LIEF with external dependencies.

This project still supports finding static or shared LIEF libraries in
the same install prefix using the find_package COMPONENTS method.

This project still supports development of other projects that want to
use LIEF without installing. Just specify the following option during
configuration of your project that depends on LIEF:

```cmake
cmake -DLIEF_DIR=<LIEF_BUILD_DIR> ...
```
2022-02-25 19:02:36 -05:00
Eric Kilmer 3861a8269a Use CMake BUILD_INTERFACE generator expression for include directories
This fixes the paths that are generated for the exported targets so that
they do not have absolute paths that were found/used at build time.
2022-02-25 17:36:10 -05:00
Romain 9a242f452b Merge pull request #672 from dktapps/patch-1
readme: fix typo
2022-02-25 20:39:57 +01:00
Romain Thomas b386771600 Fix #671 2022-02-25 20:02:17 +01:00
Dylan T 3527ed3c6a readme: fix typo 2022-02-25 14:52:43 +00:00
Romain Thomas 6eb37b8a27 Clean the code 2022-02-25 06:30:30 +01:00
Adrian Haensler 9331982bfe support update of auxiliary symbol versions and adding new SymbolVersionAuxRequirements 2022-02-25 05:08:44 +01:00
Romain Thomas 4bd080a965 Enhance the ELF parser 2022-02-24 06:45:50 +01:00
Romain Thomas 1aec66f6a7 += https://github.com/datatheorem/strongarm 2022-02-23 06:39:12 +01:00
Romain Thomas 566d4ac8a8 Update tests 2022-02-19 10:35:39 +01:00
Romain Thomas 2830a8a32a Fix missing .symtab/.strtab sections 2022-02-18 05:08:02 +01:00
Romain Thomas a3bd1ffe58 Fix on the ELF .bss section 2022-02-18 05:01:01 +01:00
Romain Thomas 6262ca7433 Clean the ELF builder 2022-02-17 07:43:23 +01:00
Romain Thomas d4dee2946f Fix CI 2022-02-17 07:30:44 +01:00
Romain Thomas b227eb3bbc Update CI 2022-02-17 07:24:14 +01:00
Romain Thomas f920bf4bcf Update OSX CI 2022-02-17 06:47:28 +01:00
Romain Thomas 0d1d85c8de Fix parser issue 2022-02-17 06:45:55 +01:00
Romain Thomas a92d88f4bd Fix std::cout 2022-02-17 06:39:25 +01:00
Romain Thomas fd500d5c5e Improve exports parsing
It fixes #655
2022-02-17 05:25:08 +01:00
Romain Thomas 3816cccd95 Improve Mach-O relocations parser 2022-02-16 22:42:03 +01:00
Romain Thomas 8fcff6e8e3 Proprify PE resources handling 2022-02-16 05:32:25 +01:00
Romain Thomas d4d66c5189 BinaryStream improvment 2022-02-15 06:41:47 +01:00
Romain Thomas 5883082d5d Add empty() method 2022-02-15 06:41:47 +01:00
Romain d6f5261995 Merge pull request #667 from ekilmer/fix-external-span
Fix external span usage
2022-02-15 05:14:26 +01:00
Eric Kilmer c6b8b67db6 Fix external span usage
* Typo in the definition check

* Search for <tcb/span.hpp> instead of just <span.hpp>
2022-02-14 22:36:43 -05:00
Romain Thomas 274d887e17 Update PE parser interface 2022-02-14 06:40:06 +01:00
Romain Thomas b775ebec03 Update ART's utils 2022-02-14 06:37:48 +01:00
Romain Thomas 9f73563fa3 Update VDEX's utils 2022-02-14 06:33:39 +01:00
Romain Thomas 10bf526044 Update OAT's utils 2022-02-14 06:33:25 +01:00
Romain Thomas d0b3569ec0 Update DEX's utils 2022-02-14 06:33:14 +01:00
Romain Thomas 6878989482 Merge branch 'test/issue-616' 2022-02-14 06:16:03 +01:00
Romain Thomas e61cba8dcc Add undef as described in #616 2022-02-14 06:15:44 +01:00
Romain Thomas f3d7b8f6cd Add blog post link 2022-02-13 18:35:52 +01:00
Romain Thomas 16c881c379 Update Mach-O utils 2022-02-13 18:34:03 +01:00
Romain Thomas c572dc7c91 Remove LIEF_ROOT 2022-02-13 18:23:38 +01:00
Romain Thomas 110047f1ae Small improvements 2022-02-13 18:21:17 +01:00
Romain Thomas 373f94dcf1 Improve VDEX utils 2022-02-13 12:22:53 +01:00
Romain Thomas d948e08043 Add FileStream to interface std::ifstream 2022-02-13 11:51:27 +01:00
Romain Thomas ea928902e4 Update changelog 2022-02-13 11:45:47 +01:00
Romain Thomas 50986fcaf1 Use a span interface 2022-02-13 10:39:38 +01:00
Romain Thomas ef585e2b35 Update doc 2022-02-13 09:13:21 +01:00
Romain Thomas 1a215c2448 Fix typo 2022-02-13 08:53:49 +01:00
Romain 74a690ec7e Merge pull request #666 from ekilmer/fix-missing-header
Add missing array header
2022-02-13 06:58:18 +01:00
Romain Thomas 05e3c6eb7c Fix memory issues 2022-02-12 17:10:23 +01:00
Romain Thomas 2a41db7027 Fix typo 2022-02-12 07:33:44 +01:00
Romain Thomas f5655cc6b9 Fix missing remove signature 2022-02-12 06:22:19 +01:00
Romain Thomas cb9e43c7e1 Fix typo 2022-02-11 09:26:19 +01:00
Romain Thomas a05fd6bc2c Fix missing test for Mac OS 2022-02-11 07:20:38 +01:00
Romain Thomas ada32bfba1 Fix typo 2022-02-11 07:03:54 +01:00
Romain Thomas 140c766522 Update Catch2 to 2.13.8 2022-02-11 06:35:45 +01:00
Romain Thomas 360ae7bb8f Fix LEAF rtti/exceptions issues 2022-02-11 06:25:12 +01:00
Romain Thomas 799f21c7ef Fix error with Android 2022-02-11 06:17:09 +01:00
Eric Kilmer eb4d92bd5f Add missing array header 2022-02-10 15:24:35 -05:00
Romain Thomas 77328b0071 Bump year 2022-02-08 21:16:25 +01:00
Romain Thomas e9782c5927 Clean & modernize LIEF code base
This commit (obviously non-atomic) cleans LIEF's code base by:
  - Using pointer semantics (`std::unique_ptr<>`)
  - Using LEAF boost error in the binary stream
  - Reducing the scope of the iterators (`it_section`, ...)
  - Removing `Structures.hpp` from the public headers
  - etc
2022-02-05 06:09:06 +01:00
Romain Thomas b65e7cca03 Fix frozen issue 2022-02-02 06:21:46 +01:00
Romain Thomas 9358af4e93 Fix -Wpedantic 2022-02-02 06:21:35 +01:00
Romain Thomas 92c0c60df8 Enable to use an external version of Frozen
cf. #605 and https://github.com/microsoft/vcpkg/pull/21213
2022-02-02 05:40:38 +01:00
Romain Thomas 12c5bf4489 Update changelog 2022-01-30 11:42:35 +01:00
Romain Thomas b8151e3ca1 Cleaning up 2022-01-30 09:51:20 +01:00
Romain Thomas 18423b1d8c Enable to provide an external version of MbedTLS
For instance, it can be used as follows:

```
cmake .. \
      -DLIEF_OPT_MBEDTLS_EXTERNAL=on \
      -DMbedTLS_DIR=<PATH>/cmake
```

Related to #605
2022-01-30 09:46:26 +01:00
Romain Thomas 6bb3eee5d8 Do not include utf8cpp globaly 2022-01-30 09:27:43 +01:00
Romain Thomas d3edce4e2c Enable to provide an external version of utf8cpp
For instance, it can be used as follows:

```
cmake .. \
      -DLIEF_OPT_UTFCPP_EXTERNAL=on \
      -Dutf8cpp_DIR=<PATH>/lib/cmake/utf8cpp
```

Related to #605
2022-01-30 09:12:48 +01:00
Romain Thomas ccd4e54485 Use `GNUInstallDirs` on UNIX 2022-01-30 08:21:26 +01:00
Romain Thomas caf40c72d4 Enable to provide an external version of Boost Leaf
For instance, it can be used as follows:

```
cmake .. \
      -DLIEF_OPT_EXTERNAL_LEAF=on \
      [-DLIEF_EXTERNAL_LEAF_DIR=/tmp/leaf/include]
```

Related to #605
2022-01-30 07:55:25 +01:00
Romain Thomas f9d5c2805f Fix unistd errror 2022-01-30 07:32:46 +01:00
Romain Thomas 43c07ca06b Add flag to enable MSVC/Wine cross-compilation 2022-01-30 07:26:21 +01:00
Romain Thomas 48eae9b0d4 Cleaning up 2022-01-29 21:33:23 +01:00
Romain Thomas 3af0465bb4 Modernize code base 2022-01-29 21:05:11 +01:00
Romain Thomas e71d764009 Get rid of `dynamic_cast<>()` 2022-01-29 12:20:56 +01:00
Romain Thomas b730ec068d Hide the JSON implementation of LIEF
This commit removes the public include of nlohmann/json
as it is a *detail of implementation*. Instead, the public
API exposes:

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

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

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

Related to #605
2022-01-29 09:51:03 +01:00
Romain Thomas fbcb5bfe2e This commit removes the RTTI information from LIEF 2022-01-29 06:36:07 +01:00
Romain Thomas 6841ef0d0c Update README 2022-01-29 06:34:56 +01:00
Romain Thomas e107e15917 Update README 2022-01-29 06:27:22 +01:00
Romain Thomas ed61e22da1 Update references 2022-01-28 22:10:50 +01:00
Romain Thomas acb1bf01ee Update the documentation 2022-01-28 21:57:44 +01:00
Romain Thomas 22b13f030a Ignore sccache errors 2022-01-28 05:50:22 +01:00
Romain Thomas 3b69bcc18d Add limit on the padding size 2022-01-27 21:58:01 +01:00
Romain Thomas 40d770cb92 Fix memory leak introduced in #308 2022-01-27 21:46:08 +01:00
Romain Thomas c7e33d84d8 Update LibFuzzer intergration 2022-01-27 21:30:43 +01:00
Romain Thomas 3471ca4184 Update changelog 2022-01-27 20:23:24 +01:00
rthomas a615adbee4 This commit cleans and modernizes the code base of LIEF.
Among the changes:

- It removes the ``and, or, not`` keywords
- It updates the Documentation
- It moves the internal structures in the ``details::`` namespace
2022-01-27 20:18:54 +01:00
Romain Thomas 540049d0d9 Update LEAF dependency
It resolves #657
2022-01-26 23:45:01 +01:00
Romain Thomas eb66de3cd9 Add instructions to compile LIEF in debug
Related to #659
2022-01-25 06:34:36 +01:00
Romain 55b6075bf8 Merge pull request #658 from niooss-ledger/py-elf-header-bytes
Support setting ELF header identity from bytes
2022-01-25 06:14:00 +01:00
Nicolas Iooss bb7faf3e72 Support setting ELF header identity from bytes
The following Python code currently fails with Python 3.9:

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

The reported error is:

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

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

Modify the `identity` setter to support bytes. As `Header::identity_t`
is directly an array of `uint8_t`, casting it from `py::bytes` is
straightforward.
2022-01-24 23:18:20 +01:00
Romain Thomas 2ae5327e86 Update changelog 2022-01-22 14:41:17 +01:00
Romain Thomas 72ebe0d89e Refector the ELF builder 2022-01-22 13:23:52 +01:00
Romain Thomas 076bd5cd23 Resolve #644 2022-01-16 17:04:47 +01:00
Romain Thomas d98f4ee6a8 Fix error 2022-01-15 15:09:04 +01:00
Romain Thomas 2cf5ab2917 Better support of Mach-O exported symbols 2022-01-15 11:37:15 +01:00
Romain Thomas cb34da92a1 Update doxygen configuration file 2022-01-07 05:40:32 +01:00
Romain Thomas 1c523c74e7 Fix documentation 2022-01-07 05:06:19 +01:00
hypervis0r e12dafbfc0 Add reserved PE data directory 2022-01-02 10:48:07 +01:00
Romain 214c42787a Merge pull request #633 from adamjseitz/gnu-hash-dynsym-counting-zero-check
Walk the max bucket in GNU_HASH for counting dynamic symbols
2022-01-02 08:55:50 +01:00
Romain c8e6433da9 Merge pull request #648 from donno2048/patch-1
Remove an `import`, variables and an `else` branch
2022-01-02 08:52:25 +01:00
Elisha Hollander a34f734a99 remove an import, variables and an else branch 2021-12-30 19:43:30 +02:00
Romain Thomas 47b8495973 Bump Pybind11 2021-12-24 12:04:13 +01:00
Romain Thomas bdeeb17bc6 Resolve #643 2021-12-24 11:51:50 +01:00
Romain Thomas 525b56e74f Fix typo 2021-12-22 22:04:31 +01:00
Romain Thomas 1b11e1bbfe Re-enable test 2021-12-22 21:25:52 +01:00
Romain Thomas 8e5217e835 Update spdlog 2021-12-22 21:10:21 +01:00
Romain Thomas 691ba9ec5c Fix heap buffer overflow 2021-12-22 21:08:04 +01:00
Romain Thomas e04645d3c7 Fix UB and better endianness support 2021-12-22 06:59:17 +01:00
fanquake f080d582b6 Add RISCV architecture 2021-12-21 06:54:46 +01:00
Romain Thomas 346f4ce8c0 Fix #638 2021-12-21 06:46:51 +01:00
Romain 271df3da06 Merge pull request #641 from fanquake/xcore_not_xcode
Fix typo in XCORE arch name
2021-12-21 06:43:01 +01:00
Romain Thomas a86c76f29a Resolve #637 2021-12-21 06:26:02 +01:00
fanquake 20fa201e62 Fix typo in XCORE arch name 2021-12-21 13:03:17 +08:00
Romain Thomas 7355f1b2c6 Update mbedtls 2021-12-20 05:30:33 +01:00
Romain Thomas 92812dfe2e Redesign the configuration of the MachO parser 2021-12-18 12:05:30 +01:00
Romain Thomas 0459d3bf77 Replace (void) 2021-12-16 07:40:21 +01:00
Romain Thomas ccba31cff1 Improve checks 2021-12-16 06:53:17 +01:00
Romain Thomas d76018ce2d Resolve #631 2021-12-16 06:48:41 +01:00
Romain 464e7d1107 Merge pull request #629 from fanquake/remove_travis_leftovers
doc: point to Linux x86-64 GitHub action from README.md
2021-12-16 06:27:22 +01:00
Adam Seitz 4f2c3bdf1c Prevent over-counting symbols with COUNT_HASH
When counting dynamic symbols with DYNSYM_COUNT_METHODS::COUNT_HASH,
ensure that empty buckets (containing only index 0) are handled
correctly.

Additionally, optimize nb_dynsym_gnu_hash a bit - only the bucket with the
maximum symbol index needs to be walked. Finding the max, ensuring it is
non-zero, and only walking that bucket means a zero bucket will not be
walked.

Fixes #632
2021-12-08 17:21:42 -05:00
Romain 162f15d884 Merge pull request #628 from fanquake/latest_version_readme
doc: display latest version in README.md
2021-11-25 07:16:26 +01:00
fanquake 8a105d5e12 doc: point to Linux x86-64 GitHub action from README.md
Travis no-longer seems to exist.
2021-11-25 09:34:02 +08:00
fanquake da3c9bcd38 doc: display latest version in README.md 2021-11-25 09:12:56 +08:00
Romain Thomas 45ffa6db92 Fix platform 2021-11-22 08:34:12 +01:00
Romain Thomas 33818ac622 Add BLint 2021-11-22 06:02:19 +01:00
Romain Thomas 5b8380de3f Support of Python 3.10 2021-11-22 05:58:05 +01:00
Romain 3f47b3c49e Merge pull request #623 from limitedeternity/master
Fix Parser::parse_load_config
2021-11-16 05:13:34 +01:00
Vyacheslav Bespalov 88acb19835 Fix Parser::parse_load_config 2021-10-20 10:30:41 +03:00
Romain Thomas b2fc5ba9be Update fields in PE::LoadConfiguration
It seems that on recent version on the SDK, Microsoft renamed the
field LoadConfiguration::reserved1 into DependentLoadFlags.

This commit create an alias on this field

Resolve #621
2021-10-19 05:27:33 +02:00
Romain e0aea95246 Merge pull request #617 from onlyzdd/master
Fix Python API iterator performance issue
2021-10-16 08:45:44 +02:00
Dongdong Zhang 89ea7a12c6 Fix iterator performance issue 2021-10-12 11:24:37 +08:00
Romain Thomas 717e4e9347 Move to std::unique_ptr 2021-10-01 04:09:10 +02:00
Romain Thomas 1e18697e6e Update MbedTLS 2021-09-27 06:30:34 +02:00
Romain Thomas 0685d44f59 Fix some warnings 2021-09-25 20:19:42 +02:00
Romain Thomas dc2425a314 Fix API 2021-09-25 20:19:29 +02:00
Romain Thomas 70da506e88 Update Melkor 2021-09-25 20:19:20 +02:00
Romain Thomas e1432c4830 Fix Windows build 2021-09-25 12:29:01 +02:00
Romain c8afcec193 Merge pull request #609 from onlyzdd/master
Fix broken python API doc for Android formats
2021-09-25 07:21:55 +02:00
Dongdong Zhang f619864eca Fix broken python API doc for Android formats 2021-09-23 13:29:01 +00:00
Romain c5e168a560 Merge pull request #608 from onlyzdd/master
Fix DEX prototype parameters type parsing
2021-09-22 18:44:47 +02:00
Dongdong Zhang ee43520b76 Fix DEX prototype parameters type parsing 2021-09-22 12:28:09 +08:00
Romain Thomas a89095c104 Fix #604 2021-09-13 20:01:10 +02:00
Romain Thomas 255d09c92d Fix #598 2021-08-24 07:55:41 +02:00
Romain 95025aa76e Merge pull request #601 from pombredanne/patch-1
Fix minor typo
2021-08-22 07:48:46 +02:00
Philippe Ombredanne e1ae238087 Fix minor typo
Found while reading this excellent tutorial.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
2021-08-18 14:02:12 +02:00
Romain Thomas b05d886400 Update changelog 2021-08-02 20:20:48 +02:00
lucam 9c70f05db9 MachO: add support for LC_FILESET_ENTRY by parsing fileset_entry_command and exporting them via sub Macho::Binary::filesets_ 2021-08-02 20:14:24 +02:00
Romain Thomas a69ec7c08c Certificate expired 2021-07-31 14:20:16 +02:00
Romain Thomas 5ece770e29 Add CMake dependency (related to #599) 2021-07-31 11:45:55 +02:00
Romain Thomas 3f8a01d582 Increase max section size 2021-06-29 13:47:06 +02:00
Romain b1cb10413f Merge pull request #592 from marckleinebudde/patch-1
03_elf_change_symbols.rst: fix typo
2021-06-29 08:52:22 +02:00
Marc Kleine-Budde ee80637030 03_elf_change_symbols.rst: fix typo 2021-06-28 15:22:32 +02:00
Romain 9a7636d0b3 Merge pull request #589 from jasperla/typo
Fix a few small textual mistakes
2021-06-23 06:53:06 +02:00
Romain b95919954b Merge pull request #591 from fanquake/fix_binary_hpp_typo
PE: fix typo in Binary.hpp
2021-06-23 06:52:47 +02:00
fanquake 8719fb6512 PE: fix typo in Binary.hpp 2021-06-23 11:09:11 +08:00
Jasper Lievisse Adriaanse 5a4c94cbba Fix a few small textual mistakes 2021-06-22 17:50:57 +02:00
Romain Thomas 4656539c2a Bump version of spdlog 2021-06-20 20:29:26 +02:00
Romain Thomas 96c15f7905 Fix typo 2021-06-16 05:37:47 +02:00
Romain Thomas 6db3be9ac1 Fix error when the virtual size is smaller than the raw size
See: sample 7636650863f29f8c7afaaf1fa396cfc46149f56d4de92d338766405aa0e28e3b
2021-06-16 04:40:09 +02:00
Romain Thomas 009306cedd Update section_from_{offset,va} to enable skipping SHT_NOBITS 2021-06-13 06:56:32 +02:00
Romain Thomas 7f557695ba Resolve #586 2021-06-09 05:18:28 +02:00
Romain Thomas ddf5f4b82d Add PE imports/exports as abstracted symbols 2021-06-06 08:18:27 +02:00
Romain Thomas 7d54afdbd1 fix typo 2021-06-06 06:56:38 +02:00
Romain Thomas 5edd16f5af Fix typo 2021-06-06 06:42:41 +02:00
Romain Thomas 61c0fd761f Merge pull request #584 2021-06-06 06:41:05 +02:00
Koh M. Nakagawa 996301623b Handle non-ascii strings and handle non-hex inputs in `ResourcesManager::get_string_file_info`
Ref: pr #584
2021-06-06 06:38:34 +02:00
Romain Thomas 1d63c60ee8 Add missing functions 2021-05-31 05:34:18 +02:00
Romain Thomas 672d73f1cb Add crashpad note 2021-05-30 20:38:30 +02:00
Romain Thomas d9303f682c Enable to add object relocations 2021-05-30 20:17:13 +02:00
Romain Thomas 77fc9b92af Resolve #582 2021-05-30 18:11:09 +02:00
Romain Thomas 9ef590fb99 Remove verbose flag 2021-05-26 05:56:49 +02:00
Romain Thomas 71a7b4bf83 Change class initialization 2021-05-26 05:41:48 +02:00
Romain Thomas ca33644c1a Update docker scripts 2021-05-25 06:52:30 +02:00
Romain Thomas c35a0b9a64 Update references 2021-05-25 06:50:12 +02:00
Romain Thomas 5e491b37df Add XMachOViewer 2021-05-25 06:33:52 +02:00
Romain Thomas 4d7c106d1d Fix tests 2021-05-24 19:09:29 +02:00
Romain Thomas 9e62e9e019 Enable to export symbols from static libLIEF.a 2021-05-24 19:07:30 +02:00
Romain Thomas d0e19509b5 Update changelog 2021-05-23 06:45:01 +02:00
1331 changed files with 77516 additions and 48395 deletions
-139
View File
@@ -1,139 +0,0 @@
version: 0.7.{build}
image: Visual Studio 2019
clone_folder: c:\projects\lief
configuration: Release
services:
- docker
platform:
- x86
- x64
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 3.6
- PYTHON_VERSION: "3.6"
PYTHON32_PATH: "C:\\Python36"
PYTHON32_INCLUDE: "C:\\Python36\\include"
PYTHON32_BINARY: "C:\\Python36\\python.exe"
PYTHON32_LIBRARY: "C:\\Python36\\libs\\python36.lib"
PYTHON64_PATH: "C:\\Python36-x64"
PYTHON64_INCLUDE: "C:\\Python36-x64\\include"
PYTHON64_BINARY: "C:\\Python36-x64\\python.exe"
PYTHON64_LIBRARY: "C:\\Python36-x64\\libs\\python36.lib"
# 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"
# 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_INCLUDE = $env:PYTHON64_INCLUDE }
- 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_INCLUDE = $env:PYTHON32_INCLUDE }
- 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:
- 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:
- 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: 'dist\*.whl'
name: python-wheel
- path: 'build\*.zip'
name: sdk
#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
@@ -1,62 +0,0 @@
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" ]
+35
View File
@@ -0,0 +1,35 @@
Checks: >
-*,
bugprone-*,
google-*,
misc-*,
modernize-*,
performance-*,
portability-*,
readability-*,
cppcoreguidelines-*,
-bugprone-easily-swappable-parameters,
-bugprone-narrowing-conversions,
-google-readability-namespace-comments,
-google-readability-todo,
-google-runtime-int,
-google-default-arguments
-google-runtime-references,
-misc-non-private-member-variables-in-classes,
-modernize-use-trailing-return-type,
-performance-noexcept-move-constructor,
-readability-function-cognitive-complexity,
-readability-inconsistent-declaration-parameter-name,
-readability-magic-numbers,
-readability-named-parameter,
-readability-redundant-string-cstr
-readability-uppercase-literal-suffix,
# Turn all the warnings from the checks above into errors.
#WarningsAsErrors: "*"
UseColor: false
CheckOptions:
- { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ }
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
+12
View File
@@ -0,0 +1,12 @@
---
name: Feature Request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
*Please describe what you would like to have in LIEF*.
**Note: If the feature is not precise or if you want to have feedback first, you can open a [discussion](https://github.com/lief-project/LIEF/discussions).**
-20
View File
@@ -1,20 +0,0 @@
---
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.
+33
View File
@@ -0,0 +1,33 @@
---
name: Premium Issue
about: You need a fix for the issue with a high priority
title: ''
labels: Premium
assignees: romainthomas
---
*Premium issues can be used to get a higher priority resolution for users and companies.*
*In return, you need to contribute to the project with an action:*
- Writing a guest blog post here: https://lief-project.github.io/blog/
- Fixing another issue
- Sponsoring the issue
*Premium issues will be highlighted in the changelog and the release blog post with your name/logo*
----------------------------------
**Description**
*Please describe the issue/request that needs to be addressed*
**Context**
*Please provide the version of LIEF, the operating system as well as the binaries associated with the issue
(it can be sent by email as well)*
----------------------------------
**Reach out to `issue@lief.re` to discuss about the timeline/contribution.**
@@ -1,6 +1,6 @@
---
name: Bug report
about: Create a report to help us improve
name: Regular Issue
about: You identified a bug or a problem in LIEF
title: ''
labels: ''
assignees: romainthomas
@@ -14,7 +14,7 @@ A clear and concise description of what the bug is.
Steps to reproduce the behavior:
**Expected behavior**
A clear and concise description of what you expected to happen.
A clear and concise description of what you expected to happen (if applicable)
**Environment (please complete the following information):**
- System and Version : [e.g. Ubuntu 16.04]
+113 -238
View File
@@ -7,9 +7,14 @@ import pathlib
import subprocess
import shutil
import json
import itertools
from collections import defaultdict
from datetime import datetime
from mako.template import Template
from enum import Enum, auto
import tempfile
import boto3
from botocore.exceptions import ClientError
class CI(Enum):
UNKNOWN = auto()
@@ -96,7 +101,7 @@ def get_tag(ci):
logger.critical("Unsupported CI to resolve working directory")
sys.exit(1)
LOG_LEVEL = logging.DEBUG
LOG_LEVEL = logging.INFO
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
logging.getLogger().setLevel(LOG_LEVEL)
@@ -119,7 +124,6 @@ elif os.getenv("CI_LOCAL", "") == "true":
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)
@@ -128,9 +132,13 @@ 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:
if BRANCH_NAME.startswith("release-"):
logger.info("Branch release")
elif BRANCH_NAME not in ALLOWED_BRANCHES and not IS_TAGGED:
logger.info("Skip deployment for branch '%s'", BRANCH_NAME)
sys.exit(0)
@@ -141,267 +149,134 @@ if is_pr(CURRENT_CI):
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)
# According to Scaleway S3 documentation, the endpoint
# should starts with '<bucket>'.s3.<region>.scw.cloud
# Nevertheless boto3 uses /{Bucket} endpoints suffix
# which create issues (see: https://stackoverflow.com/a/70383653)
LIEF_S3_REGION = "fr-par"
LIEF_S3_ENDPOINT = "https://s3.{region}.scw.cloud".format(region=LIEF_S3_REGION)
LIEF_S3_BUCKET = "lief"
LIEF_S3_KEY = os.getenv("LIEF_S3_KEY", None)
LIEF_S3_SECRET = os.getenv("LIEF_S3_SECRET", None)
if DEPLOY_KEY is None or len(DEPLOY_KEY) == 0:
logger.error("Deploy key is not set!")
if LIEF_S3_KEY is None or len(LIEF_S3_KEY) == 0:
logger.error("LIEF_S3_KEY is not set!")
sys.exit(1)
if DEPLOY_IV is None or len(DEPLOY_IV) == 0:
logger.error("Deploy IV is not set!")
if LIEF_S3_SECRET is None or len(LIEF_S3_SECRET) == 0:
logger.error("LIEF_S3_SECRET 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")
logger.error("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"
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)
logger.info("Working directory: %s", CI_CWD)
INDEX_TEMPLATE = r"""
<!DOCTYPE html>
<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 />
% for path, filename in files:
<a href="/${path}">${filename}</a><br />
% endfor
</body>
</html>
"""
EXCLUDED = ['index.html', '.gitkeep']
BASE_URL = "https://lief-project.github.io"
SKIP_LIST = ["index.html"]
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)
s3 = boto3.resource(
's3',
region_name=LIEF_S3_REGION,
use_ssl=True,
endpoint_url=LIEF_S3_ENDPOINT,
aws_access_key_id=LIEF_S3_KEY,
aws_secret_access_key=LIEF_S3_SECRET
)
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)
def push_wheel(file: str, dir_name: str):
wheel_file = pathlib.Path(file)
dst = f"{dir_name}/lief/{wheel_file.name}"
logger.info("Uploading %s to %s", file, dst)
try:
obj = s3.Object(LIEF_S3_BUCKET, dst)
obj.put(Body=wheel_file.read_bytes())
return 0
except ClientError as e:
logger.error("S3 push failed: %s", e)
return 1
output_key_path.unlink()
def push_sdk(file: str, dir_name: str):
sdk_file = pathlib.Path(file)
dst = f"{dir_name}/sdk/{sdk_file.name}"
logger.info("Uploading %s to %s", file, dst)
try:
obj = s3.Object(LIEF_S3_BUCKET, dst)
obj.put(Body=sdk_file.read_bytes())
return 0
except ClientError as e:
logger.error("S3 push failed: %s", e)
return 1
def filename(object):
return pathlib.Path(object.key).name
def generate_sdk_index(dir_name: str):
files = s3.Bucket(LIEF_S3_BUCKET).objects.filter(Prefix=f'{dir_name}/sdk')
tmpl_info = [(object.key, filename(object)) for object in files if filename(object) not in SKIP_LIST]
html = Template(INDEX_TEMPLATE).render(files=tmpl_info)
return html
def generate_pypi_index(dir_name: str):
files = s3.Bucket(LIEF_S3_BUCKET).objects.filter(Prefix=f'{dir_name}/lief')
tmpl_info = [(object.key, filename(object)) for object in files if filename(object) not in SKIP_LIST]
html = Template(INDEX_TEMPLATE).render(files=tmpl_info)
return html
dir_name = "latest"
if BRANCH_NAME != "master":
dir_name = "{}".format(BRANCH_NAME.replace("/", "-").replace("_", "-"))
if BRANCH_NAME.startswith("release-"):
_, dir_name = BRANCH_NAME.split("release-")
if IS_TAGGED:
dir_name = str(TAG_NAME)
logger.info("Destination directory: %s", dir_name)
for file in DIST_DIR.glob("*.whl"):
logger.info("[WHEEL] Uploading '%s'", file.as_posix())
push_wheel(file.as_posix(), dir_name)
for file in itertools.chain(BUILD_DIR.glob("*.zip"), BUILD_DIR.glob("*.tar.gz")):
logger.info("[SDK ] Uploading '%s'", file.as_posix())
push_sdk(file.as_posix(), dir_name)
sdk_index = generate_sdk_index(dir_name)
with tempfile.TemporaryDirectory() as tmp:
tmp = pathlib.Path(tmp)
index = (tmp / "index.html")
index.write_text(sdk_index)
push_sdk(index.as_posix(), dir_name)
pypi_index = generate_pypi_index(dir_name)
with tempfile.TemporaryDirectory() as tmp:
tmp = pathlib.Path(tmp)
index = (tmp / "index.html")
index.write_text(pypi_index)
push_wheel(index.as_posix(), dir_name)
logger.info("Done!")
Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

+11 -5
View File
@@ -14,7 +14,7 @@ jobs:
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
uses: actions/cache@v3
with:
path: ~/.ccache
key: android-${{ runner.os }}-${{ steps.get-date.outputs.date }}
@@ -42,10 +42,16 @@ jobs:
-v $GITHUB_WORKSPACE:/work \
-v $HOME/.ccache:/ccache \
--rm liefproject/android-arm64 bash /work/scripts/docker/android-aarch64.sh
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: android-sdk
path: build/*.tar.gz
retention-days: 3
- name: Deploy
env:
LIEF_AUTOMATIC_BUILDS_KEY: ${{ secrets.LIEF_AUTOMATIC_BUILDS_KEY }}
LIEF_AUTOMATIC_BUILDS_IV: ${{ secrets.LIEF_AUTOMATIC_BUILDS_IV }}
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
shell: bash
run: |
docker run \
@@ -54,8 +60,8 @@ jobs:
-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 \
-e LIEF_S3_KEY=$LIEF_S3_KEY \
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
--rm \
liefproject/deploy python3 /src/.github/deploy.py
+10 -4
View File
@@ -26,7 +26,7 @@ jobs:
run: |
mkdir -p ~/.ccache
- name: ccache cache files
uses: actions/cache@v1.1.0
uses: actions/cache@v3
with:
path: ~/.ccache
key: ios-${{ runner.os }}-${{ steps.get-date.outputs.date }}
@@ -41,13 +41,19 @@ jobs:
CCACHE_COMPRESS: 1
run: |
bash scripts/osx/package_ios.sh
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: ios-sdk
path: build/*.tar.gz
retention-days: 3
- name: Deploy
env:
LIEF_AUTOMATIC_BUILDS_KEY: ${{ secrets.LIEF_AUTOMATIC_BUILDS_KEY }}
LIEF_AUTOMATIC_BUILDS_IV: ${{ secrets.LIEF_AUTOMATIC_BUILDS_IV }}
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
shell: bash
run: |
python -m pip install --upgrade requests mako
python -m pip install --upgrade requests mako boto3
python .github/deploy.py
+40 -27
View File
@@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.8, 3.9, '3.10', '3.11']
steps:
- uses: actions/checkout@v2
with:
@@ -17,7 +17,7 @@ jobs:
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
uses: actions/cache@v3
with:
path: ~/.ccache
key: linux-aarch64-${{ runner.os }}-${{ steps.get-date.outputs.date }}
@@ -27,13 +27,13 @@ jobs:
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 \
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
@@ -41,30 +41,43 @@ jobs:
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 \
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 \
-v $GITHUB_WORKSPACE:/work \
-v $HOME/.ccache:/ccache \
--rm liefproject/manylinux2014-aarch64 bash /work/scripts/docker/manylinux2014-aarch64.sh
- name: 'Upload SDK Artifact'
if: matrix.python-version == '3.9'
uses: actions/upload-artifact@v3
with:
name: linux-aarch64-sdk
path: build/*.tar.gz
retention-days: 3
- name: 'Upload Python Wheel Artifact - ${{ matrix.python-version }}'
uses: actions/upload-artifact@v3
with:
name: linux-aarch64-wheel-${{ matrix.python-version }}
path: dist/*.whl
retention-days: 3
- name: Deploy
env:
LIEF_AUTOMATIC_BUILDS_KEY: ${{ secrets.LIEF_AUTOMATIC_BUILDS_KEY }}
LIEF_AUTOMATIC_BUILDS_IV: ${{ secrets.LIEF_AUTOMATIC_BUILDS_IV }}
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
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 \
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_S3_KEY=$LIEF_S3_KEY \
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
--rm \
liefproject/deploy python3 /src/.github/deploy.py
+91 -55
View File
@@ -14,92 +14,128 @@ jobs:
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
uses: actions/cache@v3
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
- name: Build Python 3.8 wheel & test
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
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/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux_test.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/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux.sh
- name: Build Python 3.10 wheel
shell: bash
env:
PYTHON_VERSION: 310
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/cp310-cp310/bin/python3.10 \
-v $GITHUB_WORKSPACE:/src \
-v $HOME/.ccache:/ccache \
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux.sh
- name: Test LIEF on Archlinux
shell: bash
env:
PYTHON_VERSION: 310
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
liefproject/archlinux bash /src/scripts/docker/run_archlinux.sh
- name: Build Python 3.11 wheel
shell: bash
env:
PYTHON_VERSION: 311
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/cp311-cp311/bin/python3.11 \
-v $GITHUB_WORKSPACE:/src \
-v $HOME/.ccache:/ccache \
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_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
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/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux_sdk.sh
- name: 'Upload SDK Artifact'
uses: actions/upload-artifact@v3
with:
name: linux-x86-64-sdk
path: build/*.tar.gz
retention-days: 3
- name: 'Upload SDK Artifact'
uses: actions/upload-artifact@v3
with:
name: linux-x86-64-python-wheel
path: dist/*.whl
retention-days: 3
- name: Deploy
env:
LIEF_AUTOMATIC_BUILDS_KEY: ${{ secrets.LIEF_AUTOMATIC_BUILDS_KEY }}
LIEF_AUTOMATIC_BUILDS_IV: ${{ secrets.LIEF_AUTOMATIC_BUILDS_IV }}
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
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 \
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_S3_KEY=$LIEF_S3_KEY \
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
--rm \
liefproject/deploy python3 /src/.github/deploy.py
- name: Trigger documentation
if: github.ref == 'refs/heads/master'
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 \
liefproject/manylinux_2_28_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'";
+66
View File
@@ -0,0 +1,66 @@
name: 'macOS-arm64'
on:
push:
tags:
- '**'
workflow_dispatch:
jobs:
osx-sdk:
runs-on: macos-11.0
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- 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@v3
with:
path: ~/.ccache
key: osx-${{ runner.os }}-${{ steps.get-date.outputs.date }}
restore-keys: |
osx-${{ runner.os }}-
- name: Upgrade pip
shell: bash
run: |
python -m pip install --upgrade pip setuptools
- name: Build SDK
shell: bash
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
CCACHE_DIR: ~/.ccache
CCACHE_MAXSIZE: 10.0G
CCACHE_CPP2: 1
CCACHE_COMPRESS: 1
run: |
bash scripts/osx/package_sdk_aarch64.sh
- name: 'Upload SDK Artifact'
uses: actions/upload-artifact@v3
with:
name: osx-sdk
path: build/*.tar.gz
retention-days: 3
- name: Deploy
env:
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
shell: bash
run: |
python -m pip install --upgrade requests mako boto3
python .github/deploy.py
+69 -14
View File
@@ -6,13 +6,13 @@ jobs:
runs-on: macos-11.0
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.8, 3.9, '3.10', '3.11.0']
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
@@ -29,15 +29,42 @@ jobs:
run: |
mkdir -p ~/.ccache
- name: ccache cache files
uses: actions/cache@v1.1.0
uses: actions/cache@v3
with:
path: ~/.ccache
key: osx-${{ runner.os }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.date }}
key: osx-${{ runner.os }}-${{ steps.get-date.outputs.date }}
restore-keys: |
osx-${{ runner.os }}-${{ matrix.python-version }}-
osx-${{ runner.os }}-
- name: Build Python ${{ matrix.python-version }} wheel
- name: Upgrade pip
shell: bash
run: |
python -m pip install --upgrade pip setuptools
#
# Run LIEF tests on Python 3.8 (only)
# ========================================
- name: Build Python ${{ matrix.python-version }} wheel & test
shell: bash
if: matrix.python-version == '3.8'
env:
LIEF_SAMPLES_DIR: "/tmp/samples"
MACOSX_DEPLOYMENT_TARGET: "10.14"
CCACHE_DIR: ~/.ccache
CCACHE_MAXSIZE: 10.0G
CCACHE_CPP2: 1
CCACHE_COMPRESS: 1
run: |
python -m pip install pytest requests
python tests/dl_samples.py ${LIEF_SAMPLES_DIR}
python -m pip -vv wheel --wheel-dir=dist/ api/python
python -m pip -vv install api/python
python ./tests/run_pytest.py
cmake -S . -B ./api/python/build/temp.macosx-10.15-x86_64-cpython-38 -DLIEF_TESTS=on
ninja -C ./api/python/build/temp.macosx-10.15-x86_64-cpython-38
python ./tests/run_tools_check.py ./api/python/build/temp.macosx-10.15-x86_64-cpython-38
ctest --output-on-failure --test-dir ./api/python/build/temp.macosx-10.15-x86_64-cpython-38
- name: Build Python ${{ matrix.python-version }} wheel (x86-64)
shell: bash
if: matrix.python-version != '3.8'
env:
MACOSX_DEPLOYMENT_TARGET: "10.14"
CCACHE_DIR: ~/.ccache
@@ -45,10 +72,28 @@ jobs:
CCACHE_CPP2: 1
CCACHE_COMPRESS: 1
run: |
python ./setup.py --ninja build bdist_wheel --skip-build --plat-name=macosx_${MACOSX_DEPLOYMENT_TARGET}_x86_64
python -m pip wheel --wheel-dir=dist/ api/python
#
# cross-compile for Apple M1 for Python >= 3.9
# ============================================
- name: Build Python ${{ matrix.python-version }} wheel (arm64)
shell: bash
if: matrix.python-version != '3.8'
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
CCACHE_DIR: ~/.ccache
CCACHE_MAXSIZE: 10.0G
CCACHE_CPP2: 1
CCACHE_COMPRESS: 1
run: |
PYLIEF_CONF="$(pwd)/scripts/osx/config-xcompile-arm64.toml" \
python -m pip -vv wheel --wheel-dir=dist/ api/python
#
# Build the SDK while running with Python 3.9 (only once)
# =======================================================
- name: Build SDK
shell: bash
if: matrix.python-version == '3.9' # Build the SDk only with Python 3.9
if: matrix.python-version == '3.9' # Build the SDD only with Python 3.9
env:
MACOSX_DEPLOYMENT_TARGET: "10.14"
CCACHE_DIR: ~/.ccache
@@ -57,14 +102,24 @@ jobs:
CCACHE_COMPRESS: 1
run: |
bash scripts/osx/package_sdk.sh
- name: 'Upload SDK Artifact'
if: matrix.python-version == '3.9' # Build the SDk only with Python 3.9
uses: actions/upload-artifact@v3
with:
name: osx-sdk
path: build/*.tar.gz
retention-days: 3
- name: 'Upload Python Wheel Artifact - ${{ matrix.python-version }}'
uses: actions/upload-artifact@v3
with:
name: osx-wheel-${{ matrix.python-version }}
path: dist/*.whl
retention-days: 3
- name: Deploy
env:
LIEF_AUTOMATIC_BUILDS_KEY: ${{ secrets.LIEF_AUTOMATIC_BUILDS_KEY }}
LIEF_AUTOMATIC_BUILDS_IV: ${{ secrets.LIEF_AUTOMATIC_BUILDS_IV }}
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
shell: bash
run: |
python -m pip install --upgrade requests mako
python -m pip install --upgrade requests mako boto3
python .github/deploy.py
+80
View File
@@ -0,0 +1,80 @@
name: LIEF PR
on: [pull_request, workflow_dispatch]
jobs:
osx:
runs-on: macos-11.0
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
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: Build with Python ${{ matrix.python-version }} & Test
shell: bash
env:
LIEF_SAMPLES_DIR: "/tmp/samples"
run: |
python -m pip install pytest requests
python tests/dl_samples.py ${LIEF_SAMPLES_DIR}
python -m pip -vv install api/python
python ./tests/run_pytest.py
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build & Test
shell: bash
env:
PYTHON_VERSION: 39
run: |
docker run --rm \
-e PYTHON_VERSION=$PYTHON_VERSION \
-e PYTHON_BINARY=/opt/python/cp39-cp39/bin/python3.9 \
-v $GITHUB_WORKSPACE:/src \
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux_test.sh
windows:
runs-on: windows-latest
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- 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: Set env variables
run: |
chcp 65001 #set code page to utf-8
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
- name: Build and Test
run: |
python -m pip install pytest requests
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
python -m pip -vv install api/python
python ./tests/run_pytest.py
shell: cmd
+50
View File
@@ -0,0 +1,50 @@
name: 'sanitize'
on:
push:
tags:
- '**'
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
jobs:
gcc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: compile
shell: bash
run: |
docker run --rm \
-e BUILD_DIR=/tmp/build_gcc \
-e SRC_DIR=/src \
-v $GITHUB_WORKSPACE:/src \
liefproject/sanity:latest bash /src/scripts/docker/gcc.sh
clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: compile
shell: bash
run: |
docker run --rm \
-e BUILD_DIR=/tmp/build_clang \
-e SRC_DIR=/src \
-v $GITHUB_WORKSPACE:/src \
liefproject/sanity:latest bash /src/scripts/docker/clang.sh
asan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: compile
shell: bash
run: |
docker run --rm \
-v $GITHUB_WORKSPACE:/src \
liefproject/sanity:latest bash /src/scripts/docker/asan_check.sh
+130
View File
@@ -0,0 +1,130 @@
name: LIEF Windows x64
on:
push:
branches:
- 'master'
- 'release-**'
tags:
- '**'
jobs:
build:
runs-on: windows-2019
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11.0']
fail-fast: false
env:
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
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 }}
architecture: x64
- name: Install system dependencies
run: |
choco install ninja
choco install sccache
python -m pip install --upgrade pip setuptools
python -m pip install wheel mako
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
shell: bash
- name: Save sccache
uses: actions/cache@v3
continue-on-error: false
with:
path: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
key: ${{ runner.os }}-x64-sccache-${{ steps.get-date.outputs.date }}
restore-keys: |
${{ runner.os }}-x64-sccache-
- name: Start sccache server
run: sccache --start-server
- name: Set env variables
run: |
chcp 65001 #set code page to utf-8
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
shell: cmd
- name: ⛓ Build Python ${{ matrix.python-version }} & Test
if: matrix.python-version == 3.8
run: |
python -m pip install pytest requests
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
python -m pip -vv wheel --wheel-dir=dist/ api/python
python -m pip -vv install api/python
python ./tests/run_pytest.py
python ./scripts/windows/run_ctest.py ./api/python/build/temp.win-amd64-cpython-38/Release
python ./tests/run_tools_check.py ./api/python/build/temp.win-amd64-cpython-38/Release
shell: cmd
- name: ❱ Build Python ${{ matrix.python-version }}
if: matrix.python-version != 3.8
run: |
python -m pip -vv wheel --wheel-dir=dist/ api/python
shell: cmd
- name: ❱ Build SDK
if: matrix.python-version == 3.9
run: |
python ./scripts/windows/package_sdk.py
- name: 'Upload SDK Artifact'
if: matrix.python-version == 3.9
uses: actions/upload-artifact@v3
with:
name: windows-x64-sdk
path: build/*.zip
retention-days: 3
- name: 'Upload Python Wheel Artifact - ${{ matrix.python-version }}'
uses: actions/upload-artifact@v3
with:
name: windows-x64-wheel-${{ matrix.python-version }}
path: dist/*.whl
retention-days: 3
- name: 📊 Print sccache stats
run: sccache --show-stats
- name: 🛑 Stop sccache server
run: sccache --stop-server || true
- name: Setup WSL
uses: Vampire/setup-wsl@v1
with:
distribution: Debian
use-cache: 'true'
wsl-shell-user: root
set-as-default: 'true'
wsl-conf: |
[automount]
options = "metadata"
additional-packages:
ca-certificates
curl
locales
python3 python3-pip
git
openssl
ssh
- shell: wsl-bash {0}
name: Deploy
env:
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
GITHUB_ACTIONS: "true"
GITHUB_WORKSPACE: ${{ env.GITHUB_WORKSPACE }}
GITHUB_REF: ${{ env.GITHUB_REF }}
GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
WSLENV: LIEF_S3_KEY:LIEF_S3_SECRET:GITHUB_ACTIONS:GITHUB_WORKSPACE:GITHUB_REF:GITHUB_REPOSITORY
run: |
python3 -m pip install --no-cache-dir --upgrade pip setuptools requests mako wheel boto3
python3 .github/deploy.py
+73
View File
@@ -0,0 +1,73 @@
name: LIEF Windows x64 Quick
on:
push:
branches:
- '**'
- '!master'
- '!release-**'
tags-ignore:
- "**"
jobs:
build:
runs-on: windows-2019
strategy:
matrix:
python-version: [3.9]
env:
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
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 }}
architecture: x64
- name: Install system dependencies
run: |
choco install ninja
choco install sccache
python -m pip install --upgrade pip setuptools
python -m pip install wheel mako
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
shell: bash
- name: Save sccache
uses: actions/cache@v3
continue-on-error: false
with:
path: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
key: ${{ runner.os }}-x64-sccache-${{ steps.get-date.outputs.date }}
restore-keys: |
${{ runner.os }}-x64-sccache-
- name: Start sccache server
run: sccache --start-server
- name: Set env variables
run: |
chcp 65001 #set code page to utf-8
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
shell: cmd
- name: ⛓ Build Python ${{ matrix.python-version }} & Test
run: |
python -m pip install pytest requests
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
python -m pip -vv install api/python
python ./tests/run_pytest.py
shell: cmd
- name: 📊 Print sccache stats
run: sccache --show-stats
- name: 🛑 Stop sccache server
run: sccache --stop-server || true
+131
View File
@@ -0,0 +1,131 @@
name: LIEF Windows x86
on:
push:
branches:
- 'master'
- 'release-**'
- 'devel'
tags:
- '**'
jobs:
build:
runs-on: windows-2019
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11.0']
fail-fast: false
env:
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x86
- name: Install system dependencies
run: |
choco install ninja
choco install sccache
python -m pip install --upgrade pip setuptools
python -m pip install wheel mako
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
shell: bash
- name: Save sccache
uses: actions/cache@v3
continue-on-error: false
with:
path: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
key: ${{ runner.os }}-x86-sccache-${{ steps.get-date.outputs.date }}
restore-keys: |
${{ runner.os }}-x86-sccache-
- name: Start sccache server
run: sccache --start-server
- name: Set env variables
run: |
chcp 65001 #set code page to utf-8
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
- name: Set env variables
run: |
chcp 65001 #set code page to utf-8
echo ("PYLIEF_CONF=" + $env:GITHUB_WORKSPACE + "/scripts/windows/config-win32.toml") >> $env:GITHUB_ENV
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
shell: cmd
- name: ⛓ Build Python ${{ matrix.python-version }} & Test
if: matrix.python-version == 3.8
run: |
python -m pip install pytest requests
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
python -m pip -vv wheel --wheel-dir=dist/ api/python
python -m pip -vv install api/python
python ./tests/run_pytest.py
shell: cmd
- name: ❱ Build Python ${{ matrix.python-version }}
if: matrix.python-version != 3.8
run: |
python -m pip -vv wheel --wheel-dir=dist/ api/python
shell: cmd
- name: ❱ Build SDK
if: matrix.python-version == 3.9
run: |
python ./scripts/windows/package_sdk.py
- name: 'Upload SDK Artifact'
if: matrix.python-version == 3.9
uses: actions/upload-artifact@v3
with:
name: windows-x86-sdk
path: build/*.zip
retention-days: 3
- name: 'Upload Python Wheel Artifact - ${{ matrix.python-version }}'
uses: actions/upload-artifact@v3
with:
name: windows-x86-wheel-${{ matrix.python-version }}
path: dist/*.whl
retention-days: 3
- name: 📊 Print sccache stats
run: sccache --show-stats
- name: 🛑 Stop sccache server
run: sccache --stop-server || true
- name: Setup WSL
uses: Vampire/setup-wsl@v1
with:
distribution: Debian
use-cache: 'true'
wsl-shell-user: root
set-as-default: 'true'
wsl-conf: |
[automount]
options = "metadata"
additional-packages:
ca-certificates
curl
locales
python3 python3-pip
git
openssl
ssh
- shell: wsl-bash {0}
name: Deploy
env:
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
GITHUB_ACTIONS: "true"
GITHUB_WORKSPACE: ${{ env.GITHUB_WORKSPACE }}
GITHUB_REF: ${{ env.GITHUB_REF }}
GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
WSLENV: LIEF_S3_KEY:LIEF_S3_SECRET:GITHUB_ACTIONS:GITHUB_WORKSPACE:GITHUB_REF:GITHUB_REPOSITORY
run: |
python3 -m pip install --no-cache-dir --upgrade pip setuptools requests mako wheel boto3
python3 .github/deploy.py
+73
View File
@@ -0,0 +1,73 @@
name: LIEF Windows x86 Quick
on:
push:
branches:
- '**'
- '!master'
- '!release-**'
tags-ignore:
- "**"
jobs:
build:
runs-on: windows-2019
strategy:
matrix:
python-version: [3.9]
env:
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
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 }}
architecture: x86
- name: Install system dependencies
run: |
choco install ninja
choco install sccache
python -m pip install --upgrade pip setuptools
python -m pip install wheel mako
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
shell: bash
- name: Save sccache
uses: actions/cache@v3
continue-on-error: false
with:
path: "C:\\Users\\runner\\AppData\\Local\\Mozilla\\sccache"
key: ${{ runner.os }}-x86-sccache-${{ steps.get-date.outputs.date }}
restore-keys: |
${{ runner.os }}-x86-sccache-
- name: Start sccache server
run: sccache --start-server
- name: Set env variables
run: |
chcp 65001 #set code page to utf-8
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
shell: cmd
- name: ⛓ Build Python ${{ matrix.python-version }} & Test
run: |
python -m pip install pytest requests
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
python -m pip -vv install api/python
python ./tests/run_pytest.py
shell: cmd
- name: 📊 Print sccache stats
run: sccache --show-stats
- name: 🛑 Stop sccache server
run: sccache --stop-server || true
-30
View File
@@ -1,30 +0,0 @@
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
+5
View File
@@ -0,0 +1,5 @@
build/
*.so
*.whl
lief.egg-info/
dist/
-322
View File
@@ -1,322 +0,0 @@
language: cpp
git:
depth: false
jobs:
include:
- 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
- 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
## 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
# 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
## 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
#branches:
# only:
# - master
notifications:
email:
on_success: never
on_failure: always
cache:
- 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:
- 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 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
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
+1 -1
View File
@@ -1,3 +1,3 @@
Authors:
Romain Thomas <rthomas@quarkslab.com>
Romain Thomas <me@romainthomas.fr> - Quarkslab
-1
View File
@@ -1,6 +1,5 @@
Changelog
=========
see doc/sphinx/changelog.rst
+317 -189
View File
@@ -1,12 +1,18 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.15)
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()
# Enable https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html
cmake_policy(SET CMP0091 NEW)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
if(WIN32)
include(ChooseMSVCCRT)
endif()
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
include(ExternalProject)
@@ -21,8 +27,8 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git"
include(LIEFGit)
else()
set(LIEF_VERSION_MAJOR "0")
set(LIEF_VERSION_MINOR "12")
set(LIEF_VERSION_PATCH "0")
set(LIEF_VERSION_MINOR "13")
set(LIEF_VERSION_PATCH "2")
endif()
# LIEF Project
@@ -32,6 +38,36 @@ project(
VERSION ${LIEF_VERSION_MAJOR}.${LIEF_VERSION_MINOR}.${LIEF_VERSION_PATCH})
message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION}")
# Select the MSVC runtime based on the LIEF_USE_CRT_XXX variable
if(MSVC)
foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
string(TOUPPER "${build_type}" build)
if(DEFINED "LIEF_USE_CRT_${build}")
set(runtime "${LIEF_USE_CRT_${build}}")
if(build_type STREQUAL Debug)
set(default_runtime MDd)
else()
set(default_runtime MD)
endif()
if(runtime AND NOT "${runtime}" STREQUAL "${default_runtime}")
if(runtime STREQUAL "MT")
set(runtime_library "MultiThreaded")
elseif(runtime STREQUAL "MD")
set(runtime_library "MultiThreadedDLL")
elseif(runtime STREQUAL "MTd")
set(runtime_library "MultiThreadedDebug")
elseif(runtime STREQUAL "MDd")
set(runtime_library "MultiThreadedDebugDLL")
else()
message(FATAL_ERROR "Unsupported value LIEF_USE_CRT_${build}=${runtime}")
endif()
message(STATUS "LIEF_CRT_${build}: ${runtime}")
set(CMAKE_MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}$<$<CONFIG:${build_type}>:${runtime_library}>")
endif()
endif()
endforeach()
endif()
# LIEF options
# =============
include(LIEFOptions)
@@ -50,7 +86,7 @@ if(LIEF_USE_CCACHE)
message(STATUS "Found ccache: ${CCACHE_FOUND}")
else()
find_program(SCCACHE_FOUND sccache)
if (SCCACHE_FOUND)
if(SCCACHE_FOUND)
set(CMAKE_C_COMPILER_LAUNCHER ${SCCACHE_FOUND})
set(CMAKE_CXX_COMPILER_LAUNCHER ${SCCACHE_FOUND})
message(STATUS "Found sccache: ${SCCACHE_FOUND}")
@@ -90,9 +126,6 @@ message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
# LIEF Source definition
# ======================
set_source_files_properties(${mbedtls_src_crypto} PROPERTIES GENERATED TRUE)
set_source_files_properties(${mbedtls_src_x509} PROPERTIES GENERATED TRUE)
set_source_files_properties(${mbedtls_src_tls} PROPERTIES GENERATED TRUE)
set(LIEF_PRIVATE_INCLUDE_DIR)
set(LIEF_PUBLIC_INCLUDE_DIR)
@@ -101,22 +134,20 @@ set(LIEF_PUBLIC_INCLUDE_FILES)
set(LIEF_PRIVATE_INCLUDE_FILES)
set(LIBLIEF_SOURCE_FILES
"${mbedtls_src_crypto}"
"${mbedtls_src_x509}"
"${mbedtls_src_tls}"
"${LIBFUZZER_SRC_FILES}"
"${CMAKE_CURRENT_SOURCE_DIR}/src/errors.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/hash_stream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/logging.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/exception.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/iostream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/internal_utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Object.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Object.tcc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Visitor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/BinaryStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/VectorStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/FileStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/MemoryStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/SpanStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/Convert.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/visitors/hash.cpp")
@@ -124,9 +155,9 @@ set(LIBLIEF_SOURCE_FILES
# ===============================
set(LIEF_INC_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/errors.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/span.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/ELF.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Abstract.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/exception.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/iostream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/iterators.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/LIEF.hpp"
@@ -141,10 +172,14 @@ set(LIEF_INC_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/visitor_macros.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/BinaryStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/VectorStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/FileStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/MemoryStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/SpanStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/Convert.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/internal_utils.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/hash_stream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/frozen.hpp")
"${CMAKE_CURRENT_SOURCE_DIR}/src/frozen.hpp"
)
set(LIEF_VISITOR_INCLUDE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/hash.hpp")
@@ -152,12 +187,14 @@ set(LIEF_VISITOR_INCLUDE_FILES
set(LIEF_INCLUDE_FILES ${LIEF_INC_FILES} ${LIEF_VISITOR_INCLUDE_FILES})
set(LIEF_JSON_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/visitors/json.cpp")
set(LIEF_JSON_HDR "${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/json.hpp"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/json.hpp")
set(LIEF_JSON_HDR "${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/json.hpp")
list(APPEND LIEF_INC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/json.hpp")
list(APPEND LIBLIEF_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/json_api.cpp")
if(LIEF_ENABLE_JSON)
list(APPEND LIBLIEF_SOURCE_FILES "${LIEF_JSON_SRC}")
list(APPEND LIEF_INC_FILES "${LIEF_JSON_HDR}")
list(APPEND LIEF_INC_FILES "${LIEF_JSON_HDR}")
endif()
source_group("Header Files" FILES ${LIEF_INC_FILES})
@@ -166,14 +203,41 @@ source_group("Source Files" FILES ${LIBLIEF_SOURCE_FILES})
source_group("Header Files\\visitors" FILES ${LIEF_VISITOR_INCLUDE_FILES})
add_library(LIB_LIEF ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES})
add_library(LIEF::LIEF ALIAS LIB_LIEF)
if(NOT LIEF_OPT_MBEDTLS_EXTERNAL)
set_source_files_properties(${mbedtls_src_crypto} PROPERTIES GENERATED TRUE)
set_source_files_properties(${mbedtls_src_x509} PROPERTIES GENERATED TRUE)
set_source_files_properties(${mbedtls_src_tls} PROPERTIES GENERATED TRUE)
target_sources(LIB_LIEF PRIVATE
"${mbedtls_src_crypto}"
"${mbedtls_src_x509}"
"${mbedtls_src_tls}")
source_group("mbedtls\\crypto" FILES ${mbedtls_src_crypto})
source_group("mbedtls\\x509" FILES ${mbedtls_src_x509})
source_group("mbedtls\\tls" FILES ${mbedtls_src_tls})
target_include_directories(
LIB_LIEF SYSTEM PRIVATE
"${MBEDTLS_INCLUDE_DIRS}"
"${MBEDTLS_SOURCE_DIR}/library"
)
add_dependencies(LIB_LIEF lief_mbed_tls)
else()
find_package(MbedTLS REQUIRED)
target_link_libraries(LIB_LIEF PRIVATE
MbedTLS::mbedcrypto
MbedTLS::mbedx509)
endif()
if(WINDOWS AND BUILD_SHARED_LIBS)
target_link_libraries(LIB_LIEF ws2_32)
endif()
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
add_compile_options(/bigobj)
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug AND WINDOWS)
@@ -228,16 +292,16 @@ endif()
# =====================
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_DISABLE_DEFAULT_LOGGER
SPDLOG_NO_EXCEPTIONS
SPDLOG_FUNCTION=)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_NO_EXCEPTIONS SPDLOG_NO_THREAD_ID)
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_NO_THREAD_ID)
endif()
# Frozen Configuration
# ====================
if(LIEF_FROZEN_ENABLED)
list(APPEND LIEF_PRIVATE_INCLUDE_DIR "${FROZEN_INCLUDE_DIR}")
endif()
# OAT part
@@ -288,75 +352,127 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/version.h.in"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/config.h" @ONLY)
list(APPEND LIEF_PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/"
list(APPEND LIEF_PUBLIC_INCLUDE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/"
"${CMAKE_CURRENT_BINARY_DIR}/include/")
list(APPEND LIEF_PRIVATE_INCLUDE_DIR "${LIEF_PUBLIC_INCLUDE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_BINARY_DIR}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/LIEF.pc.in ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/LIEF.pc.in ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
@ONLY)
# Grouping external projects
# ==========================
source_group("mbedtls\\crypto" FILES ${mbedtls_src_crypto})
source_group("mbedtls\\x509" FILES ${mbedtls_src_x509})
source_group("mbedtls\\tls" FILES ${mbedtls_src_tls})
# Library definition
# ==================
target_include_directories(
LIB_LIEF SYSTEM PRIVATE "${MBEDTLS_INCLUDE_DIRS}")
target_include_directories(
LIB_LIEF
PUBLIC "${LIEF_PUBLIC_INCLUDE_DIR}"
target_include_directories(LIB_LIEF
PUBLIC "$<BUILD_INTERFACE:${LIEF_PUBLIC_INCLUDE_DIR}>"
PRIVATE "${LIEF_PRIVATE_INCLUDE_DIR}")
if(LIEF_ENABLE_JSON)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/json.hpp
COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBJSON_SOURCE_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/
DEPENDS lief_libjson)
if(LIEF_OPT_NLOHMANN_JSON_EXTERNAL)
find_package(nlohmann_json REQUIRED)
target_link_libraries(LIB_LIEF PRIVATE nlohmann_json::nlohmann_json)
else()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/internal/nlohmann/json.hpp
COMMAND
${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/internal/nlohmann
COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBJSON_SOURCE_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/internal/nlohmann/
DEPENDS lief_libjson)
target_sources(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/json.hpp)
target_sources(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/internal/nlohmann/json.hpp)
target_include_directories(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/)
endif()
endif()
if(LIEF_FROZEN_ENABLED)
add_dependencies(LIB_LIEF lief_frozen)
if(LIEF_OPT_FROZEN_EXTERNAL)
find_package(frozen REQUIRED)
target_link_libraries(LIB_LIEF PRIVATE frozen::frozen)
else()
add_dependencies(LIB_LIEF lief_frozen)
target_include_directories(LIB_LIEF
PRIVATE "${FROZEN_INCLUDE_DIR}")
endif()
endif()
# =======================================
# Leaf
# =======================================
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/boost/leaf/all.hpp
COMMAND
${CMAKE_COMMAND} -E copy_directory ${LEAF_INCLUDE_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/
DEPENDS lief_leaf)
if(LIEF_EXTERNAL_LEAF)
message(STATUS "Using external LEAF version")
if(LIEF_EXTERNAL_LEAF_DIR)
message(STATUS "External LEAF include dir: ${LIEF_EXTERNAL_LEAF_DIR}")
target_include_directories(LIB_LIEF SYSTEM PUBLIC
"$<BUILD_INTERFACE:${LIEF_EXTERNAL_LEAF_DIR}>")
endif()
else()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/leaf.hpp
COMMAND
${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/
COMMAND
${CMAKE_COMMAND} -E copy_directory ${LEAF_SRC_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/
DEPENDS lief_leaf)
target_sources(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/boost/leaf/all.hpp)
target_sources(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/leaf.hpp)
endif()
# =======================================
# utfcpp
# =======================================
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/utfcpp/utf8.h
COMMAND
${CMAKE_COMMAND} -E copy_directory ${UTFCPP_INCLUDE_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/utfcpp
DEPENDS lief_utfcpp)
target_sources(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/utfcpp/utf8.h)
if(LIEF_OPT_UTFCPP_EXTERNAL)
find_package(utf8cpp REQUIRED)
target_link_libraries(LIB_LIEF PRIVATE utf8cpp)
else()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/internal/utfcpp/utf8.h
COMMAND
${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/internal/
COMMAND
${CMAKE_COMMAND} -E copy_directory ${UTFCPP_INCLUDE_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/internal/utfcpp
DEPENDS lief_utfcpp)
target_sources(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/internal/utfcpp/utf8.h)
endif()
# =======================================
# tcb/span
# =======================================
if(LIEF_EXTERNAL_SPAN)
message(STATUS "Using external tcb/span version")
if(LIEF_EXTERNAL_SPAN_DIR)
message(STATUS "External span include dir: ${LIEF_EXTERNAL_SPAN_DIR}")
target_include_directories(LIB_LIEF SYSTEM PUBLIC
"$<BUILD_INTERFACE:${LIEF_EXTERNAL_SPAN_DIR}>")
endif()
else()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/span.hpp
COMMAND
${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/
COMMAND
${CMAKE_COMMAND} -E copy_directory ${TCB_SPAN_SRC_DIR}/
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/
DEPENDS lief_span)
target_sources(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/span.hpp)
endif()
add_dependencies(LIB_LIEF lief_mbed_tls)
target_link_libraries(LIB_LIEF PRIVATE lief_spdlog)
if(ANDROID AND BUILD_SHARED_LIBS AND LIEF_LOGGING)
target_link_libraries(LIB_LIEF PUBLIC log)
endif()
# Flags definition
# ----------------
@@ -379,27 +495,15 @@ endif()
target_compile_definitions(LIB_LIEF PUBLIC -D_GLIBCXX_USE_CXX11_ABI=1)
# Enable support for MD2 and MD4 for parsing the Authenticode sigs of older
# executables. Also, some older signed executables use certs with the
# SpcSpAgencyInfo Critical Extension, which mbed TLS doesn't support, so set
# MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION to have it skip this
# extension.
add_definitions(-DMBEDTLS_MD2_C -DMBEDTLS_MD4_C -DMBEDTLS_PEM_PARSE_C
-DMBEDTLS_X509_CRT_PARSE_C -DMBEDTLS_PEM_WRITE_C
-DMBEDTLS_PKCS1_V15 -DMBEDTLS_PKCS1_V21
-DMBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION)
# ASAN - LSAN - TSAN - USAN
# ~~~
# LIEF Sanitizer options
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set(SANITIZER_FLAGS -fno-omit-frame-pointer -g -O1)
if(LIEF_ASAN)
message(STATUS "Address sanitizer enabled")
list(APPEND SANITIZER_FLAGS -fsanitize=address)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS -fsanitize=address)
set_property(TARGET LIB_LIEF
APPEND PROPERTY LINK_FLAGS -fsanitize=address)
target_link_libraries(LIB_LIEF INTERFACE asan)
endif()
@@ -407,10 +511,8 @@ if(LIEF_LSAN)
message(STATUS "Leak sanitizer enabled")
list(APPEND SANITIZER_FLAGS -fsanitize=leak)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS -fsanitize=leak)
set_property(TARGET LIB_LIEF
APPEND PROPERTY LINK_FLAGS -fsanitize=leak)
target_link_libraries(LIB_LIEF INTERFACE lsan)
endif()
@@ -419,63 +521,54 @@ if(LIEF_TSAN)
message(STATUS "Thread sanitizer enabled")
list(APPEND SANITIZER_FLAGS -fsanitize=thread)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS -fsanitize=thread)
set_property(TARGET LIB_LIEF
APPEND PROPERTY LINK_FLAGS -fsanitize=thread)
target_link_libraries(LIB_LIEF INTERFACE tsan)
endif()
if(LIEF_USAN)
message(STATUS "Undefined sanitizer enabled")
list(APPEND SANITIZER_FLAGS -fsanitize=undefined)
list(APPEND SANITIZER_FLAGS -fsanitize=undefined,null,alignment)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS -fsanitize=undefined)
set_property(TARGET LIB_LIEF
APPEND PROPERTY LINK_FLAGS -fsanitize=undefined,null,alignment)
target_link_options(LIB_LIEF PUBLIC -fsanitize=undefined,null,alignment)
target_link_libraries(LIB_LIEF INTERFACE ubsan)
target_link_libraries(LIB_LIEF PUBLIC ubsan -fsanitize=undefined,null,alignment)
endif()
if(LIEF_ASAN
OR LIEF_LSAN
OR LIEF_TSAN
OR LIEF_USAN)
target_compile_options(LIB_LIEF PRIVATE ${SANITIZER_FLAGS})
set(LIEF_SANITIZER OFF)
if(LIEF_ASAN OR LIEF_LSAN OR LIEF_TSAN OR LIEF_USAN)
set(LIEF_SANITIZER ON)
endif()
# Fuzzing
# ~~~
if(LIEF_SANITIZER)
message("LIEF Sanitizer enabled: ${SANITIZER_FLAGS}")
target_compile_options(LIB_LIEF PUBLIC ${SANITIZER_FLAGS})
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/tests/sanitizer")
endif()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Fuzzing options
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if(LIEF_FUZZING)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS ${FUZZING_LINKER_FLAGS})
set(FUZZING_FLAGS -fno-omit-frame-pointer -g -O2 -fsanitize=address,fuzzer-no-link)
set(FUZZING_LINKER_FLAGS -fsanitize=address,fuzzer-no-link)
set_property(TARGET LIB_LIEF
APPEND PROPERTY LINK_FLAGS ${FUZZING_LINKER_FLAGS})
target_compile_options(LIB_LIEF PRIVATE ${FUZZING_FLAGS})
target_link_libraries(LIB_LIEF asan pthread)
add_dependencies(LIB_LIEF lief_libfuzzer)
target_link_libraries(LIB_LIEF PUBLIC asan pthread)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/fuzzing")
endif()
# Compile Flags
# =============
include(LIEFCompilerFlags)
# Profiling flags
# ---------------
if(LIEF_PROFILING)
set(PROFILING_FLAGS
-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc
-fno-builtin-free -fno-omit-frame-pointer -g)
target_compile_options(LIB_LIEF PUBLIC ${PROFILING_FLAGS})
add_executable(elf_profiler profiling/elf_profiler.cpp)
target_compile_options(elf_profiler PUBLIC ${PROFILING_FLAGS})
target_link_libraries(elf_profiler PRIVATE LIB_LIEF)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/profiling")
endif()
# Coverage flags
@@ -486,7 +579,10 @@ if(LIEF_COVERAGE)
target_link_libraries(LIB_LIEF gcov)
endif()
set_target_properties(LIB_LIEF PROPERTIES OUTPUT_NAME LIEF CLEAN_DIRECT_OUTPUT 1)
set_target_properties(LIB_LIEF PROPERTIES
OUTPUT_NAME LIEF
EXPORT_NAME LIEF
CLEAN_DIRECT_OUTPUT 1)
# Set a default build type if none was specified
@@ -497,16 +593,14 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
"MinSizeRel" "RelWithDebInfo")
endif()
message(STATUS "Configuration Types: ${CMAKE_CONFIGURATION_TYPES}")
message(STATUS "Build Types: ${CMAKE_BUILD_TYPE}")
message(STATUS "Build Types: ${CMAKE_BUILD_TYPE}")
if(APPLE)
set_target_properties(LIB_LIEF PROPERTIES
MACOSX_RPATH ON
)
set_target_properties(LIB_LIEF PROPERTIES MACOSX_RPATH ON)
endif()
# API
@@ -533,22 +627,10 @@ if(LIEF_DOC)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/doc)
endif()
# Find Package Config
# ======================
configure_package_config_file(
LIEFConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
INSTALL_DESTINATION share/LIEF/cmake)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
# Post-build operations
# ======================
if (BUILD_SHARED_LIBS AND CMAKE_BUILD_TYPE MATCHES "Release")
if (UNIX AND NOT APPLE)
if(BUILD_SHARED_LIBS AND CMAKE_BUILD_TYPE MATCHES "Release")
if(UNIX AND NOT APPLE)
add_custom_command(
TARGET LIB_LIEF
COMMENT "Strip LIEF shared library"
@@ -557,7 +639,7 @@ if (BUILD_SHARED_LIBS AND CMAKE_BUILD_TYPE MATCHES "Release")
)
endif()
if (APPLE)
if(APPLE)
add_custom_command(
TARGET LIB_LIEF
COMMENT "Strip LIEF shared library"
@@ -567,55 +649,101 @@ if (BUILD_SHARED_LIBS AND CMAKE_BUILD_TYPE MATCHES "Release")
endif()
endif()
# Install Prefix
# ======================
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND UNIX)
if(UNIX AND NOT APPLE)
set(CMAKE_INSTALL_PREFIX
"/usr"
CACHE PATH "Install path prefix prepended on to install directories."
FORCE)
elseif(APPLE)
set(CMAKE_INSTALL_PREFIX
"/usr/local"
CACHE PATH "" FORCE)
# Generate install target and package
# =======================================
if (LIEF_INSTALL)
# Find Package Config
# ======================
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LIEFConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
@ONLY)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
# Install Prefix
# ======================
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND UNIX)
if(UNIX AND NOT APPLE)
set(CMAKE_INSTALL_PREFIX
"/usr"
CACHE PATH "Install path prefix prepended on to install directories."
FORCE)
elseif(APPLE)
set(CMAKE_INSTALL_PREFIX
"/usr/local"
CACHE PATH "" FORCE)
endif()
endif()
# Installation
# ======================
if(UNIX)
include(GNUInstallDirs)
set(CMAKE_INSTALL_LIBDIR "lib")
else()
if(WIN32)
set(CMAKE_INSTALL_LIBDIR "lib")
set(CMAKE_INSTALL_DATADIR "share")
set(CMAKE_INSTALL_INCLUDEDIR "include")
set(CMAKE_INSTALL_BINDIR "bin")
set(CMAKE_INSTALL_DATAROOTDIR "share")
message(STATUS "Setting installation destination on Windows to: ${CMAKE_INSTALL_PREFIX}")
else()
message(FATAL_ERROR "System not UNIX nor WIN32 - not implemented yet")
endif()
endif()
install(
TARGETS LIB_LIEF lief_spdlog
EXPORT LIEFExport
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(
DIRECTORY ${LIEF_PUBLIC_INCLUDE_DIR}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT headers
FILES_MATCHING
REGEX "(.*).(hpp|h|def|inc)$")
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/LIEF/cmake
COMPONENT config)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT libraries)
if(BUILD_SHARED_LIBS)
set(lib_type shared)
else()
set(lib_type static)
endif()
install(
EXPORT LIEFExport
NAMESPACE LIEF::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/LIEF/cmake
FILE LIEFExport-${lib_type}.cmake
COMPONENT config)
export(
EXPORT LIEFExport
NAMESPACE LIEF::
FILE LIEFExport-${lib_type}.cmake)
# Package
# ======================
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/package")
endif()
# Installation
# ======================
install(
TARGETS LIB_LIEF
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib COMPONENT libraries)
install(
DIRECTORY ${LIEF_PUBLIC_INCLUDE_DIR}
DESTINATION include
COMPONENT headers
FILES_MATCHING
REGEX "(.*).(hpp|h|def)$")
install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/FindLIEF.cmake
DESTINATION share/LIEF/cmake
COMPONENT CMakeScripts)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
DESTINATION share/LIEF/cmake
COMPONENT config)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
DESTINATION lib/pkgconfig
COMPONENT libraries)
export(TARGETS LIB_LIEF lief_spdlog FILE LIEFExport.cmake)
# Package
# ======================
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/package")
-21
View File
@@ -1,21 +0,0 @@
# 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 - 2021 R. Thomas
Copyright 2017 - 2021 Quarkslab
Copyright 2017 - 2023 R. Thomas
Copyright 2017 - 2023 Quarkslab
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
-4
View File
@@ -1,4 +0,0 @@
@PACKAGE_INIT@
set(LIEF_DIR "${PACKAGE_PREFIX_DIR}")
include("${CMAKE_CURRENT_LIST_DIR}/FindLIEF.cmake")
-26
View File
@@ -1,26 +0,0 @@
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 *
+58 -58
View File
@@ -7,28 +7,28 @@
<img src="https://img.shields.io/gitter/room/gitterHQ/gitter.svg?style=flat-square">
</a>
&nbsp;
<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 href="https://github.com/lief-project/LIEF/actions?query=workflow%3A%22Linux+x86-64%22">
<img alt="Linux x86-64 CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/linux-x86-64.yml?branch=master&label=Linux%20x86-64&logo=github">
</a>
&nbsp;
<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">
<img alt="Linux AArch64 CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/linux-aarch64.yml?branch=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">
<img alt="Android CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/android.yml?branch=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">
<img alt="macOS CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/osx.yml?branch=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">
<img alt="iOS CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/ios.yml?branch=master&label=iOS&logo=github">
</a>
&nbsp;
<a href="https://ci.appveyor.com/project/Romain/lief/branch/master">
<img alt="Windows CI status" src="https://img.shields.io/appveyor/build/Romain/LIEF/master?label=Windows&logo=appveyor">
<a href="https://github.com/lief-project/LIEF/actions/workflows/windows-x64-all.yml">
<img alt="Windows CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/windows-x64-all.yml?branch=master&label=Windows&logo=github">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/releases">
@@ -38,12 +38,20 @@
<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>
<br />
<p align="center">
<a href="https://lief-project.github.io/blog/"><b>Blog</b></a> •
<a href="https://lief-project.github.io/doc/latest/index.html"><b>Documentation</b></a> •
<a href="#about-A"><b>About</b></a>
</p>
<br />
# About
The purpose of this project is to provide a cross platform library which can parse, modify and abstract ELF, PE and MachO formats.
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:
@@ -58,22 +66,22 @@ Main features:
- [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)
- [Sphinx](https://lief-project.github.io/doc/stable/index.html)
- [Doxygen](https://lief-project.github.io/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)
- [Parse and manipulate formats](https://lief-project.github.io/doc/latest/tutorials/01_play_with_formats.html)
- [Create a PE from scratch](https://lief-project.github.io/doc/latest/tutorials/02_pe_from_scratch.html)
- [Play with ELF symbols](https://lief-project.github.io/doc/latest/tutorials/03_elf_change_symbols.html)
- [ELF Hooking](https://lief-project.github.io/doc/latest/tutorials/04_elf_hooking.html)
- [Infecting the plt/got](https://lief-project.github.io/doc/latest/tutorials/05_elf_infect_plt_got.html)
- [PE Hooking](https://lief-project.github.io/doc/latest/tutorials/06_pe_hooking.html)
- [PE Resources](https://lief-project.github.io/doc/latest/tutorials/07_pe_resource.html)
- [Transforming an ELF executable into a library](https://lief-project.github.io/doc/latest/tutorials/08_elf_bin2lib.html)
- [How to use frida on a non-rooted device](https://lief-project.github.io/doc/latest/tutorials/09_frida_lief.html)
- [Android formats](https://lief-project.github.io/doc/latest/tutorials/10_android_formats.html)
- [Mach-O modification](https://lief-project.github.io/doc/latest/tutorials/11_macho_modification.html)
- [ELF Coredump](https://lief-project.github.io/doc/latest/tutorials/12_elf_coredump.html)
- [PE Authenticode](https://lief-project.github.io/doc/latest/tutorials/13_pe_authenticode.html)
- [Contact](#contact)
- [About](#about)
- [Authors](#authors)
@@ -94,23 +102,25 @@ To install the latest **version** (release):
pip install lief
```
To install nightlty build:
To install nightly build:
```console
pip install [--user] --index-url https://lief.quarkslab.com/packages lief==0.12.0.dev0
pip install [--user] --index-url https://lief.s3-website.fr-par.scw.cloud/latest lief==0.13.0.dev0
```
### Packages
* **Nightly**: https://github.com/lief-project/packages/tree/gh-pages
* **v0.11.4**: https://github.com/lief-project/LIEF/releases/tag/0.11.4
- **Nightly**:
* SDK: https://lief.s3-website.fr-par.scw.cloud/latest/sdk
* Python Wheels: https://lief.s3-website.fr-par.scw.cloud/latest/lief
- **v0.12.3**: https://github.com/lief-project/LIEF/releases/tag/0.12.3
Here are guides to install or integrate LIEF:
* [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)
* [Python](https://lief-project.github.io/doc/latest/installation.html#python)
* [VisualStudio](https://lief-project.github.io/doc/latest/installation.html#visual-studio-integration)
* [XCode](https://lief-project.github.io/doc/latest/installation.html#xcode-integration)
* [CMake](https://lief-project.github.io/doc/latest/installation.html#cmake-integration)
## Getting started
@@ -139,27 +149,18 @@ print(binary)
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;
if (std::unique_ptr<const LIEF::ELF::Binary> elf = LIEF::ELF::Parser::parse("/bin/ls")) {
std::cout << *elf << '\n';
}
// 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;
if (std::unique_ptr<const LIEF::PE::Binary> pe = LIEF::PE::Parser::parse("C:\\Windows\\explorer.exe")) {
std::cout << *pe << '\n';
}
// 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;
if (std::unique_ptr<LIEF::MachO::FatBinary> macho = LIEF::MachO::Parser::parse("/bin/ls")) {
std::cout << *macho << '\n';
}
return 0;
@@ -188,14 +189,14 @@ int main(int argc, char** argv) {
## Documentation
* [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)
* [Main documentation](https://lief-project.github.io/doc/latest/index.html)
* [Tutorial](https://lief-project.github.io/doc/latest/tutorials/index.html)
* [API](https://lief-project.github.io/doc/latest/api/index.html)
* [Doxygen](https://lief-project.github.io/doc/latest/doxygen/index.html)
## Contact
* **Mail**: lief at quarkslab com
* **Mail**: contact at lief re
* **Gitter**: [lief-project](https://gitter.im/lief-project)
## About
@@ -206,19 +207,18 @@ Romain Thomas ([@rh0main](https://twitter.com/rh0main)) - [Quarkslab](https://ww
### License
LIEF is provided under the [Apache 2.0 license](https://github.com/lief-project/LIEF/blob/0.11.2/LICENSE).
LIEF is provided under the [Apache 2.0 license](https://github.com/lief-project/LIEF/blob/0.12.3/LICENSE).
### Bibtex
```latex
```bibtex
@MISC {LIEF,
author = "Romain Thomas",
title = "LIEF - Library to Instrument Executable Formats",
howpublished = "https://lief.quarkslab.com/",
month = "April",
year = "2017",
month = "apr",
year = "2017"
}
```
+10 -5
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ void init_c_binary(Elf_Binary_t* c_binary, Binary* binary) {
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();
const std::string& interp = binary->interpreter();
c_binary->interpreter = static_cast<char*>(malloc((interp.size() + 1) * sizeof(char)));
std::memcpy(
reinterpret_cast<void*>(const_cast<char*>(c_binary->interpreter)),
@@ -65,7 +65,12 @@ void init_c_binary(Elf_Binary_t* c_binary, Binary* binary) {
Elf_Binary_t* elf_parse(const char *file) {
Binary* binary = Parser::parse(file).release();
Elf_Binary_t* c_binary = static_cast<Elf_Binary_t*>(malloc(sizeof(Elf_Binary_t)));
if (binary == nullptr) {
return nullptr;
}
auto* 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);
return c_binary;
@@ -92,7 +97,7 @@ int elf_binary_save_header(Elf_Binary_t* binary) {
hdr.entrypoint(binary->header.entrypoint);
//TODO: identity
return true;
return 1;
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+1 -2
View File
@@ -32,8 +32,7 @@ set(LIEF_API_C_ELF_INCLUDE_FILES_C
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/Section.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/Segment.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/Symbol.h"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/ELF/structures.h"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/ELF/enums.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/enums.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/utils.h"
)
+34 -24
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ namespace ELF {
void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
it_dynamic_entries dyn_entries = binary->dynamic_entries();
Binary::it_dynamic_entries dyn_entries = binary->dynamic_entries();
c_binary->dynamic_entries = static_cast<Elf_DynamicEntry_t**>(
malloc((dyn_entries.size() + 1) * sizeof(Elf_DynamicEntry_t**)));
@@ -37,12 +37,12 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
case DYNAMIC_TAGS::DT_NEEDED:
{
Elf_DynamicEntry_Library_t* e = static_cast<Elf_DynamicEntry_Library_t*>(
auto* e = static_cast<Elf_DynamicEntry_Library_t*>(
malloc(sizeof(Elf_DynamicEntry_Library_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
e->name = dynamic_cast<DynamicEntryLibrary*>(&entry)->name().c_str();
e->name = reinterpret_cast<DynamicEntryLibrary*>(&entry)->name().c_str();
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
break;
@@ -50,12 +50,12 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
case DYNAMIC_TAGS::DT_SONAME:
{
Elf_DynamicEntry_SharedObject_t* e = static_cast<Elf_DynamicEntry_SharedObject_t*>(
auto* e = static_cast<Elf_DynamicEntry_SharedObject_t*>(
malloc(sizeof(Elf_DynamicEntry_SharedObject_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
e->name = dynamic_cast<DynamicSharedObject*>(&entry)->name().c_str();
e->name = reinterpret_cast<DynamicSharedObject*>(&entry)->name().c_str();
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
break;
@@ -63,12 +63,12 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
case DYNAMIC_TAGS::DT_RPATH:
{
Elf_DynamicEntry_Rpath_t* e = static_cast<Elf_DynamicEntry_Rpath_t*>(
auto* e = static_cast<Elf_DynamicEntry_Rpath_t*>(
malloc(sizeof(Elf_DynamicEntry_Rpath_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
e->rpath = dynamic_cast<DynamicEntryRpath*>(&entry)->name().c_str();
e->rpath = reinterpret_cast<DynamicEntryRpath*>(&entry)->name().c_str();
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
@@ -77,12 +77,12 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
case DYNAMIC_TAGS::DT_RUNPATH:
{
Elf_DynamicEntry_RunPath_t* e = static_cast<Elf_DynamicEntry_RunPath_t*>(
auto* e = static_cast<Elf_DynamicEntry_RunPath_t*>(
malloc(sizeof(Elf_DynamicEntry_RunPath_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
e->runpath = dynamic_cast<DynamicEntryRunPath*>(&entry)->name().c_str();
e->runpath = reinterpret_cast<DynamicEntryRunPath*>(&entry)->name().c_str();
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
@@ -93,12 +93,12 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
case DYNAMIC_TAGS::DT_FINI_ARRAY:
case DYNAMIC_TAGS::DT_PREINIT_ARRAY:
{
Elf_DynamicEntry_Array_t* e = static_cast<Elf_DynamicEntry_Array_t*>(
auto* e = static_cast<Elf_DynamicEntry_Array_t*>(
malloc(sizeof(Elf_DynamicEntry_Array_t)));
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();
const std::vector<uint64_t>& array = reinterpret_cast<DynamicEntryArray*>(&entry)->array();
e->array = static_cast<uint64_t*>(malloc((array.size() + 1) * sizeof(uint64_t)));
for (size_t i = 0; i < array.size(); ++i) {
e->array[i] = array[i];
@@ -111,16 +111,16 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
case DYNAMIC_TAGS::DT_FLAGS:
{
Elf_DynamicEntry_Flags_t* e = static_cast<Elf_DynamicEntry_Flags_t*>(
auto* e = static_cast<Elf_DynamicEntry_Flags_t*>(
malloc(sizeof(Elf_DynamicEntry_Flags_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
const DynamicEntryFlags::flags_list_t& flags = dynamic_cast<DynamicEntryFlags*>(&entry)->flags();
const DynamicEntryFlags::flags_list_t& flags = reinterpret_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);
auto it = std::begin(flags);
for (size_t i = 0; it != std::end(flags); ++i, ++it) {
e->flags[i] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS>(*it);
@@ -134,16 +134,16 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
case DYNAMIC_TAGS::DT_FLAGS_1:
{
Elf_DynamicEntry_Flags_t* e = static_cast<Elf_DynamicEntry_Flags_t*>(
auto* e = static_cast<Elf_DynamicEntry_Flags_t*>(
malloc(sizeof(Elf_DynamicEntry_Flags_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->value = entry.value();
const DynamicEntryFlags::flags_list_t& flags = dynamic_cast<DynamicEntryFlags*>(&entry)->flags();
const DynamicEntryFlags::flags_list_t& flags = reinterpret_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);
auto it = std::begin(flags);
for (size_t i = 0; it != std::end(flags); ++i, ++it) {
e->flags_1[i] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS_1>(*it);
@@ -162,9 +162,9 @@ 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 LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
c_binary->dynamic_entries[i]->tag = static_cast<uint64_t>(entry.tag());
c_binary->dynamic_entries[i]->value = entry.value();
break;
}
}
}
@@ -178,7 +178,7 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
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) {
for (size_t idx = 0; dynamic_entries[idx] != nullptr; ++idx) {
switch(static_cast<DYNAMIC_TAGS>(dynamic_entries[idx]->tag)) {
case DYNAMIC_TAGS::DT_NEEDED:
{
@@ -208,14 +208,24 @@ void destroy_dynamic_entries(Elf_Binary_t* c_binary) {
case DYNAMIC_TAGS::DT_FINI_ARRAY:
case DYNAMIC_TAGS::DT_PREINIT_ARRAY:
{
free(reinterpret_cast<Elf_DynamicEntry_Array_t*>(dynamic_entries[idx]));
Elf_DynamicEntry_Array_t* entry_array=reinterpret_cast<Elf_DynamicEntry_Array_t*>(dynamic_entries[idx]);
free(entry_array->array);
free(entry_array);
break;
}
case DYNAMIC_TAGS::DT_FLAGS:
{
Elf_DynamicEntry_Flags_t* entry_flags=reinterpret_cast<Elf_DynamicEntry_Flags_t*>(dynamic_entries[idx]);
free(entry_flags->flags);
free(entry_flags);
break;
}
case DYNAMIC_TAGS::DT_FLAGS_1:
{
free(reinterpret_cast<Elf_DynamicEntry_Flags_t*>(dynamic_entries[idx]));
Elf_DynamicEntry_Flags_t* entry_flags=reinterpret_cast<Elf_DynamicEntry_Flags_t*>(dynamic_entries[idx]);
free(entry_flags->flags_1);
free(entry_flags);
break;
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+4 -5
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,9 +16,8 @@
#include "LIEF/ELF/EnumToString.h"
#include "LIEF/ELF/EnumToString.hpp"
#include "LIEF/ELF/Structures.hpp"
#include "LIEF/ELF/structures.h"
#include "LIEF/ELF/enums.h"
#include "LIEF/ELF/enums.hpp"
extern "C"
{
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+7 -12
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ namespace LIEF {
namespace ELF {
void init_c_sections(Elf_Binary_t* c_binary, Binary* binary) {
it_sections sections = binary->sections();
Binary::it_sections sections = binary->sections();
c_binary->sections = static_cast<Elf_Section_t**>(
malloc((sections.size() + 1) * sizeof(Elf_Section_t**)));
@@ -27,14 +27,9 @@ void init_c_sections(Elf_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<Elf_Section_t*>(malloc(sizeof(Elf_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);
span<const uint8_t> section_content = b_section.content();
c_binary->sections[i]->name = b_section.name().c_str();
c_binary->sections[i]->name = b_section.fullname().c_str();
c_binary->sections[i]->flags = b_section.flags();
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();
@@ -44,9 +39,10 @@ void init_c_sections(Elf_Binary_t* c_binary, Binary* binary) {
c_binary->sections[i]->info = b_section.information();
c_binary->sections[i]->alignment = b_section.alignment();
c_binary->sections[i]->entry_size = b_section.entry_size();
c_binary->sections[i]->content = content;
c_binary->sections[i]->size = section_content.size();
c_binary->sections[i]->entropy = b_section.entropy();
c_binary->sections[i]->content = !section_content.empty() ?
const_cast<uint8_t*>(section_content.data()) : nullptr;
}
c_binary->sections[sections.size()] = nullptr;
@@ -58,7 +54,6 @@ void destroy_sections(Elf_Binary_t* c_binary) {
Elf_Section_t **sections = c_binary->sections;
for (size_t idx = 0; sections[idx] != nullptr; ++idx) {
free(sections[idx]->content);
free(sections[idx]);
}
free(c_binary->sections);
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+6 -11
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,18 +20,13 @@ namespace ELF {
void init_c_segments(Elf_Binary_t* c_binary, Binary* binary) {
it_segments segments = binary->segments();
Binary::it_segments segments = binary->segments();
c_binary->segments = static_cast<Elf_Segment_t**>(
malloc((segments.size() + 1) * sizeof(Elf_Segment_t**)));
for (size_t i = 0; i < segments.size(); ++i) {
Segment& segment = segments[i];
const std::vector<uint8_t>& segment_content = segment.content();
uint8_t* content = static_cast<uint8_t*>(malloc(segment_content.size() * sizeof(uint8_t)));
std::copy(
std::begin(segment_content),
std::end(segment_content),
content);
span<const uint8_t> segment_content = segment.content();
c_binary->segments[i] = static_cast<Elf_Segment_t*>(malloc(sizeof(Elf_Segment_t)));
c_binary->segments[i]->type = static_cast<enum LIEF_ELF_SEGMENT_TYPES>(segment.type());
@@ -41,7 +36,8 @@ void init_c_segments(Elf_Binary_t* c_binary, Binary* binary) {
c_binary->segments[i]->offset = segment.file_offset();
c_binary->segments[i]->alignment = segment.alignment();
c_binary->segments[i]->size = segment_content.size();
c_binary->segments[i]->content = content;
c_binary->segments[i]->content = !segment_content.empty() ?
const_cast<uint8_t*>(segment_content.data()) : nullptr;
}
c_binary->segments[segments.size()] = nullptr;
@@ -54,7 +50,6 @@ void destroy_segments(Elf_Binary_t* c_binary) {
Elf_Segment_t **segments = c_binary->segments;
for (size_t idx = 0; segments[idx] != nullptr; ++idx) {
free(segments[idx]->content);
free(segments[idx]);
}
free(c_binary->segments);
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ namespace LIEF {
namespace ELF {
void init_c_dynamic_symbols(Elf_Binary_t* c_binary, Binary* binary) {
it_symbols dyn_symb = binary->dynamic_symbols();
Binary::it_dynamic_symbols dyn_symb = binary->dynamic_symbols();
c_binary->dynamic_symbols = static_cast<Elf_Symbol_t**>(
malloc((dyn_symb.size() + 1) * sizeof(Elf_Symbol_t**)));
@@ -46,7 +46,7 @@ void init_c_dynamic_symbols(Elf_Binary_t* c_binary, Binary* binary) {
void init_c_static_symbols(Elf_Binary_t* c_binary, Binary* binary) {
it_symbols static_symb = binary->static_symbols();
Binary::it_static_symbols static_symb = binary->static_symbols();
c_binary->static_symbols = static_cast<Elf_Symbol_t**>(
malloc((static_symb.size() + 1) * sizeof(Elf_Symbol_t**)));
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+1 -2
View File
@@ -26,8 +26,7 @@ set(LIEF_API_C_MACHO_INCLUDE_FILES_CPP
set(LIEF_API_C_MACHO_INCLUDE_FILES_C
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/MachO/structures.h"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/MachO/enums.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/enums.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/Binary.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/EnumToString.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/Header.h"
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
namespace LIEF {
namespace MachO {
void init_c_commands(Macho_Binary_t* c_binary, Binary* binary) {
it_commands commands = binary->commands();
Binary::it_commands commands = binary->commands();
c_binary->commands = static_cast<Macho_Command_t**>(
malloc((commands.size() + 1) * sizeof(Macho_Command_t**)));
@@ -28,7 +28,7 @@ void init_c_commands(Macho_Binary_t* c_binary, Binary* binary) {
c_binary->commands[i] = static_cast<Macho_Command_t*>(malloc(sizeof(Macho_Command_t)));
const std::vector<uint8_t>& cmd_content = cmd.data();
uint8_t* content = static_cast<uint8_t*>(malloc(cmd_content.size() * sizeof(uint8_t)));
auto* content = static_cast<uint8_t*>(malloc(cmd_content.size() * sizeof(uint8_t)));
std::copy(
std::begin(cmd_content),
std::end(cmd_content),
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+22 -12
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,18 +24,28 @@
using namespace LIEF::MachO;
Macho_Binary_t** macho_parse(const char *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**)));
for (size_t i = 0; i < macho_binaries->size(); ++i) {
Binary& binary = (*macho_binaries)[i];
c_macho_binaries[i] = static_cast<Macho_Binary_t*>(malloc(sizeof(Macho_Binary_t)));
init_c_binary(c_macho_binaries[i], &binary);
FatBinary* fat = Parser::parse(file).release();
if (fat == nullptr) {
return nullptr;
}
c_macho_binaries[macho_binaries->size()] = nullptr;
size_t nb_bin = fat->size();
auto** c_macho_binaries = static_cast<Macho_Binary_t**>(
malloc((fat->size() + 1) * sizeof(Macho_Binary_t**)));
for (size_t i = 0; i < nb_bin; ++i) {
Binary* binary = fat->at(i);
if (binary != nullptr) {
c_macho_binaries[i] = static_cast<Macho_Binary_t*>(malloc(sizeof(Macho_Binary_t)));
init_c_binary(c_macho_binaries[i], binary);
}
}
fat->release_all_binaries();
c_macho_binaries[nb_bin] = nullptr;
delete fat;
return c_macho_binaries;
}
+10 -12
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,23 +18,21 @@
namespace LIEF {
namespace MachO {
void init_c_sections(Macho_Binary_t* c_binary, Binary* binary) {
it_sections sections = binary->sections();
Binary::it_sections sections = binary->sections();
c_binary->sections = static_cast<Macho_Section_t**>(
malloc((sections.size() + 1) * sizeof(Macho_Section_t**)));
for (size_t i = 0; i < sections.size(); ++i) {
Section& section = sections[i];
const Section& section = sections[i];
c_binary->sections[i] = static_cast<Macho_Section_t*>(malloc(sizeof(Macho_Section_t)));
const std::vector<uint8_t>& section_content = 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);
span<const uint8_t> section_content = section.content();
auto* content = static_cast<uint8_t*>(malloc(section_content.size() * sizeof(uint8_t)));
std::copy(std::begin(section_content), std::end(section_content),
content);
c_binary->sections[i]->name = section.name().c_str();
c_binary->sections[i]->name = section.fullname().c_str();
c_binary->sections[i]->alignment = section.alignment();
c_binary->sections[i]->relocation_offset = section.relocation_offset();
c_binary->sections[i]->numberof_relocations = section.numberof_relocations();
@@ -45,7 +43,7 @@ void init_c_sections(Macho_Binary_t* c_binary, Binary* binary) {
c_binary->sections[i]->reserved3 = section.reserved3();
c_binary->sections[i]->virtual_address = section.virtual_address();
c_binary->sections[i]->offset = section.offset();
c_binary->sections[i]->size = section.size();
c_binary->sections[i]->size = section_content.size();
c_binary->sections[i]->content = content;
c_binary->sections[i]->entropy = section.entropy();
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
namespace LIEF {
namespace MachO {
void init_c_segments(Macho_Binary_t* c_binary, Binary* binary) {
it_segments segments = binary->segments();
Binary::it_segments segments = binary->segments();
c_binary->segments = static_cast<Macho_Segment_t**>(
malloc((segments.size() + 1) * sizeof(Macho_Segment_t**)));
@@ -27,8 +27,8 @@ void init_c_segments(Macho_Binary_t* c_binary, Binary* binary) {
SegmentCommand& segment = segments[i];
c_binary->segments[i] = static_cast<Macho_Segment_t*>(malloc(sizeof(Macho_Segment_t)));
const std::vector<uint8_t>& segment_content = segment.content();
uint8_t* content = static_cast<uint8_t*>(malloc(segment_content.size() * sizeof(uint8_t)));
span<const uint8_t> segment_content = segment.content();
auto* content = static_cast<uint8_t*>(malloc(segment_content.size() * sizeof(uint8_t)));
std::copy(
std::begin(segment_content),
std::end(segment_content),
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,13 +18,13 @@
namespace LIEF {
namespace MachO {
void init_c_symbols(Macho_Binary_t* c_binary, Binary* binary) {
it_symbols symbols = binary->symbols();
Binary::it_symbols symbols = binary->symbols();
c_binary->symbols = static_cast<Macho_Symbol_t**>(
malloc((symbols.size() + 1) * sizeof(Macho_Symbol_t**)));
for (size_t i = 0; i < symbols.size(); ++i) {
Symbol& symbol = symbols[i];
const Symbol& symbol = symbols[i];
c_binary->symbols[i] = static_cast<Macho_Symbol_t*>(malloc(sizeof(Macho_Symbol_t)));
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+8 -3
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,12 @@ void init_c_binary(Pe_Binary_t* c_binary, Binary* binary) {
Pe_Binary_t* pe_parse(const char *file) {
Binary* binary = Parser::parse(file).release();
Pe_Binary_t* c_binary = static_cast<Pe_Binary_t*>(malloc(sizeof(Pe_Binary_t)));
if (binary == nullptr) {
return nullptr;
}
auto* 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+1 -2
View File
@@ -27,8 +27,7 @@ set(LIEF_API_C_PE_INCLUDE_FILES_CPP
)
set(LIEF_API_C_PE_INCLUDE_FILES_C
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/PE/structures.h"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/PE/enums.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/enums.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/Binary.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/DataDirectory.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/DosHeader.h"
+3 -3
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ namespace LIEF {
namespace PE {
void init_c_data_directories(Pe_Binary_t* c_binary, Binary* binary) {
it_data_directories data_directories = binary->data_directories();
Binary::it_data_directories data_directories = binary->data_directories();
c_binary->data_directories = static_cast<Pe_DataDirectory_t**>(
malloc((data_directories.size() + 1) * sizeof(Pe_DataDirectory_t**)));
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,11 +21,11 @@ namespace PE {
void init_c_imports(Pe_Binary_t* c_binary, Binary* binary) {
if (not binary->has_imports()) {
if (!binary->has_imports()) {
c_binary->imports = nullptr;
}
it_imports imports = binary->imports();
Binary::it_imports imports = binary->imports();
c_binary->imports = static_cast<Pe_Import_t**>(
malloc((imports.size() + 1) * sizeof(Pe_Import_t**)));
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 @@ namespace PE {
void init_c_import_entries(Pe_Import_t* c_import, Import& imp) {
it_import_entries entries = imp.entries();
Import::it_entries entries = imp.entries();
c_import->entries = static_cast<Pe_ImportEntry_t**>(
malloc((entries.size() + 1) * sizeof(Pe_ImportEntry_t**)));
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+8 -10
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ namespace LIEF {
namespace PE {
void init_c_sections(Pe_Binary_t* c_binary, Binary* binary) {
it_sections sections = binary->sections();
Binary::it_sections sections = binary->sections();
c_binary->sections = static_cast<Pe_Section_t**>(
malloc((sections.size() + 1) * sizeof(Pe_Section_t**)));
@@ -27,18 +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)));
std::vector<uint8_t> section_content = b_section.content();
span<const uint8_t> section_content = b_section.content();
uint8_t* content = nullptr;
if (section_content.size() > 0) {
if (!section_content.empty()) {
content = static_cast<uint8_t*>(malloc(section_content.size() * sizeof(uint8_t)));
std::move(
std::begin(section_content),
std::end(section_content),
content);
std::copy(std::begin(section_content), std::end(section_content),
content);
}
c_binary->sections[i]->name = b_section.name().c_str();
c_binary->sections[i]->name = b_section.fullname().c_str();
c_binary->sections[i]->virtual_address = b_section.virtual_address();
c_binary->sections[i]->size = b_section.size();
c_binary->sections[i]->offset = b_section.offset();
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
#ifndef C_LIEF_ELF_H_
#define C_LIEF_ELF_H_
//! @defgroup elf_c_api ELF C API
/** @defgroup elf_c_api ELF C API */
#include "LIEF/ELF/Binary.h"
#include "LIEF/ELF/Symbol.h"
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+21 -21
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,44 +34,44 @@ extern "C" {
#endif
struct Elf_DynamicEntry_t {
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
uint64_t tag;
uint64_t value;
};
struct Elf_DynamicEntry_Library_t {
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
const char* name;
uint64_t tag;
uint64_t value;
const char* name;
};
struct Elf_DynamicEntry_SharedObject_t {
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
const char* name;
uint64_t tag;
uint64_t value;
const char* name;
};
struct Elf_DynamicEntry_Array_t {
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
uint64_t* array;
uint64_t tag;
uint64_t value;
uint64_t* array;
};
struct Elf_DynamicEntry_Rpath_t {
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
const char* rpath;
uint64_t tag;
uint64_t value;
const char* rpath;
};
struct Elf_DynamicEntry_RunPath_t {
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
const char* runpath;
uint64_t tag;
uint64_t value;
const char* runpath;
};
struct Elf_DynamicEntry_Flags_t {
enum LIEF_ELF_DYNAMIC_TAGS tag;
uint64_t value;
uint64_t tag;
uint64_t value;
enum LIEF_ELF_DYNAMIC_FLAGS *flags;
enum LIEF_ELF_DYNAMIC_FLAGS_1 *flags_1;
};
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -6,11 +6,11 @@
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
#define _LIEF_EN(N) LIEF_ELF_##N
#define _LIEF_EN_2(N, TYPE) LIEF_ELF_##N
#define _LIEF_EI(X) LIEF_ELF_##X
@LIEF_ELF_ENUMS@
#include "LIEF/ELF/enums.inc"
#undef _LIEF_EN
#undef _LIEF_EN_2
-14
View File
@@ -1,14 +0,0 @@
#ifndef LIEF_ELF_C_STRUCTURES_H_
#define LIEF_ELF_C_STRUCTURES_H_
#ifdef __cplusplus
extern "C" {
#endif
@LIEF_ELF_STRUCTURES@
#ifdef __cplusplus
}
#endif
#endif
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
#ifndef C_LIEF_MACHO_H_
#define C_LIEF_MACHO_H_
//! @defgroup macho_c_api MachO C API
/** @defgroup macho_c_api MachO C API */
#include "LIEF/MachO/Binary.h"
#include "LIEF/MachO/Symbol.h"
+3 -4
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
* @{
*/
#include <stddef.h>
#include <stdint.h>
#include "LIEF/visibility.h"
@@ -33,7 +33,6 @@
#include "LIEF/MachO/Symbol.h"
#include "LIEF/MachO/Section.h"
#include "LIEF/MachO/Segment.h"
#include "LIEF/MachO/enums.h"
#ifdef __cplusplus
extern "C" {
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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 - 2021 R. Thomas
* Copyright 2017 - 2021 Quarkslab
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 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