fix: update deprecated Module.* APIs for Frida v17

This commit is contained in:
kaifcodec
2025-06-11 21:32:20 +05:30
parent 185e91f62d
commit eac9e21444
+9 -5
View File
@@ -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');