mirror of
https://github.com/dobin/SuperMega
synced 2026-06-03 01:27:11 +00:00
refactor: fix a bug and cleanup
This commit is contained in:
+1
-1
@@ -46,7 +46,7 @@ Code section size : {sect_size}
|
||||
''')
|
||||
|
||||
offset = int((sect_size - len(self.shellcodeData)) / 2)
|
||||
logger.debug(f'Inserting shellcode into 0x{offset:X} offset.')
|
||||
logger.info(f'Inserting shellcode into 0x{offset:X} offset.')
|
||||
|
||||
self.superpe.pe.set_bytes_at_offset(offset, self.shellcodeData)
|
||||
self.shellcodeOffset = offset
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user