mitm-hotpatch

Implements Yaklang hot-patch hooks to hijack, mirror, and mock HTTP traffic in Yakit MITM proxy.

10|1|Updated Jun 16, 2026
One-click install
npx skills add https://github.com/yaklang/yak-skills --skill mitm-hotpatch-yaklang
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mitm-hotpatch
Source: https://github.com/yaklang/yak-skills/tree/main/skills/mitm-hotpatch
Command: npx skills add https://github.com/yaklang/yak-skills --skill mitm-hotpatch-yaklang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Security testers need to dynamically intercept, modify, tag, or mock HTTP traffic inside the Yakit MITM proxy without restarting the service, and writing correct hook scripts requires knowing each hook's trigger timing, forward/drop semantics, and concurrency constraints. ## Core Features & Use Cases - Full Hook Coverage: Documents all MITM hooks including hijackHTTPRequest, hijackHTTPResponseEx, the mirror* family, hijackSaveHTTPFlow, and mockHTTPRequest, with trigger timing and forward/drop semantics. - Runnable Examples: Provides one self-testable .yak example per hook using the YAK_MAIN guard pattern, so each script can be verified locally with the yak CLI before being pasted into Yakit. - Use Case: A tester wants to modify a JSON amount field in outbound purchase requests and mock dangerous DELETE operations during a penetration test; they load the hijack-request and mock-http-request examples as hot patches and verify behavior with the hotpatch-mitm CLI command. ## Quick Start Ask the AI to write a Yakit MITM hot-patch script that intercepts requests to a target API and modifies a JSON body field, following the hijackHTTPRequest example with a YAK_MAIN self-test.

Frequently Asked Questions about mitm-hotpatch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I intercept and modify HTTP requests in Yakit MITM proxy?▼

Define a hijackHTTPRequest function that receives isHttps, url, req, forward, and drop parameters, modify the request packet, then call forward(req) to pass it on. Every request must call forward or drop, otherwise it hangs.

What is the difference between hijackHTTPResponse and hijackHTTPResponseEx?▼

hijackHTTPResponseEx receives both the request and response objects, while hijackHTTPResponse only gets the response. The Ex variant is recommended when response modifications depend on the original request context.

How do mirror hooks deduplicate traffic in Yakit MITM?▼

mirrorNewWebsite fires once per domain, mirrorNewWebsitePath once per unique path per domain ignoring query strings, and mirrorNewWebsitePathParams deduplicates by query parameter structure rather than values.

Can I test a Yakit hot-patch script without loading it into Yakit?▼

Yes, wrap test logic in an if YAK_MAIN block and run the file with the yak CLI. YAK_MAIN is true on the command line and false when loaded by Yakit, so the self-test only runs locally.

Why does my MITM hot-patch script panic under concurrent traffic?▼

MITM calls hooks concurrently, so mutating shared global variables like appending to a global slice causes data races. Treat globals as read-only constants and use sync.Map, mutexes, or db/risk storage for cross-request aggregation.