(exe_file: FilePath, new_data: bytes)
| 64 | |
| 65 | |
| 66 | def write_code_section(exe_file: FilePath, new_data: bytes): |
| 67 | pe = pefile.PE(exe_file) |
| 68 | section = get_code_section(pe) |
| 69 | file_offset = section.PointerToRawData |
| 70 | with open(exe_file, 'r+b') as f: |
| 71 | f.seek(file_offset) |
| 72 | f.write(new_data) |
| 73 | pe.close() |
| 74 | |
| 75 | |
| 76 | def get_code_section(pe: pefile.PE) -> pefile.SectionStructure: |
nothing calls this directly
no test coverage detected