Skip to main content

mitmproxy-extract-data

Extracts data from mitmproxy .mitm flow archives only (no indexed flows.db or remote API). Runs query summary/search/export, inspect by flow id (optional --raw-body-b64 for binary-safe content), body export for raw request/response bytes, and extract via regex jsonpath or CSS through scripts/run.sh. Use when working with a .mitm file, exporting or searching saved captures, inspecting a flow, exporting protobuf/binary bodies, or pulling fields from request/response bodies or headers.

설치로 이동

소스 정보

저장소
blue-bird1/skills
최근 소스 활동
2026년 4월 21일 03:22
감지된 SKILL.md 언어
중국어
스타
0
포크
0

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
15 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
mitmproxy-extract-data
description
Extracts data from mitmproxy .mitm flow archives only (no indexed flows.db or remote API). Runs query summary/search/export, inspect by flow id (optional --raw-body-b64 for binary-safe content), body export for raw request/response bytes, and extract via regex jsonpath or CSS through scripts/run.sh. Use when working with a .mitm file, exporting or searching saved captures, inspecting a flow, exporting protobuf/binary bodies, or pulling fields from request/response bodies or headers.
# Mitmproxy .mitm 数据提取 面向**只读离线 `.mitm`**(如 `mitmdump -w` 产出)。入口为 **`scripts/run.sh`**,内部用本技能目录下的 **`scripts/ops/`** Python 实现。 ## 入口脚本在哪(必读,避免无效全局查找) - **`scripts/run.sh`** 位于**本技能根目录**(与 `SKILL.md` 同级),常见路径如 `~/.cursor/skills/mitmproxy-extract-data/scripts/run.sh`。**不要**在业务仓库、`PATH` 或全盘 `find` 搜索同名 `run.sh`。 - 记 **`$ROOT`** = 含有本 `SKILL.md` 且其下存在 **`scripts/run.sh`** 的目录。本技能所有命令均以 **`"$ROOT/scripts/run.sh"`** 为唯一入口(下文 Quick Start 中 `$ROOT` 同此含义)。 ## Quick Start - 输入:可读 **`.mitm`** 路径,通过各子命令的 **`--flows-file`** 传入。 - 调用: **`$ROOT/scripts/run.sh`** + **`query` | `inspect` | `extract`** + 子命令与参数(`$ROOT` 为本技能根目录,例如 `~/.cursor/skills/mitmproxy-extract-data`)。 - 本机需已安装 **`uv`**;首次运行会创建 **`$ROOT/.venv`** 并安装依赖(无需手动 `activate`)。 ## 二进制正文(protobuf / 加密负载等) `inspect` 与 `query export` 中的 **`request_body` / `response_body`** 来自 **`get_text()`**(按文本解码),**不适合**无损保留二进制;误用会导致与 **真实 `flow.request.content` / `flow.response.content`** 不一致。 **无损方式(二选一)**: 1. **`inspect --raw-body-b64`**:在 JSON 中额外包含 **`request_content_b64`**、**`response_content_b64`**(原始字节的 base64)。 2. **`body export`**:把 **`--part request`** 或 **`response`** 的原始字节写到 **`--output`** 文件(或 **`-`** 写 stdout)。 文本搜索(`query search`)仍用文本字段匹配 URL 等;需要按字节处理时再使用上述接口。 ## Execute Workflow ```text Task Progress: - [ ] 确认路径为 .mitm 文件 - [ ] query summary 或 search → 取得 flow_id - [ ] 需要全量 JSON:query export - [ ] 需要单条详情:inspect(二进制正文加 --raw-body-b64) - [ ] 需要原始 body 文件:body export - [ ] 从正文/头提取字段:extract(regex / jsonpath / css),可选 --var 写入 data/session_vars.json ``` ## Commands - Summary: - `"$ROOT/scripts/run.sh" query summary --flows-file /path/to/capture.mitm --limit 20` - Search: - `"$ROOT/scripts/run.sh" query search --flows-file /path/to/capture.mitm --domain example.com --limit 20` - Full export: - `"$ROOT/scripts/run.sh" query export --flows-file /path/to/capture.mitm --output logs/flows.full.json` - stdout: `"$ROOT/scripts/run.sh" query export --flows-file /path/to/capture.mitm` - Inspect: - `"$ROOT/scripts/run.sh" inspect --flows-file /path/to/capture.mitm --flow-id "<id>"` - 需要无损 body(base64):`"$ROOT/scripts/run.sh" inspect --flows-file /path/to/capture.mitm --flow-id "<id>" --raw-body-b64` - Body(原始字节): - `"$ROOT/scripts/run.sh" body export --flows-file /path/to/capture.mitm --flow-id "<id>" --part request --output /tmp/req.bin` - `"$ROOT/scripts/run.sh" body export ... --part response --output /tmp/resp.bin` - stdout:`--output -`(二进制) - Extract: - `"$ROOT/scripts/run.sh" extract --flows-file /path/to/capture.mitm --flow-id "<id>" --source response_body --regex 'token=([A-Za-z0-9._-]+)' --var token` `extract` 的 `--source`:`request_body` | `response_body` | `request_headers` | `response_headers`。`regex`、`jsonpath`、`css` **至少其一**。 - 仅准备虚拟环境(可选): - `"$ROOT/scripts/setup-venv.sh"` ## Non-negotiable Constraints - 仅 **`.mitm` 文件**;不支持仅依赖 **`flows.db`**、**API bridge** 或 **mitmweb 远程** 作为数据源(与本技能设计一致)。 - 需要**起代理、上游链、addon、replay、证书**等 → 使用 **`mitmproxy-core`**;本技能不负责在线抓包运行时。 ## References - 契约与错误码:[reference.md](reference.md)
GitHub에서 보기