Compare commits

...
43 Commits
Author SHA1 Message Date
Ole André Vadla Ravnås bca04adce4 subprojects: Prepare for release 2026-06-16 16:40:22 +02:00
Ole André Vadla Ravnås a9c2672611 subprojects: Bump outdated 2026-06-16 16:38:35 +02:00
Ole André Vadla Ravnås abe0be49f0 script: Add interrupt() and terminate()
Wire up the new frida-core Script.interrupt() and terminate() methods:

  - interrupt() aborts any JavaScript currently executing, leaving the
    script loaded and able to run again.
  - terminate() interrupts execution and unloads the script, so one
    stuck in a long-running or infinite operation can still be torn
    down.
2026-06-16 16:36:43 +02:00
Ole André Vadla Ravnås a3c832be83 subprojects: Prepare for release 2026-06-15 19:09:31 +02:00
Ole André Vadla Ravnås 6580a0492b subprojects: Bump outdated 2026-06-15 19:08:48 +02:00
Ole André Vadla Ravnås c5f80e2c38 subprojects: Prepare for release 2026-06-12 00:46:13 +02:00
Ole André Vadla Ravnås 2c1bccddd0 typing: Add Device.override_option()
The wrapper in frida.core calls it, but the _frida stub lacked it,
tripping up mypy.
2026-06-12 00:46:13 +02:00
Ole André Vadla Ravnås 6f6940b097 subprojects: Bump outdated 2026-06-12 00:14:03 +02:00
Ole André Vadla Ravnås 308bcd7328 subprojects: Bump outdated 2026-06-11 22:56:42 +02:00
Ole André Vadla Ravnås c2f541aa7f submodules: Bump releng 2026-06-11 22:56:42 +02:00
Ole André Vadla Ravnås 2e73698ac7 subprojects: Bump outdated 2026-06-11 20:26:14 +02:00
Ole André Vadla Ravnås 18f2749037 submodules: Bump releng 2026-06-11 20:26:14 +02:00
Ole André Vadla Ravnås 80bd66fd6d subprojects: Prepare for release 2026-06-10 00:48:02 +02:00
Ole André Vadla Ravnås 32d1c921c9 subprojects: Bump outdated 2026-06-10 00:47:02 +02:00
Ole André Vadla Ravnås dbe7868509 subprojects: Prepare for release 2026-06-05 17:08:11 +02:00
Ole André Vadla Ravnås a0867d30b9 subprojects: Bump outdated 2026-06-05 17:06:50 +02:00
Ole André Vadla Ravnås 0666e8d33c subprojects: Bump outdated 2026-06-05 17:00:09 +02:00
Ole André Vadla Ravnås 60c30102bf subprojects: Bump outdated 2026-06-05 01:14:18 +02:00
Ole André Vadla Ravnås d50d5cc6d0 subprojects: Bump outdated 2026-06-05 00:56:11 +02:00
Ole André Vadla Ravnås ddeaad5254 submodules: Bump releng 2026-06-05 00:56:11 +02:00
Ole André Vadla Ravnås c68cd908d3 subprojects: Prepare for release 2026-06-02 02:10:44 +02:00
Ole André Vadla Ravnås 5b6d9f378a subprojects: Bump outdated 2026-06-02 02:09:03 +02:00
Ole André Vadla Ravnås 0839e57d3b subprojects: Bump outdated 2026-06-02 01:41:18 +02:00
Ole André Vadla Ravnås 5215b5b2c8 subprojects: Prepare for release 2026-05-31 21:03:59 +02:00
Ole André Vadla Ravnås 54dca1d5da subprojects: Bump outdated 2026-05-31 21:03:09 +02:00
Ole André Vadla Ravnås 8eafeb24d9 submodules: Bump releng 2026-05-31 21:03:09 +02:00
Ole André Vadla Ravnås 1b75d93858 subprojects: Bump outdated 2026-05-31 13:13:33 +02:00
Ole André Vadla Ravnås c2145f3589 Add support for new attach options 2026-05-31 12:32:06 +02:00
Ole André Vadla Ravnås 0a9995df51 subprojects: Prepare for release 2026-05-23 14:22:35 +02:00
Ole André Vadla Ravnås 0f3ffd4032 subprojects: Bump outdated 2026-05-23 14:21:34 +02:00
Ole André Vadla Ravnås 2da64cb7ca subprojects: Bump outdated 2026-05-21 23:19:27 +02:00
Ole André Vadla Ravnås f81c3183a1 subprojects: Prepare for release 2026-05-15 14:23:34 +02:00
Ole André Vadla Ravnås d2861db65b subprojects: Bump outdated 2026-05-15 14:22:01 +02:00
Ole André Vadla Ravnås 06210bec40 subprojects: Prepare for release 2026-05-14 20:21:16 +02:00
Ole André Vadla Ravnås 4934e18a0e subprojects: Bump outdated 2026-05-14 20:20:05 +02:00
Ole André Vadla Ravnås fe987827e9 subprojects: Prepare for release 2026-05-11 13:22:50 +02:00
Ole André Vadla Ravnås 0ef38236e8 subprojects: Bump outdated 2026-05-11 13:22:11 +02:00
Ole André Vadla Ravnås 0fab765f91 subprojects: Prepare for release 2026-05-08 10:40:06 +02:00
Ole André Vadla Ravnås a6c02cb7ee subprojects: Bump outdated 2026-05-08 10:37:49 +02:00
Ole André Vadla Ravnås 6033dd0904 subprojects: Prepare for release 2026-05-04 15:25:33 +02:00
Ole André Vadla Ravnås 77e94e24a1 subprojects: Bump outdated 2026-05-04 15:24:42 +02:00
Ole André Vadla Ravnås c97343dc83 subprojects: Prepare for release 2026-05-02 21:13:32 +02:00
Ole André Vadla Ravnås e1ffe5fd50 subprojects: Bump outdated 2026-05-02 21:12:51 +02:00
6 changed files with 192 additions and 13 deletions

