summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authornullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com>2026-02-14 02:59:40 +1100
committerGlenn Smith <glenn@vector35.com>2026-02-26 13:47:40 -0500
commit5085389951883837291292944036914480410535 (patch)
treedb5942b6fb0e5d1e23312d77ea1309bce11b2e4b /python
parent1477644130363181529308369212747957500371 (diff)
fix[python]: BinaryView types
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py53
1 files changed, 50 insertions, 3 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index c471a548..2dc3c05c 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -88,6 +88,7 @@ PathType = Union[str, os.PathLike]
InstructionsType = Generator[Tuple[List['_function.InstructionTextToken'], int], None, None]
ProgressFuncType = Callable[[int, int], bool]
DataMatchCallbackType = Callable[[int, 'databuffer.DataBuffer'], bool]
+TextMatchCallbackType = Callable[[int, str, 'lineardisassembly.LinearDisassemblyLine'], bool]
LineMatchCallbackType = Callable[[int, 'lineardisassembly.LinearDisassemblyLine'], bool]
StringOrType = Union[str, '_types.Type', '_types.TypeBuilder']
@@ -9535,6 +9536,18 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
if (not self.thread.is_alive()) and self.results.empty():
raise StopIteration
+ @overload
+ def find_all_data(
+ self, start: int, end: int, data: bytes, flags: FindFlag = FindFlag.FindCaseSensitive,
+ progress_func: Optional[ProgressFuncType] = None, match_callback: None = None
+ ) -> QueueGenerator: ...
+
+ @overload
+ def find_all_data(
+ self, start: int, end: int, data: bytes, flags: FindFlag = FindFlag.FindCaseSensitive,
+ progress_func: Optional[ProgressFuncType] = None, match_callback: DataMatchCallbackType = None
+ ) -> bool: ...
+
def find_all_data(
self, start: int, end: int, data: bytes, flags: FindFlag = FindFlag.FindCaseSensitive,
progress_func: Optional[ProgressFuncType] = None, match_callback: Optional[DataMatchCallbackType] = None
@@ -9610,10 +9623,24 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
core.BNFreeLinearDisassemblyLines(lines, 1)
return line
+ @overload
+ def find_all_text(
+ 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 = None
+ ) -> QueueGenerator: ...
+
+ @overload
+ def find_all_text(
+ 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: TextMatchCallbackType = None
+ ) -> bool: ...
+
def find_all_text(
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
+ match_callback: Optional[TextMatchCallbackType] = None
) -> Union[QueueGenerator, bool]:
"""
``find_all_text`` searches for string ``text`` occurring in the linear view output starting
@@ -9679,7 +9706,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
ctypes.POINTER(core.BNLinearDisassemblyLine)
)(
lambda ctxt, addr, match, line:
- not match_callback(addr, match, self._LinearDisassemblyLine_convertor(line)) is False
+ not match_callback(addr, core.pyNativeStr(match), self._LinearDisassemblyLine_convertor(line)) is False
)
return core.BNFindAllTextWithProgress(
@@ -9692,7 +9719,7 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
ctypes.c_bool, ctypes.c_void_p, ctypes.c_ulonglong, ctypes.c_char_p,
ctypes.POINTER(core.BNLinearDisassemblyLine)
)(
- lambda ctxt, addr, match, line: results.put((addr, match, self._LinearDisassemblyLine_convertor(line)))
+ lambda ctxt, addr, match, line: results.put((addr, core.pyNativeStr(match), self._LinearDisassemblyLine_convertor(line)))
or True
)
@@ -9705,6 +9732,20 @@ to a the type "tagRECT" found in the typelibrary "winX64common"
return self.QueueGenerator(t, results)
+ @overload
+ def find_all_constant(
+ self, start: int, end: int, constant: int, settings: Optional[_function.DisassemblySettings] = None,
+ graph_type: _function.FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph, progress_func: Optional[ProgressFuncType] = None,
+ match_callback: None = None
+ ) -> QueueGenerator: ...
+
+ @overload
+ def find_all_constant(
+ self, start: int, end: int, constant: int, settings: Optional[_function.DisassemblySettings] = None,
+ graph_type: _function.FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph, progress_func: Optional[ProgressFuncType] = None,
+ match_callback: LineMatchCallbackType = None
+ ) -> bool: ...
+
def find_all_constant(
self, start: int, end: int, constant: int, settings: Optional[_function.DisassemblySettings] = None,
graph_type: _function.FunctionViewTypeOrName = FunctionGraphType.NormalFunctionGraph, progress_func: Optional[ProgressFuncType] = None,
@@ -11497,6 +11538,12 @@ class TypedDataAccessor:
for i in range(_type.count):
yield self[i]
+ @overload
+ def __getitem__(self, key: Union[str, int]) -> 'TypedDataAccessor': ...
+
+ @overload
+ def __getitem__(self, key: slice) -> List['TypedDataAccessor']: ...
+
def __getitem__(self, key: Union[str, int, slice]) -> Union['TypedDataAccessor', List['TypedDataAccessor']]:
_type = self.type
if isinstance(_type, _types.NamedTypeReferenceType):