pymhf.core.memutils module#

pymhf.core.memutils.find_pattern_in_binary(pattern: str, return_multiple: bool = False, binary: str | None = None) int | list[int] | None#

Find a pattern in the specified binary. This is for the most part a wrapper around pymem’s pattern_scan_module function so that we can just call this with a module name (often the name of the binary we ran, but it could be some other dll under the same process.)

pymhf.core.memutils.get_addressof(obj) int#

Get the address in memory of some object.

pymhf.core.memutils.getsize(obj)#

Sum size of object & members.

pymhf.core.memutils.map_struct(offset: int, type_: Type[Struct]) Struct#

Return an instance of the type_ struct provided which shares memory with the provided offset. Note that the amount of memory to read is automatically determined by the size of the struct provided.

Parameters:
  • offset – The memory address to start reading the struct from.

  • type_ – The type of the ctypes.Structure to be loaded at this location.

Return type:

An instance of the input type.