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

Method find_all_text

python/binaryview.py:9061–9153  ·  view source on GitHub ↗

``find_all_text`` searches for string ``text`` occurring in the linear view output starting at the virtual address ``start`` until the virtual address ``end``. Once a match is found, the ``match_callback`` is called. :param int start: virtual address to start searching from. :param int e

(
	    self, start: int, end: int, text: str, settings: Optional[_function.DisassemblySettings] = None,
	    flags=FindFlag.FindCaseSensitive, graph_type: _function.FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph, progress_func=None,
	    match_callback=None
	)

Source from the content-addressed store, hash-verified

9059 return line
9060
9061 def find_all_text(
9062 self, start: int, end: int, text: str, settings: Optional[_function.DisassemblySettings] = None,
9063 flags=FindFlag.FindCaseSensitive, graph_type: _function.FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph, progress_func=None,
9064 match_callback=None
9065 ) -> QueueGenerator:
9066 """
9067 ``find_all_text`` searches for string ``text`` occurring in the linear view output starting
9068 at the virtual address ``start`` until the virtual address ``end``. Once a match is found,
9069 the ``match_callback`` is called.
9070
9071 :param int start: virtual address to start searching from.
9072 :param int end: virtual address to end the search.
9073 :param str text: text to search for
9074 :param DisassemblySettings settings: DisassemblySettings object used to render the text \
9075 to be searched
9076 :param FindFlag flags: (optional) defaults to case-insensitive data search
9077
9078 ==================== ============================
9079 FindFlag Description
9080 ==================== ============================
9081 FindCaseSensitive Case-sensitive search
9082 FindCaseInsensitive Case-insensitive search
9083 ==================== ============================
9084 :param FunctionViewType graph_type: the IL to search within
9085 :param callback progress_func: optional function to be called with the current progress \
9086 and total count. This function should return a boolean value that decides whether the \
9087 search should continue or stop
9088 :param callback match_callback: function that gets called when a match is found. The \
9089 callback takes three parameters, i.e., the address of the match, and the actual string \
9090 that satisfies the search, and the LinearDisassemblyLine that contains the matching \
9091 line. If this parameter is None, this function becomes a generator \
9092 and yields a tuple of the matching address, the matched string, and the matching \
9093 LinearDisassemblyLine. This function can return a boolean value that decides whether \
9094 the search should continue or stop
9095 :rtype QueueGenerator: A generator object that will yield all the found results
9096 """
9097 if not isinstance(text, str):
9098 raise TypeError("text parameter is not str type")
9099 if settings is None:
9100 settings = _function.DisassemblySettings()
9101 settings.set_option(DisassemblyOption.ShowAddress, False)
9102 settings.set_option(DisassemblyOption.ShowOpcode, False)
9103 settings.set_option(DisassemblyOption.ShowVariableTypesWhenAssigned, True)
9104 settings.set_option(DisassemblyOption.WaitForIL, True)
9105 if not isinstance(settings, _function.DisassemblySettings):
9106 raise TypeError("settings parameter is not DisassemblySettings type")
9107 if not isinstance(flags, FindFlag):
9108 raise TypeError('flag parameter must have type FindFlag')
9109 graph_type = _function.FunctionViewType(graph_type)._to_core_struct()
9110
9111 if progress_func:
9112 progress_func_obj = ctypes.CFUNCTYPE(
9113 ctypes.c_bool, ctypes.c_void_p, ctypes.c_ulonglong, ctypes.c_ulonglong
9114 )(lambda ctxt, cur, total: progress_func(cur, total))
9115 else:
9116 progress_func_obj = ctypes.CFUNCTYPE(
9117 ctypes.c_bool, ctypes.c_void_p, ctypes.c_ulonglong, ctypes.c_ulonglong
9118 )(lambda ctxt, cur, total: True)

Callers

nothing calls this directly

Calls 6

set_optionMethod · 0.95
DisassemblySettingsMethod · 0.80
putMethod · 0.80
_to_core_structMethod · 0.45
FunctionViewTypeMethod · 0.45

Tested by

no test coverage detected