diff --git a/quark/core/apkinfo.py b/quark/core/apkinfo.py index a764836b..b9941dcc 100644 --- a/quark/core/apkinfo.py +++ b/quark/core/apkinfo.py @@ -111,6 +111,7 @@ def upperfunc(self, method_object: MethodObject) -> Set[MethodObject]: for _, call, _ in method_analysis.get_xref_from() } + @functools.lru_cache() def lowerfunc(self, method_object: MethodObject) -> Set[MethodObject]: method_analysis = method_object.cache return { diff --git a/quark/core/quark.py b/quark/core/quark.py index 3b222c94..64f5a1c1 100644 --- a/quark/core/quark.py +++ b/quark/core/quark.py @@ -164,13 +164,14 @@ def check_sequence( :return: True or False """ state = False + mutual_parent_lowerfunc = self.apkinfo.lowerfunc(mutual_parent) for first_call_method in first_method_list: for second_call_method in second_method_list: seq_table = [ (call, number) - for call, number in self.apkinfo.lowerfunc(mutual_parent) + for call, number in mutual_parent_lowerfunc if call in (first_call_method, second_call_method) ]