refactor: derbackdoorer / mype / injector (temp)

This commit is contained in:
Dobin
2024-03-01 11:36:58 +00:00
parent bb185b572d
commit d0500107c0
4 changed files with 117 additions and 64 deletions
+13
View File
@@ -24,6 +24,7 @@ class MyPe():
def __init__(self):
self.pe = None
def openFile(self, infile):
self.pe = pefile.PE(infile, fast_load=False)
self.pe.parse_data_directories()
@@ -53,6 +54,18 @@ class MyPe():
return None
def get_code_section_data(self) -> bytes:
sect = self.get_code_section()
print("CODE GET: {}".format(len(sect.get_data())))
return bytes(sect.get_data())
def write_code_section_data(self, data: bytes):
sect = self.get_code_section()
print("CODE SET {} {}".format(len(data), sect.PointerToRawData))
self.pe.set_bytes_at_offset(sect.PointerToRawData, data)
def getSectionIndexByDataDir(self, dirIndex):
addr = self.pe.OPTIONAL_HEADER.DATA_DIRECTORY[dirIndex].VirtualAddress