Skip to content

Commit 07ab46f

Browse files
committed
Fix codacy issues
1 parent 357143b commit 07ab46f

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

quark/script/frida/__init__.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from typing import Any, Dict, List, Tuple
1212

1313
import pkg_resources
14-
from quark.script import Behavior
1514
from quark.utils.regex import URL_REGEX
1615

1716
import frida
@@ -38,9 +37,9 @@ def startWatchingMethodCall(
3837
:return: python list that holds calls to the target method
3938
"""
4039
messageBuffer = []
41-
id = self._getMethodIdentifier(targetMethod, methodParamTypes)
40+
methodId = self._getMethodIdentifier(targetMethod, methodParamTypes)
4241

43-
self.watchedMethods[id] = messageBuffer
42+
self.watchedMethods[methodId] = messageBuffer
4443
self.script.exports.watch_method_call(targetMethod, methodParamTypes)
4544

4645
return messageBuffer
@@ -53,10 +52,10 @@ def stopWatchingMethodCall(
5352
:param targetMethod: the target API
5453
:param methodParamTypes: the parameter types of the target API
5554
"""
56-
id = self._getMethodIdentifier(targetMethod, methodParamTypes)
55+
methodId = self._getMethodIdentifier(targetMethod, methodParamTypes)
5756

58-
if id in self.watchedMethods:
59-
del self.watchedMethods[id]
57+
if methodId in self.watchedMethods:
58+
del self.watchedMethods[methodId]
6059

6160
def receiveMessage(self, messageFromFridaAgent: dict, _) -> None:
6261
if messageFromFridaAgent["type"] == "error":
@@ -69,15 +68,15 @@ def receiveMessage(self, messageFromFridaAgent: dict, _) -> None:
6968
eventType = receivedEvent.get("type", None)
7069

7170
if eventType == "CallCaptured":
72-
id = tuple(receivedEvent["identifier"][0:2])
71+
methodId = tuple(receivedEvent["identifier"][0:2])
7372

74-
if id in self.watchedMethods:
75-
messageBuffer = self.watchedMethods[id]
73+
if methodId in self.watchedMethods:
74+
messageBuffer = self.watchedMethods[methodId]
7675
messageBuffer.append(receivedEvent)
7776

7877
elif eventType == "FailedToWatch":
79-
id = tuple(receivedEvent["identifier"])
80-
self.watchedMethods.pop(id)
78+
methodId = tuple(receivedEvent["identifier"])
79+
self.watchedMethods.pop(methodId)
8180

8281

8382
@functools.lru_cache

quark/script/frida/agent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ function watchMethodCall(classAndMethodName, methodParamTypes) {
4747
const paramTypesOfPossibleMethod = possibleMethod.argumentTypes.map((argument) => argument.className);
4848
return paramTypesOfPossibleMethod.join(",") === methodParamTypes;
4949
}).forEach((matchedMethod) => {
50-
const retType = matchedMethod.returnType.name
51-
replaceMethodImplementation(matchedMethod, classAndMethodName, methodParamTypes, retType)
50+
const retType = matchedMethod.returnType.name;
51+
replaceMethodImplementation(matchedMethod, classAndMethodName, methodParamTypes, retType);
5252
}
5353
);
5454

0 commit comments

Comments
 (0)