mirror of
https://github.com/frida/frida-node.git
synced 2026-11-07 17:13:50 -10:00
35 lines
741 B
JavaScript
35 lines
741 B
JavaScript
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);
|
|
});
|