mirror of
https://github.com/frida/frida-python
synced 2026-06-08 14:16:17 +00:00
Add Device.query_system_parameters()
This commit is contained in:
committed by
Ole André Vadla Ravnås
parent
f46e476474
commit
abfbe016c3
@@ -50,6 +50,10 @@ TransportError = _frida.TransportError
|
||||
OperationCancelledError = _frida.OperationCancelledError
|
||||
|
||||
|
||||
def query_system_parameters(**kwargs):
|
||||
return get_local_device().query_system_parameters(**kwargs)
|
||||
|
||||
|
||||
def spawn(*args, **kwargs):
|
||||
return get_local_device().spawn(*args, **kwargs)
|
||||
|
||||
|
||||
@@ -93,6 +93,10 @@ class Device(object):
|
||||
def is_lost(self):
|
||||
return self._impl.is_lost()
|
||||
|
||||
@cancellable
|
||||
def query_system_parameters(self):
|
||||
return self._impl.query_system_parameters()
|
||||
|
||||
@cancellable
|
||||
def get_frontmost_application(self):
|
||||
return self._impl.get_frontmost_application()
|
||||
|
||||
@@ -349,6 +349,7 @@ static void PyDevice_init_from_handle (PyDevice * self, FridaDevice * handle);
|
||||
static void PyDevice_dealloc (PyDevice * self);
|
||||
static PyObject * PyDevice_repr (PyDevice * self);
|
||||
static PyObject * PyDevice_is_lost (PyDevice * self);
|
||||
static PyObject * PyDevice_query_system_parameters (PyDevice * self);
|
||||
static PyObject * PyDevice_get_frontmost_application (PyDevice * self);
|
||||
static PyObject * PyDevice_enumerate_applications (PyDevice * self);
|
||||
static PyObject * PyDevice_enumerate_processes (PyDevice * self);
|
||||
@@ -528,6 +529,7 @@ static PyMethodDef PyDeviceManager_methods[] =
|
||||
static PyMethodDef PyDevice_methods[] =
|
||||
{
|
||||
{ "is_lost", (PyCFunction) PyDevice_is_lost, METH_NOARGS, "Query whether the device has been lost." },
|
||||
{ "query_system_parameters", (PyCFunction) PyDevice_query_system_parameters, METH_NOARGS, "Returns a dictionary of information about the host system." },
|
||||
{ "get_frontmost_application", (PyCFunction) PyDevice_get_frontmost_application, METH_NOARGS, "Get details about the frontmost application." },
|
||||
{ "enumerate_applications", (PyCFunction) PyDevice_enumerate_applications, METH_NOARGS, "Enumerate applications." },
|
||||
{ "enumerate_processes", (PyCFunction) PyDevice_enumerate_processes, METH_NOARGS, "Enumerate processes." },
|
||||
@@ -2785,6 +2787,25 @@ PyDevice_is_lost (PyDevice * self)
|
||||
return PyBool_FromLong (is_lost);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
PyDevice_query_system_parameters (PyDevice * self)
|
||||
{
|
||||
GError * error = NULL;
|
||||
GHashTable * result;
|
||||
PyObject * parameters;
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
result = frida_device_query_system_parameters_sync (PY_GOBJECT_HANDLE (self), g_cancellable_get_current (), &error);
|
||||
Py_END_ALLOW_THREADS
|
||||
if (error != NULL)
|
||||
return PyFrida_raise (error);
|
||||
|
||||
parameters = PyGObject_marshal_parameters_dict (result);
|
||||
g_hash_table_unref (result);
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
PyDevice_get_frontmost_application (PyDevice * self)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user