MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / read_uuid

Method read_uuid

python/binaryview.py:4483–4499  ·  view source on GitHub ↗

Reads a UUID from the specified address in the binary view. :param address: The address to read the UUID from. :param ms_format: Whether to return the UUID in Microsoft format (True) or standard format (False). :return: A UUID object :raises ValueError: If 16 bytes couldn't be read

(self, address: int, ms_format: bool = True)

Source from the content-addressed store, hash-verified

4481 return self.read_int(address, size, False, self.endianness)
4482
4483 def read_uuid(self, address: int, ms_format: bool = True) -> uuid.UUID:
4484 """
4485 Reads a UUID from the specified address in the binary view.
4486
4487 :param address: The address to read the UUID from.
4488 :param ms_format: Whether to return the UUID in Microsoft format (True) or standard format (False).
4489 :return: A UUID object
4490 :raises ValueError: If 16 bytes couldn't be read from the specified address.
4491 """
4492 data = self.read(address, 16)
4493 if len(data) != 16:
4494 raise ValueError(f"Couldn't read 16 bytes from address: {address:#x}")
4495 if ms_format:
4496 reordered = data[3::-1] + data[5:3:-1] + data[7:5:-1] + data[8:]
4497 return uuid.UUID(bytes=reordered)
4498 else:
4499 return uuid.UUID(bytes=data)
4500
4501 def write(self, addr: int, data: bytes, except_on_relocation: bool = True) -> int:
4502 """

Callers

nothing calls this directly

Calls 1

readMethod · 0.95

Tested by

no test coverage detected