octopus.frida.instrument_gated
- class octopus.frida.instrument_gated.FridaGatedInstrumentation(frida_device, capture_manager)[source]
Bases:
ThreadThread that manages Frida-based gated instrumentation of spawned processes.
Uses Frida’s spawn gating mechanism to intercept newly spawned processes, attach to them, inject an agent script, and invoke tracing APIs before resuming execution.
- pending
List of spawned processes waiting to be instrumented.
- sessions
List of active Frida sessions for instrumented processes.
- scripts
List of loaded Frida scripts for instrumented processes.
- event
Threading event used to signal new pending spawns.
- run()[source]
Entry point for the instrumentation thread.
Delegates to
start_instrumentation().
- start_instrumentation()[source]
Enable spawn gating and instrument each intercepted process.
Enables Frida spawn gating on the target device, then enters a loop waiting for new spawns. For each spawn with a known identifier, it attaches a Frida session, loads the agent script, invokes available tracing APIs, and resumes the process.
- event = <threading.Event at 0x7f5ef6f48380: unset>
Event signaled when a new spawn is added to the pending list.
- pending = []
List of spawned processes pending instrumentation.
- scripts = []
List of loaded Frida script instances.
- sessions = []
List of active Frida attach sessions.
- octopus.frida.instrument_gated.on_message(capture_manager, spawn, message, script)[source]
Handle messages received from an injected Frida script.
Processes control messages (e.g. offset_hooking, pattern_hooking) by posting the appropriate response back to the script. Captures data payloads via the capture manager, with special handling for friTap SSL keylog data.
- Parameters:
- octopus.frida.instrument_gated.on_spawned(spawn)[source]
Handle a newly spawned process detected by Frida’s spawn gating.
Appends the spawn to the pending list and signals the instrumentation thread to process it.
- Parameters:
spawn (object) – The spawn object provided by Frida containing process info.