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

Method get_strings

python/binaryview.py:7195–7227  ·  view source on GitHub ↗

``get_strings`` returns a list of strings defined in the binary in the optional virtual address range: ``start-(start+length)`` Note that this API will only return strings that have been identified by the string-analysis and thus governed by the minimum and maximum length settings and unrela

(self, start: Optional[int] = None, length: Optional[int] = None)

Source from the content-addressed store, hash-verified

7193 return _components
7194
7195 def get_strings(self, start: Optional[int] = None, length: Optional[int] = None) -> List['StringReference']:
7196 """
7197 ``get_strings`` returns a list of strings defined in the binary in the optional virtual address range:
7198 ``start-(start+length)``
7199
7200 Note that this API will only return strings that have been identified by the string-analysis and thus governed by the minimum and maximum length settings and unrelated to the type system.
7201
7202 :param int start: optional virtual address to start the string list from, defaults to start of the binary
7203 :param int length: optional length range to return strings from, defaults to length of the binary
7204 :return: a list of all strings or a list of strings defined between ``start`` and ``start+length``
7205 :rtype: list(StringReference)
7206 :Example:
7207
7208 >>> bv.get_strings(0x1000004d, 1)
7209 [<AsciiString: 0x1000004d, len 0x2c>]
7210 >>>
7211 """
7212 count = ctypes.c_ulonglong(0)
7213 if start is None:
7214 strings = core.BNGetStrings(self.handle, count)
7215 assert strings is not None, "core.BNGetStrings returned None"
7216 else:
7217 if length is None:
7218 length = self.end - start
7219 strings = core.BNGetStringsInRange(self.handle, start, length, count)
7220 assert strings is not None, "core.BNGetStringsInRange returned None"
7221 result = []
7222 try:
7223 for i in range(0, count.value):
7224 result.append(StringReference(self, StringType(strings[i].type), strings[i].start, strings[i].length))
7225 return result
7226 finally:
7227 core.BNFreeStringReferenceList(strings)
7228
7229 def get_string_at(self, addr: int, partial: bool = False) -> Optional['StringReference']:
7230 """

Callers 1

stringsMethod · 0.95

Calls 2

StringReferenceClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected