MCPcopy Create free account
hub / github.com/dobin/SuperMega / get_code_rangemanager

Method get_code_rangemanager

pe/superpe.py:378–397  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.80

Calls 4

get_code_sectionMethod · 0.95
get_entrypointMethod · 0.95
add_rangeMethod · 0.95
RangeManagerClass · 0.90

Tested by

no test coverage detected