@@ -10058,6 +10058,146 @@ def find_all_constant(
1005810058
1005910059 return self .QueueGenerator (t , results )
1006010060
10061+ @overload
10062+ def find_all_text_in_function (
10063+ self , func : '_function.Function' , text : str , settings : Optional [_function .DisassemblySettings ] = None ,
10064+ flags = FindFlag .FindCaseSensitive , graph_type : _function .FunctionViewTypeOrName = FunctionGraphType .NormalFunctionGraph ,
10065+ progress_func = None , match_callback = None
10066+ ) -> QueueGenerator : ...
10067+
10068+ @overload
10069+ def find_all_text_in_function (
10070+ self , func : '_function.Function' , text : str , settings : Optional [_function .DisassemblySettings ] = None ,
10071+ flags = FindFlag .FindCaseSensitive , graph_type : _function .FunctionViewTypeOrName = FunctionGraphType .NormalFunctionGraph ,
10072+ progress_func = None , match_callback : TextMatchCallbackType = None
10073+ ) -> bool : ...
10074+
10075+ def find_all_text_in_function (
10076+ self , func : '_function.Function' , text : str , settings : Optional [_function .DisassemblySettings ] = None ,
10077+ flags = FindFlag .FindCaseSensitive , graph_type : _function .FunctionViewTypeOrName = FunctionGraphType .NormalFunctionGraph ,
10078+ progress_func = None , match_callback : Optional [TextMatchCallbackType ] = None
10079+ ) -> Union [QueueGenerator , bool ]:
10080+ if not isinstance (func , _function .Function ):
10081+ raise TypeError ("func parameter is not Function type" )
10082+ if settings is None :
10083+ settings = _function .DisassemblySettings ()
10084+ settings .set_option (DisassemblyOption .ShowAddress , False )
10085+ settings .set_option (DisassemblyOption .ShowOpcode , False )
10086+ settings .set_option (DisassemblyOption .ShowVariableTypesWhenAssigned , True )
10087+ settings .set_option (DisassemblyOption .WaitForIL , True )
10088+ if not isinstance (settings , _function .DisassemblySettings ):
10089+ raise TypeError ("settings parameter is not DisassemblySettings type" )
10090+ if not isinstance (flags , FindFlag ):
10091+ raise TypeError ('flag parameter must have type FindFlag' )
10092+ graph_type = _function .FunctionViewType (graph_type )._to_core_struct ()
10093+
10094+ if progress_func :
10095+ progress_func_obj = ctypes .CFUNCTYPE (
10096+ ctypes .c_bool , ctypes .c_void_p , ctypes .c_ulonglong , ctypes .c_ulonglong
10097+ )(lambda ctxt , cur , total : progress_func (cur , total ))
10098+ else :
10099+ progress_func_obj = ctypes .CFUNCTYPE (
10100+ ctypes .c_bool , ctypes .c_void_p , ctypes .c_ulonglong , ctypes .c_ulonglong
10101+ )(lambda ctxt , cur , total : True )
10102+
10103+ if match_callback :
10104+ match_callback_obj = ctypes .CFUNCTYPE (
10105+ ctypes .c_bool , ctypes .c_void_p , ctypes .c_ulonglong , ctypes .c_char_p ,
10106+ ctypes .POINTER (core .BNLinearDisassemblyLine )
10107+ )(
10108+ lambda ctxt , addr , match , line :
10109+ not match_callback (addr , core .pyNativeStr (match ), self ._LinearDisassemblyLine_convertor (line )) is False
10110+ )
10111+
10112+ return core .BNFindAllTextInFunctionWithProgress (
10113+ func .handle , text , settings .handle , flags , graph_type , None , progress_func_obj , None ,
10114+ match_callback_obj
10115+ )
10116+ else :
10117+ results = queue .Queue ()
10118+ match_callback_obj = ctypes .CFUNCTYPE (
10119+ ctypes .c_bool , ctypes .c_void_p , ctypes .c_ulonglong , ctypes .c_char_p ,
10120+ ctypes .POINTER (core .BNLinearDisassemblyLine )
10121+ )(
10122+ lambda ctxt , addr , match , line : results .put ((addr , core .pyNativeStr (match ), self ._LinearDisassemblyLine_convertor (line )))
10123+ or True
10124+ )
10125+
10126+ t = threading .Thread (
10127+ target = lambda : core .BNFindAllTextInFunctionWithProgress (
10128+ func .handle , text , settings .handle , flags , graph_type , None , progress_func_obj , None ,
10129+ match_callback_obj
10130+ )
10131+ )
10132+
10133+ return self .QueueGenerator (t , results )
10134+
10135+ @overload
10136+ def find_all_constant_in_function (
10137+ self , func : '_function.Function' , constant : int , settings : Optional [_function .DisassemblySettings ] = None ,
10138+ graph_type : _function .FunctionViewTypeOrName = FunctionGraphType .NormalFunctionGraph , progress_func : Optional [ProgressFuncType ] = None ,
10139+ match_callback : None = None
10140+ ) -> QueueGenerator : ...
10141+
10142+ @overload
10143+ def find_all_constant_in_function (
10144+ self , func : '_function.Function' , constant : int , settings : Optional [_function .DisassemblySettings ] = None ,
10145+ graph_type : _function .FunctionViewTypeOrName = FunctionGraphType .NormalFunctionGraph , progress_func : Optional [ProgressFuncType ] = None ,
10146+ match_callback : LineMatchCallbackType = None
10147+ ) -> bool : ...
10148+
10149+ def find_all_constant_in_function (
10150+ self , func : '_function.Function' , constant : int , settings : Optional [_function .DisassemblySettings ] = None ,
10151+ graph_type : _function .FunctionViewTypeOrName = FunctionGraphType .NormalFunctionGraph , progress_func : Optional [ProgressFuncType ] = None ,
10152+ match_callback : Optional [LineMatchCallbackType ] = None
10153+ ) -> Union [QueueGenerator , bool ]:
10154+ if not isinstance (func , _function .Function ):
10155+ raise TypeError ("func parameter is not Function type" )
10156+ if not isinstance (constant , int ):
10157+ raise TypeError ("constant parameter is not integral type" )
10158+ if settings is None :
10159+ settings = _function .DisassemblySettings ()
10160+ settings .set_option (DisassemblyOption .ShowAddress , False )
10161+ settings .set_option (DisassemblyOption .ShowOpcode , False )
10162+ settings .set_option (DisassemblyOption .ShowVariableTypesWhenAssigned , True )
10163+ settings .set_option (DisassemblyOption .WaitForIL , True )
10164+ if not isinstance (settings , _function .DisassemblySettings ):
10165+ raise TypeError ("settings parameter is not DisassemblySettings type" )
10166+ graph_type = _function .FunctionViewType (graph_type )._to_core_struct ()
10167+
10168+ if progress_func :
10169+ progress_func_obj = ctypes .CFUNCTYPE (
10170+ ctypes .c_bool , ctypes .c_void_p , ctypes .c_ulonglong , ctypes .c_ulonglong
10171+ )(lambda ctxt , cur , total : progress_func (cur , total ))
10172+ else :
10173+ progress_func_obj = ctypes .CFUNCTYPE (
10174+ ctypes .c_bool , ctypes .c_void_p , ctypes .c_ulonglong , ctypes .c_ulonglong
10175+ )(lambda ctxt , cur , total : True )
10176+
10177+ if match_callback :
10178+ match_callback_obj = ctypes .CFUNCTYPE (
10179+ ctypes .c_bool , ctypes .c_void_p , ctypes .c_ulonglong , ctypes .POINTER (core .BNLinearDisassemblyLine )
10180+ )(lambda ctxt , addr , line : not match_callback (addr , self ._LinearDisassemblyLine_convertor (line )) is False )
10181+
10182+ return core .BNFindAllConstantInFunctionWithProgress (
10183+ func .handle , constant , settings .handle , graph_type , None , progress_func_obj , None ,
10184+ match_callback_obj
10185+ )
10186+ else :
10187+ results = queue .Queue ()
10188+ match_callback_obj = ctypes .CFUNCTYPE (
10189+ ctypes .c_bool , ctypes .c_void_p , ctypes .c_ulonglong , ctypes .POINTER (core .BNLinearDisassemblyLine )
10190+ )(lambda ctxt , addr , line : results .put ((addr , self ._LinearDisassemblyLine_convertor (line ))) or True )
10191+
10192+ t = threading .Thread (
10193+ target = lambda : core .BNFindAllConstantInFunctionWithProgress (
10194+ func .handle , constant , settings .handle , graph_type , None , progress_func_obj , None ,
10195+ match_callback_obj
10196+ )
10197+ )
10198+
10199+ return self .QueueGenerator (t , results )
10200+
1006110201 def search (self , pattern : str , start : Optional [int ] = None , end : Optional [int ] = None , raw : bool = False , ignore_case : bool = False , overlap : bool = False , align : int = 1 ,
1006210202 limit : Optional [int ] = None , progress_callback : Optional [ProgressFuncType ] = None , match_callback : Optional [DataMatchCallbackType ] = None ) -> QueueGenerator :
1006310203 r"""
0 commit comments