Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cle/backends/pe/pe.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@

import archinfo
import pefile
import pyxdia

try:
import pyxdia
except ImportError:
pyxdia = None

from cle.address_translator import AT
from cle.backends.backend import Backend, FunctionHint, FunctionHintSource, register_backend
Expand Down Expand Up @@ -215,6 +219,10 @@ def load_symbols_from_pdb(self, pdb_path):
"""
Load available symbols from PDB at `pdb_path`
"""
if pyxdia is None:
log.warning("PDB support is unavailable because pyxdia is not installed")
return

log.debug("Loading symbols from %s", pdb_path)
try:
pdb = pyxdia.PDB(pdb_path)
Expand Down
10 changes: 9 additions & 1 deletion cle/backends/uefi_firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
from uuid import UUID

import archinfo
import uefi_firmware

try:
import uefi_firmware
except ImportError:
uefi_firmware = None

from cle.errors import CLEUnknownFormatError

Expand Down Expand Up @@ -50,11 +54,15 @@ def _to_bytes(cls, fileobj: io.IOBase):

@classmethod
def is_compatible(cls, stream):
if uefi_firmware is None:
return False
buffer = cls._to_bytes(stream)
parser = uefi_firmware.AutoParser(buffer)
return parser.type() != "unknown"

def __init__(self, *args, **kwargs) -> None:
if uefi_firmware is None:
raise ImportError("The UEFI backend requires the uefi-firmware package")
super().__init__(*args, **kwargs)

# hack: we are using a loader internal method in a non-kosher way which will cause our children to be
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ dependencies = [
"pyelftools>=0.29",
"pyvex==9.3.1.dev0",
"pyxbe~=1.0.3",
"pyxdia~=0.1",
"pyxdia~=0.1; sys_platform != 'emscripten'",
"sortedcontainers>=2.0",
"uefi-firmware~=1.16",
"uefi-firmware~=1.16; sys_platform != 'emscripten'",
]

[project.readme]
Expand Down
Loading