From 46190df764b7058e5e29f640f4573741cf6ed5c2 Mon Sep 17 00:00:00 2001 From: Christian Heitman Date: Thu, 4 Jul 2024 16:24:48 -0300 Subject: [PATCH] Fix LIEF memory issues --- libpastis/package.py | 12 +++--------- setup.py | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/libpastis/package.py b/libpastis/package.py index 77c6a13..127b1b9 100644 --- a/libpastis/package.py +++ b/libpastis/package.py @@ -10,12 +10,6 @@ import shutil import stat import lief -try: - # LIEF <= v0.13.2 - EXE_FORMATS = lief.EXE_FORMATS -except AttributeError: - # LIEF >= v0.14.0 - EXE_FORMATS = lief.Binary.FORMATS # local imports from libpastis.types import Arch, Platform @@ -276,9 +270,9 @@ def _read_binary_infos(file: Path) -> Optional[Tuple[Platform, Arch]]: arch = mapping.get(p.header.machine_type) # Determine the platform from its format - mapping_elf = {EXE_FORMATS.ELF: Platform.LINUX, - EXE_FORMATS.PE: Platform.WINDOWS, - EXE_FORMATS.MACHO: Platform.MACOS} + mapping_elf = {lief.Binary.FORMATS.ELF: Platform.LINUX, + lief.Binary.FORMATS.PE: Platform.WINDOWS, + lief.Binary.FORMATS.MACHO: Platform.MACOS} # FIXME: differentiating between ELF (Linux, Android ..) and MACHO (MacOS, iOS..) fmt = mapping_elf.get(p.format) diff --git a/setup.py b/setup.py index b9bc5b6..79a56f3 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ "pyzmq", "psutil", "aenum", - "lief", + "lief>=v0.14.0", "python-magic", "click", "coloredlogs", @@ -60,7 +60,7 @@ "matplotlib", "joblib", "rich", - "tritondse", + "tritondse>=v0.1.11", ], tests_require=[], license="AGPL-3.0",