refactor: fix a bug and cleanup

This commit is contained in:
Dobin
2024-03-16 14:16:39 +00:00
parent 057f85e2bc
commit 2e491272c9
4 changed files with 18 additions and 6 deletions
+4
View File
@@ -132,8 +132,12 @@ class SuperPe():
iat[dll_name].append(IatEntry(dll_name, imp_name, imp_addr))
return iat
def write_code_section_data(self, data: bytes):
sect = self.get_code_section()
if len(data) != sect.SizeOfRawData:
logger.error(f'New code section data is larger than the original! {len(data)} != {sect.SizeOfRawData}')
return
self.pe.set_bytes_at_offset(sect.PointerToRawData, data)