From 9deaecd519312ce1b0abc424c45496ad5c6caf54 Mon Sep 17 00:00:00 2001 From: Dobin Rutishauser Date: Sun, 8 Jun 2025 11:23:23 +0200 Subject: [PATCH] fix: bad error handling for missing carrier imports --- pe/superpe.py | 2 +- supermega.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pe/superpe.py b/pe/superpe.py index 1448260..f54b5b5 100644 --- a/pe/superpe.py +++ b/pe/superpe.py @@ -247,7 +247,7 @@ class SuperPe(): for entry in iat[dll_name]: if entry.func_name == func_name: return entry.iat_vaddr - raise Exception(f"Function {func_name} not found in IAT") + return None def get_iat_entries(self) -> Dict[str, List[IatEntry]]: diff --git a/supermega.py b/supermega.py index d9d5beb..d5b3928 100644 --- a/supermega.py +++ b/supermega.py @@ -197,7 +197,10 @@ def start_real(settings: Settings): # CHECK if all are available in infectable, or abort (early check) functions = project.injectable.get_unresolved_iat() if len(functions) != 0 and settings.fix_missing_iat == False: - raise Exception("IAT entry not found: {}".format(", ".join(functions))) + logging.error("IAT entries not found in infectable: {}".format(", ".join(functions))) + logging.error("The carrier depends on these functions, but they are not available in the infectable exe.") + logging.error("Use another infectable exe, or update the carrier to not depend on these functions.") + raise Exception("Required carrier import not found in infectable: {}".format(", ".join(functions))) # ASSEMBLE: Assemble .asm to .shc (ASM -> SHC) carrier_shellcode: bytes = phases.assembler.asm_to_shellcode(