execute_in_session
Execute JavaScript code within an active Frida session to perform dynamic instrumentation, runtime analysis, and reverse engineering on mobile or desktop applications.
Instructions
Execute JavaScript code within an existing interactive Frida session.
This tool allows for dynamic scripting against a process previously attached to
via `create_interactive_session`.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
javascript_code | Yes | A string containing the JavaScript code to be executed in the target process's context. The script can use Frida's JavaScript API (e.g., Interceptor, Memory, Module, rpc). | |
keep_alive | No | A boolean flag indicating whether the script should remain loaded in the target process after its initial execution. If False (default), the script is unloaded after initial run. If True, it persists for hooks/RPC and messages are retrieved via get_session_messages. Note: With keep_alive=True, JavaScript code should manage log volume (limits, deduplication) to prevent too many messages. | |
session_id | Yes | The unique identifier of the active Frida session. This ID is obtained when the session is first created. |
Input Schema (JSON Schema)
{
"properties": {
"javascript_code": {
"description": "A string containing the JavaScript code to be executed in the target process's context. The script can use Frida's JavaScript API (e.g., Interceptor, Memory, Module, rpc).",
"title": "Javascript Code",
"type": "string"
},
"keep_alive": {
"default": false,
"description": "A boolean flag indicating whether the script should remain loaded in the target process after its initial execution. If False (default), the script is unloaded after initial run. If True, it persists for hooks/RPC and messages are retrieved via get_session_messages. Note: With keep_alive=True, JavaScript code should manage log volume (limits, deduplication) to prevent too many messages.",
"title": "Keep Alive",
"type": "boolean"
},
"session_id": {
"description": "The unique identifier of the active Frida session. This ID is obtained when the session is first created.",
"title": "Session Id",
"type": "string"
}
},
"required": [
"session_id",
"javascript_code"
],
"type": "object"
}