MCPInstall

global-hotpatch

Yakit 全局热加载 (Global Hot Patch) 专题。当用户需要一处配置、让 MITM 与所有 Web Fuzzer Tab 共享同一套 hook 时使用:全站透明加解密、统一签名/认证注入、动态 challenge 应答、全站染色脱敏、危险操作护栏。全局 hook 先于模块 hook 执行,同时只能启用一个。复用 beforeRequest / afterRequest / hijackHTTPRequest / hijackSaveHTTPFlow / mockHTTPRequest。

Installs
124
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/yaklang/yak-skills --skill global-hotpatch
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads global-hotpatch automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

SKILL: Yakit 全局热加载 (Global Hot Patch)

AI LOAD INSTRUCTION: 这是三层热加载体系中的"全局层"。全局热加载是 MITM 与 Web Fuzzer 共享的全系统级 hook,执行顺序为 全局 HotPatch -> 模块 HotPatch,同时只能启用 1 个。它最适合做"协议归一化"——一处定义全站加解密/签名/染色,MITM 和所有 Fuzzer Tab 自动生效。先读全局 vs 模块对比,再看 examples/ 下按 Hook 命名的示例。

0. 相关路由

  • 总入口与三层体系:yak
  • 模块级 MITM 热加载:mitm-hotpatch
  • 模块级 Web Fuzzer 热加载:webfuzzer-hotpatch

1. 全局 vs 模块

维度全局热加载模块(MITM / Fuzzer)热加载
入口配置管理 → 全局模板MITM 配置 / Fuzzer Hot Patch 窗口
作用范围全系统所有 MITM/Fuzzer 流量仅当前 MITM 任务或 Fuzzer Tab
执行顺序先于 模块 hook 执行后于全局 hook 执行
启用数量同时只能启用 1 个每个 MITM/Tab 独立
适合场景协议归一化、统一签名、全站染色、危险操作护栏单任务/单接口的特化处理
flowchart TB
    Flow["一个 HTTP 请求/响应"] --> G["全局 HotPatch (beforeRequest/afterRequest/...)"]
    G --> M["模块 HotPatch (MITM 或当前 Fuzzer Tab)"]
    M --> Done["出站 / 回显 / 入库"]

2. 可用 Hook(与 MITM 同一套,全局先执行)

全局热加载与 MITM 共用同一套 MixPluginCaller 执行管线和 Hook 集合(后端 mitm_global_hotpatch_pipeline.go:每个 hook 点先 globalCaller 再 moduleCaller)。因此 mitm-hotpatch 的 12 个 Hook 在全局层全部可用、签名完全相同,区别只在:全局先于模块执行、跨 MITM+Fuzzer 生效。

yakit 默认全局模板就用 hijackHTTPRequest + beforeRequest + hijackSaveHTTPFlow 给全站盖 X-Yakit-Global-HotPatch 标记。

3. 全部 Hook 示例索引(examples/,一个函数一个示例)

表中每一个 Hook 都有独立的全局风格示例 + YAK_MAIN 自测,另含 2 个真实文章复现的多 Hook 进阶示例。

Hook全局示例场景文件
hijackHTTPRequest给所有出站请求盖全局标记examples/hijack-request.yak
hijackHTTPResponse给所有响应盖全局标记examples/hijack-response.yak
hijackHTTPResponseEx凭请求上下文有条件改写响应examples/hijack-response-ex.yak
beforeRequest默认 Authorization Bearer 自动注入examples/before-request.yak
afterRequest全站统一响应审计标记examples/after-request.yak
mirrorHTTPFlow全站流量审计计数examples/mirror-http-flow.yak
mirrorFilteredHTTPFlow全站过滤后流量聚焦审计examples/mirror-filtered-http-flow.yak
mirrorNewWebsite全站资产清单examples/mirror-new-website.yak
mirrorNewWebsitePath全站路径清单examples/mirror-new-website-path.yak
mirrorNewWebsitePathParams全站可 Fuzz 端点清单examples/mirror-new-website-path-params.yak
hijackSaveHTTPFlow全站按状态码染色 + 打标签examples/hijack-save-http-flow.yak
mockHTTPRequest全局 kill-switch 拦截黑名单域名examples/mock-http-request.yak

进阶(真实文章复现,多 Hook 组合):

场景Hook 组合文件
全站 SM4-CBC 透明加解密 + 入库存明文beforeRequest + afterRequest + hijackSaveHTTPFlowexamples/advanced-sm4-transparent.yak
动态 Challenge + HMAC 签名注入 + 响应解密beforeRequest + afterRequest + hijackSaveHTTPFlowexamples/advanced-challenge-sign.yak

重点:文章 009 的动态 challenge 链路

examples/advanced-challenge-sign.yak 完整还原了公众号 009 的场景,自测用文章里给出的真实抓包数据离线断言:

  1. beforeRequest:命中 /api/user/info 时,主动 GET /api/get-challenge,解密拿 nonce,HMAC 算签名,写入 X-Auth-Signature。
  2. afterRequest:请求带 X-Yak-Force-Plaintext: 1 时把响应 AES-CBC 解成明文(避免无条件改写破坏浏览器前端解密)。
  3. hijackSaveHTTPFlow:MITM 不动在线流量,只把入库的响应改写成明文便于分析。
sequenceDiagram
    participant F as Fuzzer/浏览器
    participant H as 全局热加载
    participant C as /api/get-challenge
    participant T as /api/user/info
    F->>H: 发起 /api/user/info (无签名)
    H->>C: beforeRequest 主动 GET challenge
    C-->>H: 加密 challenge + iv
    H->>H: 解密得 nonce, HMAC 算签名
    H->>T: 带 X-Auth-Signature 重新发出
    T-->>H: AES-CBC 密文响应
    H-->>F: afterRequest 解密 (按需) / 入库存明文

