From fbd886bd5e82dd9579b6d05bcc634cb139844c06 Mon Sep 17 00:00:00 2001 From: naksyn <59816245+naksyn@users.noreply.github.com> Date: Wed, 27 Sep 2023 02:13:52 -0700 Subject: [PATCH] Update __init__.py fixed check for non-existing section --- moduleshifting/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moduleshifting/__init__.py b/moduleshifting/__init__.py index 31de355..c14bdf2 100644 --- a/moduleshifting/__init__.py +++ b/moduleshifting/__init__.py @@ -528,6 +528,7 @@ class ModuleShifting(pe.PE): dll_size=self.hostingdllparsed.OPTIONAL_HEADER.SizeOfImage + self.tgtsectionaddr="" for section in self.hostingdllparsed.sections: if section.Name.decode().strip('\x00').lower() == self.tgtsection: self.tgtsectionaddr= section.VirtualAddress @@ -537,7 +538,7 @@ class ModuleShifting(pe.PE): if self.tgtsectionaddr: self.dbg('Found address of %s section %s: 0x%x with size 0x%x bytes', self.hostingdll._name, self.tgtsection, self.tgtsectionaddr, self.tgtsectionsize) else: - raise WindowsError('%s section on %s dll cannot be found', self.tgtsection, self.hostingdll._name) + raise OSError(f'[!] Error - {self.tgtsection} section on {self.hostingdll._name} dll cannot be found - check section name correctness') if not self.is_shellcode: if self.FP_bytes: