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

Method read

python/binaryview.py:4447–4465  ·  view source on GitHub ↗

r""" ``read`` returns the data reads at most ``length`` bytes from virtual address ``addr``. :param int addr: virtual address to read from. :param int length: number of bytes to read. :return: at most ``length`` bytes from the virtual address ``addr``, empty string on error or no data :rt

(self, addr: int, length: int)

Source from the content-addressed store, hash-verified

4445 return self._file.navigate(view_name, offset)
4446
4447 def read(self, addr: int, length: int) -> bytes:
4448 r"""
4449 ``read`` returns the data reads at most ``length`` bytes from virtual address ``addr``.
4450
4451 :param int addr: virtual address to read from.
4452 :param int length: number of bytes to read.
4453 :return: at most ``length`` bytes from the virtual address ``addr``, empty string on error or no data
4454 :rtype: bytes
4455 :Example:
4456
4457 >>> #Opening a x86_64 Mach-O binary
4458 >>> bv = BinaryView.new("/bin/ls") # note that we are using `new` instead of `load` to get the raw view
4459 >>> bv.read(0,4)
4460 b'\xcf\xfa\xed\xfe'
4461 """
4462 if (addr < 0) or (length < 0):
4463 raise ValueError("length and address must both be positive")
4464 buf = databuffer.DataBuffer(handle=core.BNReadViewBuffer(self.handle, addr, length))
4465 return bytes(buf)
4466
4467 def read_int(self, address: int, size: int, sign: bool = True, endian: Optional[Endianness] = None) -> int:
4468 _endian = self.endianness

Callers 15

__getitem__Method · 0.95
disassembly_tokensMethod · 0.95
disassembly_textMethod · 0.95
get_disassemblyMethod · 0.95
read_intMethod · 0.95
read_uuidMethod · 0.95
ReadMethod · 0.45
mainFunction · 0.45
codegencpp.pyFile · 0.45
mainFunction · 0.45
filter.pyFile · 0.45

Calls 1

DataBufferMethod · 0.80

Tested by 2

mainFunction · 0.36
gather_samplesFunction · 0.36