device: Add unpair()

This commit is contained in:
Ole André Vadla Ravnås
2023-10-09 13:04:30 +02:00
parent 1d35663c97
commit 3e489dff85
4 changed files with 34 additions and 1 deletions
+5
View File
@@ -299,6 +299,11 @@ class Device(Object):
Open a device-specific communication channel.
"""
...
def unpair(self) -> None:
"""
Unpair device.
"""
...
def query_system_parameters(self) -> Dict[str, Any]:
"""
Returns a dictionary of information about the host system.
+4
View File
@@ -0,0 +1,4 @@
import frida
device = frida.get_usb_device()
device.unpair()
+8
View File
@@ -1035,6 +1035,14 @@ class Device:
return IOStream(self._impl.open_channel(address))
@cancellable
def unpair(self) -> None:
"""
Unpair device
"""
self._impl.unpair()
@cancellable
def get_bus(self) -> Bus:
"""
+17 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2022 Ole André Vadla Ravnås <oleavr@nowsecure.com>
* Copyright (C) 2013-2023 Ole André Vadla Ravnås <oleavr@nowsecure.com>
*
* Licence: wxWindows Library Licence, Version 3.1
*/
@@ -389,6 +389,7 @@ static FridaSessionOptions * PyDevice_parse_session_options (const gchar * realm
static PyObject * PyDevice_inject_library_file (PyDevice * self, PyObject * args);
static PyObject * PyDevice_inject_library_blob (PyDevice * self, PyObject * args);
static PyObject * PyDevice_open_channel (PyDevice * self, PyObject * args);
static PyObject * PyDevice_unpair (PyDevice * self);
static PyObject * PyApplication_new_take_handle (FridaApplication * handle);
static int PyApplication_init (PyApplication * self, PyObject * args, PyObject * kw);
@@ -565,6 +566,7 @@ static PyMethodDef PyDevice_methods[] =
{ "inject_library_file", (PyCFunction) PyDevice_inject_library_file, METH_VARARGS, "Inject a library file to a PID." },
{ "inject_library_blob", (PyCFunction) PyDevice_inject_library_blob, METH_VARARGS, "Inject a library blob to a PID." },
{ "open_channel", (PyCFunction) PyDevice_open_channel, METH_VARARGS, "Open a device-specific communication channel." },
{ "unpair", (PyCFunction) PyDevice_unpair, METH_NOARGS, "Unpair device." },
{ NULL }
};
@@ -2835,6 +2837,20 @@ PyDevice_open_channel (PyDevice * self, PyObject * args)
return PyIOStream_new_take_handle (stream);
}
static PyObject *
PyDevice_unpair (PyDevice * self)
{
GError * error = NULL;
Py_BEGIN_ALLOW_THREADS
frida_device_unpair_sync (PY_GOBJECT_HANDLE (self), g_cancellable_get_current (), &error);
Py_END_ALLOW_THREADS
if (error != NULL)
return PyFrida_raise (error);
Py_RETURN_NONE;
}
static PyObject *
PyApplication_new_take_handle (FridaApplication * handle)