frida / frida-rust

Frida Rust bindings
Other
185 stars 52 forks source link

can not find any device on linux server #73

Closed MrGuoRanDuo closed 1 year ago

MrGuoRanDuo commented 1 year ago

Here a some code


pub struct Runner<'a> {
    manager: DeviceManager<'a>,
}

impl<'a> Runner<'a> {
    pub fn new() -> Self {
        Self {
            manager: DeviceManager::obtain(&FRIDA),
        }
    }

    pub fn find_device(&self, name: &String) -> Option<Device> {
        self.manager.enumerate_all_devices().into_iter().find(|d| d.get_name() == name)
    }

    pub fn get_available_device(&self) -> Vec<String> {
        self.manager.enumerate_all_devices().iter().map(|d| String::from(d.get_name())).collect()
    }
}
let devices = runner.get_available_device();
    info!("devices:{:?}", devices);
    let name = tool.getprop(device, "ro.product.vendor.model")?;
    info!("sdk info device name:{:?}", name);
    let frida_device = runner.find_device(&name).ok_or_else(|| anyhow::Error::msg(format!("can not find device named {} found {:?}", name, devices)))?;

device find result RUST: run error: can not find device named PGJM10 found ["Local System", "Local Socket"]

[root@****]# adb devices
List of devices attached
10091eb9        device
1e942224        device
3991a83f        device
53e4e14a        device
59OZPFEIZLZ5PJAI        device
8321ecd5        device
BYRSZLO7JBN7BAPN        device
EAZHLRZPE6VWMJCI        device
GARKNJL7QS9LQOEU        device
VC7PMFQWOJIVZPYT        device
Y54L6LDQ9T4D6HMZ        device
a662b01d        device
b62104d1        device
be24c414        device
be7351c2        device
c9cfb036        device
e10dee1d        device
e7394bcc        device
f244387b        device

serverA: Failed Android Debug Bridge version 1.0.41 Version 30.0.4-6686687 java version "1.8.0_241"

serverB: Success Android Debug Bridge version 1.0.39 Revision 5943271ace17-android

then I copy the serverB adb to serverA ,serverA device finder work as normaly , want to know the real reson of enumerate_all_devices can not find any device

meme commented 1 year ago

Is it possible to reproduce this with the Node.js or Python bindings? I am wondering if this is a Frida bug rather than a Frida Rust bug.

MrGuoRanDuo commented 1 year ago

prepare adb version 1.0.41 on your linux server. Just write a demo rust program contains “enumerate_all_devices ” function, will reproduce this bug ? is that ok ?

MrGuoRanDuo commented 1 year ago

@meme reproduce with python binding @v16.1.3; adb version 1.0.41 `

import frida print(frida.enumerate_devices()) [Device(id="local", name="Local System", type='local'), Device(id="socket",name="Local Socket", type='remote'), Device(id="barebone", name="GDB Remote Stub", type='remote')] another try: print(frida.get_usb_device(10)) frida.InvalidArgumentError: device not found `

I try to find enumerate_devices c source code , but no results .feels helpless. so this issue is belong to which firda project?

MrGuoRanDuo commented 1 year ago

@meme

meme commented 1 year ago

I'll close this, because like you said, this is a Frida issue, not a Frida Rust issue.