11
11
from typing import Any , Dict , List , Tuple
12
12
13
13
import pkg_resources
14
- from quark .script import Behavior
15
14
from quark .utils .regex import URL_REGEX
16
15
17
16
import frida
@@ -38,9 +37,9 @@ def startWatchingMethodCall(
38
37
:return: python list that holds calls to the target method
39
38
"""
40
39
messageBuffer = []
41
- id = self ._getMethodIdentifier (targetMethod , methodParamTypes )
40
+ methodId = self ._getMethodIdentifier (targetMethod , methodParamTypes )
42
41
43
- self .watchedMethods [id ] = messageBuffer
42
+ self .watchedMethods [methodId ] = messageBuffer
44
43
self .script .exports .watch_method_call (targetMethod , methodParamTypes )
45
44
46
45
return messageBuffer
@@ -53,10 +52,10 @@ def stopWatchingMethodCall(
53
52
:param targetMethod: the target API
54
53
:param methodParamTypes: the parameter types of the target API
55
54
"""
56
- id = self ._getMethodIdentifier (targetMethod , methodParamTypes )
55
+ methodId = self ._getMethodIdentifier (targetMethod , methodParamTypes )
57
56
58
- if id in self .watchedMethods :
59
- del self .watchedMethods [id ]
57
+ if methodId in self .watchedMethods :
58
+ del self .watchedMethods [methodId ]
60
59
61
60
def receiveMessage (self , messageFromFridaAgent : dict , _ ) -> None :
62
61
if messageFromFridaAgent ["type" ] == "error" :
@@ -69,15 +68,15 @@ def receiveMessage(self, messageFromFridaAgent: dict, _) -> None:
69
68
eventType = receivedEvent .get ("type" , None )
70
69
71
70
if eventType == "CallCaptured" :
72
- id = tuple (receivedEvent ["identifier" ][0 :2 ])
71
+ methodId = tuple (receivedEvent ["identifier" ][0 :2 ])
73
72
74
- if id in self .watchedMethods :
75
- messageBuffer = self .watchedMethods [id ]
73
+ if methodId in self .watchedMethods :
74
+ messageBuffer = self .watchedMethods [methodId ]
76
75
messageBuffer .append (receivedEvent )
77
76
78
77
elif eventType == "FailedToWatch" :
79
- id = tuple (receivedEvent ["identifier" ])
80
- self .watchedMethods .pop (id )
78
+ methodId = tuple (receivedEvent ["identifier" ])
79
+ self .watchedMethods .pop (methodId )
81
80
82
81
83
82
@functools .lru_cache
0 commit comments