Install Node.js 5.x, then:
npm install frida co uuid
and run:
node app.js
Install Node.js 5.x, then:
npm install frida co uuid
and run:
node app.js
| 'use strict'; | |
| const uuid = require('uuid'); | |
| rpc.exports = { | |
| init() { | |
| Interceptor.attach(Module.findExportByName('libsystem_kernel.dylib', 'open'), { | |
| onEnter(args) { | |
| send(['open', Memory.readUtf8String(args[0])]); | |
| } | |
| }); | |
| return uuid.v4(); | |
| } | |
| }; | 
| 'use strict'; | |
| const co = require('co'); | |
| const frida = require('frida'); | |
| let session, script; | |
| co(function *() { | |
| const source = yield frida.load(require.resolve('./agent.js')); | |
| const device = yield frida.getUsbDevice(); | |
| const pid = yield device.spawn(['com.atebits.Tweetie2']); | |
| session = yield device.attach(pid); | |
| script = yield session.createScript(source); | |
| script.events.listen('message', onMessage); | |
| yield script.load(); | |
| const api = yield script.getExports(); | |
| const id = yield api.init(); | |
| console.log('Got ID:', id); | |
| yield device.resume(pid); | |
| }) | |
| .catch(onError); | |
| function onError(error) { | |
| console.error(error.stack); | |
| } | |
| function onMessage(message, data) { | |
| if (message.type === 'send') { | |
| console.log(message.payload); | |
| } else if (message.type === 'error') { | |
| console.error(message.stack); | |
| } else { | |
| console.log(message); | |
| } | |
| } |