4. 标准写法:hook 函数 + YAK_MAIN 自测

与 MITM/Fuzzer 完全一致——注册 hook,再用 if YAK_MAIN { runSelfTest() } 守卫。

  • yak xxx.yak:YAK_MAIN = true,跑自测。
  • yakit 全局热加载窗口:YAK_MAIN = false,仅注册 hook。

在线 hook(如 challenge 链路里的 fetchChallengeSignature 需 poc.HTTP 发副请求)在自测时可只验证其依赖的纯函数(签名计算、响应解密),避免自测依赖真实靶场。

并发与全局变量(重要):全局热加载作用面更广、并发更高。顶层全局只放 只读常量(密钥/IV/规则,加载一次后不改),绝不在 hook 里写共享可变全局,否则多请求并发写会 data race 崩溃。跨请求聚合用 sync.Map/sync.NewMutex() 或 db.*/risk.*。详见 webfuzzer-hotpatch 第 6 节。

5. 验证

cd /Users/v1ll4n/Projects/yaklang
go run common/yak/cmd/yak.go skills/global-hotpatch/examples/advanced-challenge-sign.yak

# 与 Yakit gRPC 同款执行路径 (全局管线顺序: beforeRequest -> hijack -> afterRequest):
go build -o /tmp/yak ./common/yak/cmd/yak.go
printf 'GET / HTTP/1.1\r\nHost: t.example.com\r\n\r\n' > /tmp/req.txt
printf 'HTTP/1.1 500 Internal Server Error\r\nContent-Length: 4\r\n\r\nboom' > /tmp/rsp.txt
/tmp/yak hotpatch-global --script skills/global-hotpatch/examples/hijack-save-http-flow.yak --request /tmp/req.txt --response /tmp/rsp.txt

每个示例应:10 秒内完成、assert 全过、log 全英文、出现 ... self test passed。

参考来源

  • yak-project-public 009 (2026-03-18) 前端加密测不动 全局热加载帮你自动接管签名流程
  • yak-project-public 030 (2025-10-24) Yakit 热加载实战技巧
  • yak-project-public 085 (2024-11-27) 全局配置插件环境变量
  • 引擎实现:common/yakgrpc/grpc_global_hotpatch_test.go

FAQ

What does the global-hotpatch skill do?

Yakit 全局热加载 (Global Hot Patch) 专题。当用户需要一处配置、让 MITM 与所有 Web Fuzzer Tab 共享同一套 hook 时使用:全站透明加解密、统一签名/认证注入、动态 challenge 应答、全站染色脱敏、危险操作护栏。全局 hook 先于模块 hook 执行,同时只能启用一个。复用 beforeRequest / afterRequest / hijackHTTPRequest / hijackSaveHTTPFlow / mockHTTPRequest。

How do I install global-hotpatch?

Run npx skills add https://github.com/yaklang/yak-skills --skill global-hotpatch in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/global-hotpatch/ (personal) or .claude/skills/global-hotpatch/ (project).

Which AI agents can use global-hotpatch?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is global-hotpatch safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains global-hotpatch?

It is published by yaklang in yaklang/yak-skills. It has 124 recorded installs.

More from yaklang/yak-skills

View all →

mitm-hotpatch

yaklang/yak-skills

Yakit MITM 热加载 (Hot Patch) 专题。当用户需要在 MITM 中间人代理中用代码动态劫持/修改请求与响应、镜像分析流量、入库前打标签染色、或对危险操作做 mock 护栏时使用。覆盖 hijackHTTPRequest / hijackHTTPResponseEx / mirror 系列 / hijackSaveHTTPFlow / mockHTTPRequest 全部 Hook 与 forward/drop 语义。

125 installs

yak

yaklang/yak-skills

Open the skill to read its SKILL.md instructions.

124 installs

webfuzzer-hotpatch

yaklang/yak-skills

Yakit Web Fuzzer 热加载 (Hot Patch) 专题。当用户需要在 Web Fuzzer 单 Tab 发包时用代码自动加解密请求/响应、注入签名、智能重试、自定义业务失败判定、用 fuzztag 动态生成 payload、或从响应提取参数做关联测试时使用。覆盖 beforeRequest / afterRequest / retryHandler / customFailureChecker / mirrorHTTPFlow / mockHTTPRequest 与 {{yak(...)}} fuzztag。

123 installs

yakit-rightclick-plugin

yaklang/yak-skills

Open the skill to read its SKILL.md instructions.

120 installs

yaklang-database

yaklang/yak-skills

Open the skill to read its SKILL.md instructions.

Data & Databases120 installs

yaklang-toolchain

yaklang/yak-skills

Open the skill to read its SKILL.md instructions.

120 installs

Popular other skills

View category →

hyperframes-cli

heygen-com/hyperframes

The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.

1.3M installs

triage

mattpocock/skills

Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.

1M installs

ask-matt

mattpocock/skills

Ask which skill or flow fits your situation. A router over the skills in this repo.

778.4K installs

to-questionnaire

mattpocock/skills

Turn a decision you can't fully answer into a questionnaire for someone else to fill in.

508.9K installs

wait-what

mattpocock/skills

Stop. That last message did not land: re-pitch it.

459.7K installs

loop-me

mattpocock/skills

Grill me about specs for the workflows I want to build, within this workspace.

447.9K installs