const frida = require('..'); const processName = process.argv[2]; const source = ` rpc.exports = { listThreads: function () { return Process.enumerateThreadsSync(); } }; `; async function main() { const systemSession = await frida.attach(0); const bytecode = await systemSession.compileScript(source, { name: 'bytecode-example' }); const session = await frida.attach(processName); const script = await session.createScriptFromBytes(bytecode); script.message.connect(message => { console.log('[*] Message:', message); }); await script.load(); console.log('[*] Called listThreads() =>', await script.exports.listThreads()); await script.unload(); } main() .catch(e => { console.error(e); });