From eac9e21444e6b10e52179760c817f111b07c634e Mon Sep 17 00:00:00 2001 From: kaifcodec Date: Wed, 11 Jun 2025 21:32:20 +0530 Subject: [PATCH] fix: update deprecated Module.* APIs for Frida v17 --- native-connect-hook.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/native-connect-hook.js b/native-connect-hook.js index 20e3b5a..0cd523d 100644 --- a/native-connect-hook.js +++ b/native-connect-hook.js @@ -21,11 +21,15 @@ const PROXY_HOST_IPv4_BYTES = PROXY_HOST.split('.').map(part => parseInt(part, 1 const IPv6_MAPPING_PREFIX_BYTES = [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff]; const PROXY_HOST_IPv6_BYTES = IPv6_MAPPING_PREFIX_BYTES.concat(PROXY_HOST_IPv4_BYTES); -const connectFn = ( - Module.findExportByName('libc.so', 'connect') ?? // Android - Module.findExportByName('libc.so.6', 'connect') ?? // Linux - Module.findExportByName('libsystem_kernel.dylib', 'connect') // iOS -); +let connectFn = null; +try { + connectFn = + Process.getModuleByName('libc.so').findExportByName('connect') ?? //Android + Process.getModuleByName('libc.so.6').findExportByName('connect') ?? // Linux + Process.getModuleByName('libsystem_kernel.dylib').findExportByName('connect'); //IOS +} catch (e) { + console.error("Failed to find 'connect' export:", e); +} if (!connectFn) { // Should always be set, but just in case console.warn('Could not find libc connect() function to hook raw traffic');