No files matched your search

+19 -3
View File
@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
try:
from . import _frida
@@ -86,14 +86,30 @@ def kill(target: core.ProcessTarget) -> None:
def attach(
target: core.ProcessTarget, realm: Optional[str] = None, persist_timeout: Optional[int] = None
target: core.ProcessTarget,
realm: Optional[str] = None,
persist_timeout: Optional[int] = None,
exceptor: Optional[str] = None,
unwind_broker: Optional[bool] = None,
exit_monitor: Optional[bool] = None,
thread_suspend_monitor: Optional[bool] = None,
linker_notifier_offsets: Optional[Sequence[int]] = None,
) -> core.Session:
"""
Attach to a process
:param target: the PID or name of the process
"""
return get_local_device().attach(target, realm=realm, persist_timeout=persist_timeout)
return get_local_device().attach(
target,
realm=realm,
persist_timeout=persist_timeout,
exceptor=exceptor,
unwind_broker=unwind_broker,
exit_monitor=exit_monitor,
thread_suspend_monitor=thread_suspend_monitor,
linker_notifier_offsets=linker_notifier_offsets,
)
def inject_library_file(target: core.ProcessTarget, path: str, entrypoint: str, data: str) -> int:
+29 -1
View File
@@ -256,7 +256,17 @@ class Device(Object):
"""
...
def attach(self, pid: int, realm: Optional[str] = None, persist_timeout: Optional[int] = None) -> "Session":
def attach(
self,
pid: int,
realm: Optional[str] = None,
persist_timeout: Optional[int] = None,
exceptor: Optional[str] = None,
unwind_broker: Optional[bool] = None,
exit_monitor: Optional[bool] = None,
thread_suspend_monitor: Optional[bool] = None,
linker_notifier_offsets: Optional[Sequence[int]] = None,
) -> "Session":
"""
Attach to a PID.
"""
@@ -354,6 +364,12 @@ class Device(Object):
"""
...
def override_option(self, name: str, value: Any) -> None:
"""
Override a backend-specific option.
"""
...
def query_system_parameters(self) -> Dict[str, Any]:
"""
Returns a dictionary of information about the host system.
@@ -611,6 +627,12 @@ class Script(Object):
"""
...
def interrupt(self) -> None:
"""
Interrupt any JavaScript currently executing in the script.
"""
...
def post(self, message: str, data: Optional[Union[str, bytes]] = None) -> None:
"""
Post a JSON-encoded message to the script.
@@ -623,6 +645,12 @@ class Script(Object):
"""
...
def terminate(self) -> None:
"""
Interrupt execution and unload the script.
"""
...
def enable_debugger(self, port: Optional[int]) -> None:
"""
Enable the Node.js compatible script debugger
+110 -6
View File
@@ -420,7 +420,7 @@ static PyObject * PyDevice_input (PyDevice * self, PyObject * args);
static PyObject * PyDevice_resume (PyDevice * self, PyObject * args);
static PyObject * PyDevice_kill (PyDevice * self, PyObject * args);
static PyObject * PyDevice_attach (PyDevice * self, PyObject * args, PyObject * kw);
static FridaSessionOptions * PyDevice_parse_session_options (const gchar * realm_value, guint persist_timeout);
static FridaSessionOptions * PyDevice_parse_session_options (const gchar * realm_value, guint persist_timeout, const gchar * exceptor_value, gint unwind_broker, gint exit_monitor, gint thread_suspend_monitor, PyObject * linker_notifier_offsets_value);
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);
@@ -492,7 +492,9 @@ static FridaPortalOptions * PySession_parse_portal_options (const gchar * certif
static PyObject * PyScript_new_take_handle (FridaScript * handle);
static PyObject * PyScript_is_destroyed (PyScript * self);
static PyObject * PyScript_load (PyScript * self);
static PyObject * PyScript_interrupt (PyScript * self);
static PyObject * PyScript_unload (PyScript * self);
static PyObject * PyScript_terminate (PyScript * self);
static PyObject * PyScript_eternalize (PyScript * self);
static PyObject * PyScript_post (PyScript * self, PyObject * args, PyObject * kw);
static PyObject * PyScript_enable_debugger (PyScript * self, PyObject * args, PyObject * kw);
@@ -740,7 +742,9 @@ static PyMethodDef PyScript_methods[] =
{
{ "is_destroyed", (PyCFunction) PyScript_is_destroyed, METH_NOARGS, "Query whether the script has been destroyed." },
{ "load", (PyCFunction) PyScript_load, METH_NOARGS, "Load the script." },
{ "interrupt", (PyCFunction) PyScript_interrupt, METH_NOARGS, "Interrupt any JavaScript currently executing in the script." },
{ "unload", (PyCFunction) PyScript_unload, METH_NOARGS, "Unload the script." },
{ "terminate", (PyCFunction) PyScript_terminate, METH_NOARGS, "Interrupt execution and unload the script." },
{ "eternalize", (PyCFunction) PyScript_eternalize, METH_NOARGS, "Eternalize the script." },
{ "post", (PyCFunction) PyScript_post, METH_VARARGS | METH_KEYWORDS, "Post a JSON-encoded message to the script." },
{ "enable_debugger", (PyCFunction) PyScript_enable_debugger, METH_VARARGS | METH_KEYWORDS, "Enable the Node.js compatible script debugger." },
@@ -3081,21 +3085,43 @@ static PyObject *
PyDevice_attach (PyDevice * self, PyObject * args, PyObject * kw)
{
PyObject * result = NULL;
static char * keywords[] = { "pid", "realm", "persist_timeout", NULL };
static char * keywords[] = {
"pid",
"realm",
"persist_timeout",
"exceptor",
"unwind_broker",
"exit_monitor",
"thread_suspend_monitor",
"linker_notifier_offsets",
NULL
};
long pid;
char * realm_value = NULL;
unsigned int persist_timeout = 0;
char * exceptor_value = NULL;
int unwind_broker = -1;
int exit_monitor = -1;
int thread_suspend_monitor = -1;
PyObject * linker_notifier_offsets_value = NULL;
FridaSessionOptions * options = NULL;
GError * error = NULL;
FridaSession * handle;
if (!PyArg_ParseTupleAndKeywords (args, kw, "l|esI", keywords,
if (!PyArg_ParseTupleAndKeywords (args, kw, "l|esIespppO", keywords,
&pid,
"utf-8", &realm_value,
&persist_timeout))
&persist_timeout,
"utf-8", &exceptor_value,
&unwind_broker,
&exit_monitor,
&thread_suspend_monitor,
&linker_notifier_offsets_value))
return NULL;
options = PyDevice_parse_session_options (realm_value, persist_timeout);
options = PyDevice_parse_session_options (realm_value, persist_timeout,
exceptor_value, unwind_broker, exit_monitor, thread_suspend_monitor,
linker_notifier_offsets_value);
if (options == NULL)
goto beach;
@@ -3110,6 +3136,7 @@ PyDevice_attach (PyDevice * self, PyObject * args, PyObject * kw)
beach:
g_clear_object (&options);
PyMem_Free (exceptor_value);
PyMem_Free (realm_value);
return result;
@@ -3117,7 +3144,12 @@ beach:
static FridaSessionOptions *
PyDevice_parse_session_options (const gchar * realm_value,
guint persist_timeout)
guint persist_timeout,
const gchar * exceptor_value,
gint unwind_broker,
gint exit_monitor,
gint thread_suspend_monitor,
PyObject * linker_notifier_offsets_value)
{
FridaSessionOptions * options;
@@ -3135,6 +3167,50 @@ PyDevice_parse_session_options (const gchar * realm_value,
frida_session_options_set_persist_timeout (options, persist_timeout);
if (exceptor_value != NULL)
{
FridaExceptor exceptor;
if (!PyGObject_unmarshal_enum (exceptor_value, FRIDA_TYPE_EXCEPTOR, &exceptor))
goto propagate_error;
frida_session_options_set_exceptor (options, exceptor);
}
if (unwind_broker != -1)
frida_session_options_set_unwind_broker (options, unwind_broker);
if (exit_monitor != -1)
frida_session_options_set_exit_monitor (options, exit_monitor);
if (thread_suspend_monitor != -1)
frida_session_options_set_thread_suspend_monitor (options, thread_suspend_monitor);
if (linker_notifier_offsets_value != NULL)
{
gint n, i;
n = PySequence_Size (linker_notifier_offsets_value);
if (n == -1)
goto propagate_error;
for (i = 0; i != n; i++)
{
PyObject * element;
unsigned long offset;
element = PySequence_GetItem (linker_notifier_offsets_value, i);
if (element == NULL)
goto propagate_error;
offset = PyLong_AsUnsignedLong (element);
Py_DecRef (element);
if (offset == (unsigned long) -1 && PyErr_Occurred () != NULL)
goto propagate_error;
frida_session_options_add_linker_notifier_offset (options, offset);
}
}
return options;
propagate_error:
@@ -4340,6 +4416,20 @@ PyScript_load (PyScript * self)
PyFrida_RETURN_NONE;
}
static PyObject *
PyScript_interrupt (PyScript * self)
{
GError * error = NULL;
Py_BEGIN_ALLOW_THREADS
frida_script_interrupt_sync (PY_GOBJECT_HANDLE (self), g_cancellable_get_current (), &error);
Py_END_ALLOW_THREADS
if (error != NULL)
return PyFrida_raise (error);
PyFrida_RETURN_NONE;
}
static PyObject *
PyScript_unload (PyScript * self)
{
@@ -4354,6 +4444,20 @@ PyScript_unload (PyScript * self)
PyFrida_RETURN_NONE;
}
static PyObject *
PyScript_terminate (PyScript * self)
{
GError * error = NULL;
Py_BEGIN_ALLOW_THREADS
frida_script_terminate_sync (PY_GOBJECT_HANDLE (self), g_cancellable_get_current (), &error);
Py_END_ALLOW_THREADS
if (error != NULL)
return PyFrida_raise (error);
PyFrida_RETURN_NONE;
}
static PyObject *
PyScript_eternalize (PyScript * self)
{
+32 -1
View File
@@ -309,6 +309,15 @@ class Script:
self._impl.load()
@cancellable
def interrupt(self) -> None:
"""
Interrupt any JavaScript currently executing in the script, leaving it
loaded and able to run again
"""
self._impl.interrupt()
@cancellable
def unload(self) -> None:
"""
@@ -317,6 +326,15 @@ class Script:
self._impl.unload()
@cancellable
def terminate(self) -> None:
"""
Interrupt execution and unload the script, even if it is stuck in a
long-running or infinite operation
"""
self._impl.terminate()
@cancellable
def eternalize(self) -> None:
"""
@@ -1046,13 +1064,26 @@ class Device:
target: ProcessTarget,
realm: Optional[str] = None,
persist_timeout: Optional[int] = None,
exceptor: Optional[str] = None,
unwind_broker: Optional[bool] = None,
exit_monitor: Optional[bool] = None,
thread_suspend_monitor: Optional[bool] = None,
linker_notifier_offsets: Optional[Sequence[int]] = None,
) -> Session:
"""
Attach to a process
:param target: the PID or name of the process
"""
kwargs = {"realm": realm, "persist_timeout": persist_timeout}
kwargs = {
"realm": realm,
"persist_timeout": persist_timeout,
"exceptor": exceptor,
"unwind_broker": unwind_broker,
"exit_monitor": exit_monitor,
"thread_suspend_monitor": thread_suspend_monitor,
"linker_notifier_offsets": linker_notifier_offsets,
}
_filter_missing_kwargs(kwargs)
return Session(self._impl.attach(self._pid_of(target), **kwargs)) # type: ignore
+1 -1
Submodule releng updated: a76acfc2b5...db122dd1f0.
+1 -1
View File
@@ -1,6 +1,6 @@
[wrap-git]
url = https://github.com/frida/frida-core.git
revision = 17.9.4
revision = 17.14.0
depth = 1
[provide]