Skip to content

icecap.infrastructure.memory_manager

MemoryManager

Bases: Protocol

read_bytes

read_bytes(address: int, size: int) -> bytes

Read a sequence of bytes from the given address.

Source code in icecap/infrastructure/memory_manager/interface.py
def read_bytes(self, address: int, size: int) -> bytes:
    """Read a sequence of bytes from the given address."""

read_ctype_dataclass

read_ctype_dataclass(address: int, dataclass: Type[CStructTypeVar]) -> CStructTypeVar

Read a C-typed structure dataclass from the given address.

Source code in icecap/infrastructure/memory_manager/interface.py
def read_ctype_dataclass(self, address: int, dataclass: Type[CStructTypeVar]) -> CStructTypeVar:
    """Read a C-typed structure dataclass from the given address."""

read_float

read_float(address: int) -> float

Read a 4 bytes float from the given address.

Source code in icecap/infrastructure/memory_manager/interface.py
def read_float(self, address: int) -> float:
    """Read a 4 bytes float from the given address."""

read_short

read_short(address: int) -> int

Read a signed 2 bytes integer from the given address.

Source code in icecap/infrastructure/memory_manager/interface.py
def read_short(self, address: int) -> int:
    """Read a signed 2 bytes integer from the given address."""

read_string

read_string(address: int, length: int) -> str

Read a string from the given address with the specified length.

Source code in icecap/infrastructure/memory_manager/interface.py
def read_string(self, address: int, length: int) -> str:
    """Read a string from the given address with the specified length."""

read_uint

read_uint(address: int) -> int

Read an unsigned 4 bytes integer from the given address.

Source code in icecap/infrastructure/memory_manager/interface.py
def read_uint(self, address: int) -> int:
    """Read an unsigned 4 bytes integer from the given address."""

read_ulonglong

read_ulonglong(address: int) -> int

Read an unsigned 8 bytes integer from the given address.

Source code in icecap/infrastructure/memory_manager/interface.py
def read_ulonglong(self, address: int) -> int:
    """Read an unsigned 8 bytes integer from the given address."""

get_memory_manager

get_memory_manager(pid: int) -> MemoryManager

Factory function to get the appropriate memory manager based on the OS.

Raises:

Source code in icecap/infrastructure/memory_manager/factory.py
def get_memory_manager(pid: int) -> MemoryManager:
    """Factory function to get the appropriate memory manager based on the OS.

    Raises:
        NotImplementedError: If the current OS is not supported
    """
    if OS_SYSTEM == "Linux":
        return LinuxMemoryManager(pid)
    elif OS_SYSTEM == "Windows":
        return WindowsMemoryManager(pid)

    raise NotImplementedError(f"Memory manager for {OS_SYSTEM} is not implemented.")