How to use the frida.getDevice 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 FuzzySecurity / Fermion / Fermion / src / render.js View on Github external
async function start(Path, Args) {
	// Exit on process termination
	process.on('SIGTERM', stop);
	process.on('SIGINT', stop);

	// Attach and load script
	device = await frida.getDevice(deviceId);
	if (!Args || 0 === Args.length) {
		procID = await device.spawn(Path);
	} else {
		procID = await device.spawn([Path,Args]);
	}
	session = await device.attach(procID);
	session.detached.connect(onDetached);
	script = await session.createScript(MonacoCodeEditor.getValue());

	// For performance we can't update the text area all the time
	// it will lock the UI on big volumes of data. Instead we append
	// to an array using a mutex and every X ms we flush the array
	// to the text area
	script.message.connect(message => {
		ChangeLogExclusive(logMutex, 'Append', message.payload);
		setTimeout(function () {
github FuzzySecurity / Fermion / Fermion / src / render.js View on Github external
async function inject(AttachTo) {
	// Exit on process termination
	process.on('SIGTERM', stop);
	process.on('SIGINT', stop);

	// Attach and load script
	device = await frida.getDevice(deviceId);
	session = await device.attach(AttachTo);
	session.detached.connect(onDetached);
	script = await session.createScript(MonacoCodeEditor.getValue());

	// For performance we can't update the text area all the time
	// it will lock the UI on big volumes of data. Instead we append
	// to an array using a mutex and every X ms we flush the array
	// to the text area
	script.message.connect(message => {
		ChangeLogExclusive(logMutex, 'Append', message.payload);
		setTimeout(function () {
			if (RunningLog.length > 0) {
				ChangeLogExclusive(logMutex, 'Write', message.payload);
			}
		}, 500);
	});
github FuzzySecurity / Fermion / Fermion / src / proc.html View on Github external
async function getProcList() {
			// Make sure the device list has updated
			if (atob(deviceId) != "local") {
				for (i = 0; i < 3; i++) {
					var dev = await getDeviceList();
					if (dev.length > 2) {
						break;
					}
					await sleep(1000);
				}
			}
			let currentDevice = await frida.getDevice(atob(deviceId));
			let Applications = await currentDevice.enumerateProcesses();
			return Applications;
		}
		getProcList().then(data => {
github chaitin / passionfruit / lib / channels.js View on Github external
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)
    if (!FridaUtil.isUSB(dev)) throw new Error('device not found')

    const apps = await dev.enumerateApplications()
    app = apps.find(item => item.identifier === bundle)
    if (!app) throw new Error('app not installed')

    socket.emit('app', {
      device: serializeDevice(dev),
      app: serializeApp(app),
    })

    if (app.pid) {
      const front = await dev.getFrontmostApplication()
      if (front && front.pid === app.pid) {
        session = await dev.attach(app.name)
      } else {
github nowsecure / frida-trace / example / lib / application.js View on Github external
async run(target) {
    const device = await frida.getDevice(target.device);
    this._device = device;

    const onOutput = this._onOutput.bind(this);
    device.output.connect(onOutput);

    try {
      const spawn = target.hasOwnProperty('argv');

      let pid;
      if (spawn)
        pid = await device.spawn(target.argv);
      else
        pid = target.pid;
      this._pid = pid;

      const session = await device.attach(pid);
github oleavr / frida-tool-example / lib / application.ts View on Github external
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;
        });
    }
github nowsecure / airspy / 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-id":
                    device = await frida.getDevice(targetDevice.id);
                    break;
                default:
                    throw new Error("Invalid target device");
            }

            return device;
        });
    }
github FuzzySecurity / Fermion / Fermion / src / render.js View on Github external
async function getProcList() {
	let currentDevice = await frida.getDevice(deviceId);
	let Applications = await currentDevice.enumerateProcesses();
	return Applications;
}

frida

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

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

Package Health Score

66 / 100
Full package analysis