@@ -85,6 +85,30 @@ def fullName(self) -> str:
85
85
"""
86
86
return self .innerObj .full_name
87
87
88
+ @property
89
+ def className (self ) -> str :
90
+ """Show the class name of the method.
91
+
92
+ :return: the string of the method class name
93
+ """
94
+ return self .innerObj .class_name
95
+
96
+ @property
97
+ def methodName (self ) -> str :
98
+ """Show the method name of the method.
99
+
100
+ :return: the string of the method name
101
+ """
102
+ return self .innerObj .name
103
+
104
+ @property
105
+ def descriptor (self ) -> str :
106
+ """Show the descriptor of the method.
107
+
108
+ :return: the string of the method descriptor
109
+ """
110
+ return self .innerObj .descriptor
111
+
88
112
89
113
class Behavior :
90
114
def __init__ (
@@ -218,6 +242,41 @@ def getAllStrings(self) -> List[str]:
218
242
apkinfo = self .quark .apkinfo
219
243
return apkinfo .get_strings ()
220
244
245
+ def findMethodInCaller (
246
+ self ,
247
+ callerMethod : List [str ],
248
+ targetMethod : List [str ]
249
+ ) -> bool :
250
+ """
251
+ Check if target method is in caller method.
252
+
253
+ :params callerMethod: python list contains class name,
254
+ method name and descriptor of caller method.
255
+ :params targetMethod: python list contains class name,
256
+ method name and descriptor of target method.
257
+ :return: True/False
258
+ """
259
+
260
+ apkinfo = self .quark .apkinfo
261
+
262
+ callerMethodObj = apkinfo .find_method (
263
+ class_name = callerMethod [0 ],
264
+ method_name = callerMethod [1 ],
265
+ descriptor = callerMethod [2 ])
266
+
267
+ if not callerMethodObj :
268
+ print ("Caller method not Found!" )
269
+ raise ValueError
270
+
271
+ callerMethodInstance = Method (self , callerMethodObj )
272
+
273
+ for calleeMethod , _ in callerMethodInstance .getXrefTo ():
274
+ if calleeMethod .innerObj .class_name == targetMethod [0 ] and \
275
+ calleeMethod .innerObj .name == targetMethod [1 ] and \
276
+ calleeMethod .innerObj .descriptor == targetMethod [2 ]:
277
+ return True
278
+ return False
279
+
221
280
222
281
def runQuarkAnalysis (samplePath : PathLike , ruleInstance : Rule ) -> QuarkResult :
223
282
"""Given detection rule and target sample, this instance runs the basic
0 commit comments