31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
"""统一 bypass 加载器 — 所有 runner 共用.
|
|
|
|
用法:
|
|
from bypass_loader import load_bypass
|
|
s = d.attach(pid) # spawn 后、resume 前
|
|
load_bypass(s) # 默认 patch_guard 3s
|
|
load_bypass(s, patch_guard_delay_ms=5000, persist=True)
|
|
d.resume(pid)
|
|
|
|
参数经 globalThis.BYPASS_OPTS 注入 hook (见 tools/frida/bypass_all.js 头注释).
|
|
"""
|
|
from __future__ import annotations
|
|
import json
|
|
from pathlib import Path
|
|
|
|
HERE = Path(__file__).resolve().parent.parent
|
|
BYPASS_SRC = (HERE / "tools/frida/bypass_all.js").read_text()
|
|
|
|
|
|
def load_bypass(script_session, patch_guard_delay_ms: int = 3000, persist: bool = False):
|
|
"""spawn 挂起态调用: 单脚本装载三层绕过 (maps 掩盖立即生效, 终止拦截延迟生效)."""
|
|
src = (
|
|
"globalThis.BYPASS_OPTS = "
|
|
+ json.dumps({"patchGuardDelayMs": patch_guard_delay_ms, "persist": persist})
|
|
+ ";\n" + BYPASS_SRC
|
|
)
|
|
sc = script_session.create_script(src)
|
|
sc.load()
|
|
return sc
|