Home

Awesome

frida-inject

With this module, you can easily inject javascript into processes.

Features

Installation

$ npm install frida-inject

Documentation

FridaInject (options): Function

Example

Simple injection

const FridaInject = require('frida-inject')

FridaInject({
  name: 'notepad++.exe',
  scripts: [
    'console.log("This is some basic injected script")',
    './some_folder'
  ],
  onAttach: session => console.log('Attached to process'),
  onDetach: (session, reason) => console.log('Detached from process'),
  onLoad: script => console.log('Script loaded'),
  onUnload: script => console.log('Script unloaded')
})

Simple injection (Bundled scripts)

Since version 0.3.0 you can provide multiple scripts into one script.
This will allow you to share a global scope.

const FridaInject = require('frida-inject')

FridaInject({
  name: 'notepad++.exe',
  scripts: [
    ['frida-ex-nativefunction', 'console.log(ExNativeFunction)']
  ]
})

Advanced injection (provided device)

const Frida = require('frida')
const FridaInject = require('frida-inject')

async function main() {
  const device = await Frida.getUsbDevice()
  const pid = await device.spawn('com.atebits.Tweetie2', {
    url: 'twitter://user?screen_name=fridadotre',
    env: {
      'OS_ACTIVITY_DT_MODE': 'YES',
      'NSUnbufferedIO': 'YES'
    },
    stdio: 'pipe'
  })

  FridaInject({
    device: device,
    pid: pid,
    scripts: [
      'console.log("This is some basic injected script")',
      './inject'
    ],
    onAttach: session => console.log('Attached to process'),
    onDetach: (session, reason) => console.log('Detached from process'),
    onLoad: script => console.log('Script loaded'),
    onUnload: script => console.log('Script unloaded')
  })
}
main()

TODO