I try to use frida with such codes:
manager = frida.get_device_manager()
devices = manager.enumerate_devices()
for ldevice in devices:
print('Device discovered: '+str(ldevice))
# A Google Pixel
device = manager.get_device('FA74D0301125')
Python output:
Device discovered: Device(id="local", name="Local System", type='local')
Device discovered: Device(id="tcp", name="Local TCP", type='remote')
InvalidArgumentError('device not found')
You can see that frida cannot discover the usb device, but in fact adb program can discover it:
PS> adb devices
List of devices attached
FA74D0301125 device
I also use this code but not work:
device = frida.get_usb_device()
I have already running the frida-server as root on the Google Pixel device. I don't know what's wrong with my phone? Please help, thanks.
More system infomation:
```
PC: Windows 10 Home Version 1909
Python: 3.7
Phone: Google Pixel (sailfish) with Android 9 by Lineage OS 16.0
Try running:
device = frida.get_usb_device(1)
I had this bug as well but adding a time delay of 1 second seems to fix it.
@kliuz I have tried this code but it does not work for my phone, thanks anyway~
I also have this issue.
The device is not detected by frida:
> frida-ls-devices
Id Type Name
----- ------ ------------
local local Local System
tcp remote Local TCP
But it shows up fine in ADB:
> adb devices
List of devices attached
FA71E3400239 device
Not found using the -D option
> frida-ps -D FA71E3400239
Device 'FA71E3400239' not found
Using the -U option and it works:
> frida-ps -U
PID Name
----- --------------------------------------------------
1010 adbd
3029 android.process.acore
26186 android.process.media
I also have this issue.
The device is not detected by frida:
> frida-ls-devices Id Type Name ----- ------ ------------ local local Local System tcp remote Local TCPBut it shows up fine in ADB:
> adb devices List of devices attached FA71E3400239 deviceNot found using the -D option
> frida-ps -D FA71E3400239 Device 'FA71E3400239' not foundUsing the -U option and it works:
> frida-ps -U PID Name ----- -------------------------------------------------- 1010 adbd 3029 android.process.acore 26186 android.process.media
Have you solved it?
No I have not solved it, just did a very ugly hack for now and forced it to use the USB device. This is not ideal because I want to connect to multiple frida servers
is ok running the frida-server as root on the Google Pixel device ? @wrlu
My solution is to reduce the Frida version to 12.6.8, and the Frida tools version to 2.1.0. The latest version of Frida is not compatible with systems other than Android native @willish @wrlu
I encounter the same issue,and solve like this
import sys
import threading
PACKAGE = 'xxxx'
def get_device():
mgr = frida.get_device_manager()
changed = threading.Event()
def on_changed():
changed.set()
mgr.on('changed', on_changed)
device = None
while device is None:
devices = [dev for dev in mgr.enumerate_devices() if dev.type =='usb']
if len(devices) == 0:
print ('Waiting for usb device...')
changed.wait()
else:
device = devices[0]
mgr.off('changed', on_changed)
return device;
if __name__ == '__main__':
jscode = open('script.js', 'r').read()
device = get_device()
print(device)
process = device.attach(PACKAGE)
print(process)
script = process.create_script(jscode)
script.load()
sys.stdin.read()
@kliuz I solve this problem by use my another Nexus 6P phone with Android 8.1. Thanks for your help~
I encounter the same issue,and solve like this
import sys import threading PACKAGE = 'xxxx' def get_device(): mgr = frida.get_device_manager() changed = threading.Event() def on_changed(): changed.set() mgr.on('changed', on_changed) device = None while device is None: devices = [dev for dev in mgr.enumerate_devices() if dev.type =='usb'] if len(devices) == 0: print ('Waiting for usb device...') changed.wait() else: device = devices[0] mgr.off('changed', on_changed) return device; if __name__ == '__main__': jscode = open('script.js', 'r').read() device = get_device() print(device) process = device.attach(PACKAGE) print(process) script = process.create_script(jscode) script.load() sys.stdin.read()
it work
Thanks, it does work
我遇到同样的问题,并像这样解决
import sys import threading PACKAGE = 'xxxx' def get_device(): mgr = frida.get_device_manager() changed = threading.Event() def on_changed(): changed.set() mgr.on('changed', on_changed) device = None while device is None: devices = [dev for dev in mgr.enumerate_devices() if dev.type =='usb'] if len(devices) == 0: print ('Waiting for usb device...') changed.wait() else: device = devices[0] mgr.off('changed', on_changed) return device; if __name__ == '__main__': jscode = open('script.js', 'r').read() device = get_device() print(device) process = device.attach(PACKAGE) print(process) script = process.create_script(jscode) script.load() sys.stdin.read()这行得通
This is useful ! Thanks ~
Most helpful comment
Try running:
device = frida.get_usb_device(1)I had this bug as well but adding a time delay of 1 second seems to fix it.