(self)
| 376 | |
| 377 | |
| 378 | def get_code_rangemanager(self) -> RangeManager: |
| 379 | code_section = self.get_code_section() |
| 380 | code_section_size = code_section.Misc_VirtualSize |
| 381 | |
| 382 | # Restrictions for putting data into .text: |
| 383 | # - enough space for carrier + payload |
| 384 | # - avoid overwriting entry point function |
| 385 | # - carrier should not generate much smaller holes in .text |
| 386 | |
| 387 | rm = RangeManager( |
| 388 | code_section.VirtualAddress, |
| 389 | code_section.VirtualAddress + code_section_size) |
| 390 | |
| 391 | # protect entrypoint a bit |
| 392 | entrypoint_rva = self.get_entrypoint() |
| 393 | rm.add_range( |
| 394 | entrypoint_rva - 0x100, |
| 395 | entrypoint_rva + 0x100) |
| 396 | |
| 397 | return rm |
| 398 | |
| 399 | |
| 400 | ## Helpers |
no test coverage detected