diff --git a/android-certificate-unpinning.js b/android-certificate-unpinning.js index 7772ea9..2905537 100644 --- a/android-certificate-unpinning.js +++ b/android-certificate-unpinning.js @@ -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; diff --git a/native-hook.js b/native-hook.js index 39d8c9b..5904b13 100644 --- a/native-hook.js +++ b/native-hook.js @@ -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()})` ); } });