Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static async find(partialId) {
const list = await frida.enumerateDevices()
for (let dev of list)
if (dev.id.startsWith(partialId))
return new Device(dev)
throw new Error(`Unable to find device that matches id == ${partialId}`)
}
static async getDevice(id) {
const list = await frida.enumerateDevices()
const dev = list.find(d => d.id === id && FridaUtil.isUSB(d))
if (dev) return dev
throw new DeviceNotFoundError(id)
}
static async list() {
const notLocal = device => !['local', 'tcp'].includes(device.id)
const all = await enumerateDevices()
return all.filter(notLocal).map(serializeDevice)
}