Fix local frida multiple replacement

This commit is contained in:
hyugogirubato 2024-07-12 10:06:30 +02:00
parent 2294f8e784
commit 9e3781e7eb
1 changed files with 4 additions and 4 deletions

View File

@ -275,11 +275,11 @@ const hookLibrary = (name) => {
functions = functions.filter(f => !NATIVE_C_API.includes(f.name)); functions = functions.filter(f => !NATIVE_C_API.includes(f.name));
const targets = functions.filter(f => OEM_CRYPTO_API.includes(f.name)).map(f => f.name); const targets = functions.filter(f => OEM_CRYPTO_API.includes(f.name)).map(f => f.name);
let hooked = 0; const hooked = [];
functions.forEach(func => { functions.forEach(func => {
if (func.type !== 'function') return;
const {name: funcName, address: funcAddr} = func; const {name: funcName, address: funcAddr} = func;
if (func.type !== 'function' || hooked.includes(funcAddr)) return;
try { try {
if (funcName.includes('UsePrivacyMode')) { if (funcName.includes('UsePrivacyMode')) {
@ -296,14 +296,14 @@ const hookLibrary = (name) => {
return; return;
} }
hooked++; hooked.push(funcAddr);
print(Level.DEBUG, `Hooked (${funcAddr}): ${funcName}`); print(Level.DEBUG, `Hooked (${funcAddr}): ${funcName}`);
} catch (e) { } catch (e) {
print(Level.ERROR, `${e.message} for ${funcName}`); print(Level.ERROR, `${e.message} for ${funcName}`);
} }
}); });
if (hooked < 3) { if (hooked.length < 3) {
print(Level.CRITICAL, 'Insufficient functions hooked.'); print(Level.CRITICAL, 'Insufficient functions hooked.');
return false; return false;
} }