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

Class StringReference

python/binaryview.py:447–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445
446
447class StringReference:
448 _decodings = {
449 StringType.AsciiString: "ascii", StringType.Utf8String: "utf-8", StringType.Utf16String: "utf-16",
450 StringType.Utf32String: "utf-32",
451 }
452
453 def __init__(self, bv: 'BinaryView', string_type: StringType, start: int, length: int):
454 self._type = string_type
455 self._start = start
456 self._length = length
457 self._view = bv
458
459 def __repr__(self):
460 return f"<{self._type.name}: {self._start:#x}, len {self._length:#x}>"
461
462 def __str__(self):
463 return self.value
464
465 def __len__(self):
466 return self._length
467
468 @property
469 def value(self) -> str:
470 return self._view.read(self._start, self._length).decode(self._decodings[self._type])
471
472 @property
473 def raw(self) -> bytes:
474 return self._view.read(self._start, self._length)
475
476 @property
477 def type(self) -> StringType:
478 return self._type
479
480 @property
481 def start(self) -> int:
482 return self._start
483
484 @property
485 def length(self) -> int:
486 return self._length
487
488 @property
489 def view(self) -> 'BinaryView':
490 return self._view
491
492
493class AnalysisCompletionEvent:

Callers 3

get_stringsMethod · 0.85
get_string_atMethod · 0.85
get_ascii_string_atMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected