Skip to content

Instantly share code, notes, and snippets.

@oleavr
Last active June 4, 2024 15:39
Show Gist options
  • Save oleavr/6ecae99945ccba47427a to your computer and use it in GitHub Desktop.
Save oleavr/6ecae99945ccba47427a to your computer and use it in GitHub Desktop.
Frida Node.js example
var frida = require('frida');
frida.attach('cat')
.then(function (session) {
console.log('attached:', session);
return session.createScript(
'function onMessage(message) {' +
'send({ name: "pong", payload: message });' +
'recv(onMessage);' +
'}' +
'recv(onMessage);'
);
})
.then(function (script) {
console.log('script created:', script);
script.events.listen('message', function (message, data) {
console.log('message from script:', message, data);
});
script.load()
.then(function () {
console.log('script loaded');
setInterval(function () {
script.postMessage({ name: 'ping' });
}, 1000);
});
})
.catch(function (error) {
console.log('error:', error.message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment