mirror of
https://github.com/httptoolkit/frida-interception-and-unpinning.git
synced 2026-10-09 01:12:26 +02:00
Improve debug logging: log activated hooks & more clearly list conns
This commit is contained in:
@@ -425,7 +425,16 @@ Java.perform(function () {
|
||||
}`;
|
||||
|
||||
try {
|
||||
targetMethod.implementation = replacement(targetMethod);
|
||||
const newImplementation = replacement(targetMethod);
|
||||
if (DEBUG_MODE) {
|
||||
// Log each hooked method as it's called:
|
||||
targetMethod.implementation = function () {
|
||||
console.log(` => ${patchName}`);
|
||||
return newImplementation.apply(this, arguments);
|
||||
}
|
||||
} else {
|
||||
targetMethod.implementation = newImplementation;
|
||||
}
|
||||
|
||||
if (DEBUG_MODE) console.log(`[+] ${patchName}`);
|
||||
patchApplied = true;
|
||||
|
||||
+4
-3
@@ -96,19 +96,20 @@ if (!connectFn) { // Should always be set, but just in case
|
||||
addrPtr.add(4).writeByteArray(PROXY_HOST_IPv4_BYTES);
|
||||
}
|
||||
} else if (DEBUG_MODE) {
|
||||
console.debug(`Ignoring ${sockType} connection`);
|
||||
console.log(`Ignoring ${sockType} connection`);
|
||||
this.ignored = true;
|
||||
}
|
||||
|
||||
// N.b. we ignore all non-TCP connections: both UDP and Unix streams
|
||||
},
|
||||
onLeave: function (result) {
|
||||
if (!DEBUG_MODE) return;
|
||||
if (!DEBUG_MODE || this.ignored) return;
|
||||
|
||||
const fd = this.sockFd;
|
||||
const sockType = Socket.type(fd);
|
||||
const address = Socket.peerAddress(fd);
|
||||
console.debug(
|
||||
`Connected fd ${fd} of type ${sockType} to ${JSON.stringify(address)} (${result.toInt32()})`
|
||||
`Connected ${sockType} fd ${fd} to ${JSON.stringify(address)} (${result.toInt32()})`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user