Skip to content

Commit

Permalink
Merge pull request #12 from quarkslab/fix/lief-memory-issues
Browse files Browse the repository at this point in the history
Fix LIEF memory issues
  • Loading branch information
cnheitman committed Jul 4, 2024
2 parents 326ec6a + 46190df commit 481d02c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 3 additions & 9 deletions libpastis/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"pyzmq",
"psutil",
"aenum",
"lief",
"lief>=v0.14.0",
"python-magic",
"click",
"coloredlogs",
Expand All @@ -60,7 +60,7 @@
"matplotlib",
"joblib",
"rich",
"tritondse",
"tritondse>=v0.1.11",
],
tests_require=[],
license="AGPL-3.0",
Expand Down

0 comments on commit 481d02c

Please sign in to comment.