简体   繁体   中英

Android Frida Error When A Process is Attached

From that code line:

process = frida.get_usb_device(1).attach('com.android.settings')

I got the following error:

raise _frida.ProcessNotFoundError("unable to find process with name '%s'" % process_name) frida.ProcessNotFoundError: unable to find process with name 'com.android.settings'*

Although com.android.settings is listed with frida-ps -aU command, it says unable to find process.

Don't ask me why but the developers of Frida decided that by default only the process/app name can be used to connect to an app. The app packageName (or in Frida called "identifier") can not be used by default. The app name is not the package name but the app name shown to the user (see frida-ps -aU for app name of running apps).

If you want to use package name for connecting to an Andorid app you have to manually search all apps for the matching package name to get the process id and then connect to the app using the process id:

packageName = 'com.android.settings'
device = frida.get_usb_device(1)

pid = None
for a in device.enumerate_applications():
    if a.identifier == packageName:
        pid = a.pid
        break

device.attach(pid)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM