How to use the frida.getDeviceManager function in frida

To help you get started, we’ve selected a few frida examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chaitin / passionfruit / lib / channelsv2.js View on Github external
agent.message.connect((message, data) => {
    if (message.type === 'error') {
      console.error('error message from frida'.red)
      console.error((message.stack || message).red)
    } else if (message.type === 'send') {
      // todo
    }
  })

  await agent.load()
  socket.emit('ready')
})


const mgr = frida.getDeviceManager()
const connected = new Map()

export function attach(server) {
  socket.attach(server)

  const wrap = tag => device =>
    devices.emit(tag, new Device(device).valueOf())

  const added = wrap('DEVICE_ADD')
  const removed = wrap('DEVICE_REMOVE')
  mgr.added.connect(added)
  mgr.removed.connect(removed)
  connected.set(server, [added, removed])
}

export function detach(server) {
github FuzzySecurity / Fermion / Fermion / src / render.js View on Github external
async function updateDeviceList() {
	// Get dropdown array
	var dn = document.getElementById("deviceName");
	var currentDevice = dn.options[deviceName.selectedIndex].value;
	var dnArr = Array.from(dn.options).map(elem => elem.text);

	// Get device array
	var dm = frida.getDeviceManager();
	var dev = await dm.enumerateDevices();
	var devArr = dev.map(elem => elem.id);

	// Does the current device still exist?
	if (!devArr.includes(currentDevice)) {
		// Local is always a valid target
		dn.selectedIndex = 0;
		deviceId = 'local';
	}

	// Remove stale entries from the dropdown
	dnArr.forEach(function(elem) {
		if (!devArr.includes(elem)) {
			$(`#deviceName option:contains("${elem}")`).remove()
		}
	})
github chaitin / passionfruit / lib / channels.js View on Github external
const frida = require('frida')
const socketIO = require('socket.io')
const { RpcHandler } = require('./rpc')
const { serializeDevice, serializeApp, FridaUtil } = require('./utils')


const io = socketIO({ path: '/msg' })
const channels = {}

for (const namespace of ['devices', 'session'])
  channels[namespace] = io.of(`/${namespace}`)

const deviceMgr = frida.getDeviceManager()
deviceMgr.added.connect(async device => channels.devices.emit('deviceAdd', serializeDevice(device)))
deviceMgr.removed.connect(async device => channels.devices.emit('deviceRemove', serializeDevice(device)))

channels.session.on('connection', async(socket) => {
  const { device, bundle } = socket.handshake.query

  let dev, session, app

  if (!device || !bundle) {
    socket.emit('err', 'invalid parameters')
    socket.disconnect(true)
    return
  }

  try {
    dev = await frida.getDevice(device)
github FuzzySecurity / Fermion / Fermion / src / proc.html View on Github external
async function getDeviceList() {
			var dm = await frida.getDeviceManager();
			var dev = await dm.enumerateDevices();
			return dev;
		}
github chaitin / passionfruit / lib / device.js View on Github external
static remove(host) {
    return getDeviceManager().removeRemoteDevice(host)
  }
github chaitin / passionfruit / lib / device.js View on Github external
static async connect(host) {
    return new ExtendedDevice(await getDeviceManager().addRemoteDevice(host))
  }
github oleavr / frida-tool-example / lib / application.ts View on Github external
return this.scheduler.perform("Getting device", async (): Promise => {
            let device: frida.Device;

            switch (targetDevice.kind) {
                case "local":
                    device = await frida.getLocalDevice();
                    break;
                case "usb":
                    device = await frida.getUsbDevice();
                    break;
                case "remote":
                    device = await frida.getRemoteDevice();
                    break;
                case "by-host":
                    device = await frida.getDeviceManager().addRemoteDevice(targetDevice.host);
                    break;
                case "by-id":
                    device = await frida.getDevice(targetDevice.id);
                    break;
                default:
                    throw new Error("Invalid target device");
            }

            return device;
        });
    }

frida

Inject JavaScript to explore native apps on Windows, Mac, Linux, iOS and Android

LGPL-2.0 WITH WxWindows-excep…
Latest version published 5 days ago

Package Health Score

68 / 100
Full package analysis