refactor: cleanup, create unittest, fix get_physical_address

This commit is contained in:
Dobin
2024-04-14 14:04:15 +01:00
parent b4671c8690
commit d4e4507e19
8 changed files with 90 additions and 47 deletions
+9
View File
@@ -51,8 +51,17 @@ class PeRelocEntry():
self.type: str = type
def __str__(self):
return "PeRelocEntry: rva: 0x{:X} base_rva: 0x{:X} offset: 0x{:X} type: {}".format(
self.rva, self.base_rva, self.offset, self.type)
class IatEntry():
def __init__(self, dll_name: str, func_name: str, iat_vaddr: int):
self.dll_name: str = dll_name
self.func_name: str = func_name
self.iat_vaddr: int = iat_vaddr
def __str__(self):
return "IatEntry: dll_name: {} func_name: {} iat_vaddr: 0x{:X}".format(
self.dll_name, self.func_name, self.iat_vaddr)
-6
View File
@@ -29,9 +29,6 @@ class ExeHost():
self.code_section = None
self.rwx_section = None
self.ep = None
self.ep_raw = None
def init(self):
logger.info("--[ Analyzing: {}".format(self.filepath))
@@ -40,9 +37,6 @@ class ExeHost():
if not self.superpe.is_64():
raise Exception("Binary is not 64bit: {}".format(self.filepath))
self.ep = self.superpe.get_entrypoint()
self.ep_raw = self.superpe.get_physical_address(self.ep)
# image base
self.image_base = self.superpe.pe.OPTIONAL_HEADER.ImageBase