← 返回 CLI 目录 抓取的
mitmdump
$ mitmdump 社区开源 高风险 mitmproxy Project · 浏览器与网页抓取 · MIT · macos / linux / windows
mitmdump 是 mitmproxy 的非交互式命令行版本,支持捕获、检查、回放(--server-replay)HTTP/HTTPS 流量并导出为 .mitm 或 HAR 文件(--set hardump=...),也可加载 -s Python 脚本实现自动化接口调试。
FCRS-1.0 综合评分
76 /100
良好 (Good)
高置信度 (实测)
零摩擦安装命令
brew install mitmproxy CLI vs MCP 选型建议 仅 CLI 可用
可作为后台本地 HTTP 代理或离线 .mitm/.har 分析器运行;传入 -nr 即可在不绑定端口的情况下离线读取抓包。
Agent 友好度体检单
本地探针实测证据 — 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
✓ 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
实测版本
Mitmproxy: 12.2.3 binary
冷启动耗时
1336 ms
退出码 (help / 非法参数)
1 / 1
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Safe
抓取的 --help 摘要
usage: mitmdump [options] [filter]
positional arguments:
filter_args Filter expression, equivalent to setting both the
view_filter and save_stream_filter options.
options:
-h, --help show this help message and exit
--version show version number and exit
--options Show all options and their default values
--commands Show all commands and their signatures
--set option[=value] Set an option. When the value is omitted, booleans are
set to true, strings and integers are set to None (if
permitted), and sequences are emptied. Boolean values
can be true, false or toggle. Sequences are set using
multiple invocations to set for the same option.
-q, --quiet Quiet.
-v, --verbose Increase log verbosity.
--mode, -m MODE The proxy server type(s) to spawn. Can be passed
multiple times. Mitmproxy supports "regular" (HTTP),
"local", "transparent", "socks5", "reverse:SPEC",
"upstream:SPEC", and "wireguard[:PATH]" proxy servers.
For reverse and upstream proxy modes, SPEC is host
specification in the form of "http[s]://host[:port]".
For WireGuard mode, PATH may point to a file
containing key material. If no such file exists, it
will be created on startup. You may append
`@listen_port` or `@listen_host:listen_port` to
override `listen_host` or `listen_port` for a specific
proxy mode. Features such as client playback will use
the first mode to determine which upstream server to
use. May be passed multiple times.
--no-anticache
--anticache Strip out request headers that might cause the server
to return 304-not-modified.
--no-showhost
--showhost Use the Host header to construct URLs for display.
This option is disabled by default because malicious
apps may send misleading host headers to evade your
analysis. If this is not a concern, enable this
options for better flow display.
--no-show-ignored-hosts
--show FCRS-1.0 六维评分拆解
Agent 友好度 17 / 25
作为 mitmproxy 的非交互式命令行版(mitmdump),支持 -nr 离线读取、-s 脚本与 HAR 导出,但实时模式会作为守护进程持续阻塞。
- Non-interactive companion to
mitmproxy; supports-nr,-s, and--set hardump
安全与权限边界 16 / 25
涉及中间人 TLS 解密,依赖本地 ~/.mitmproxy CA 私钥,且抓包文件会明文记录 Cookie 与认证令牌。
- Generates local MITM CA private keys and logs unredacted HTTP credentials
安装与运行摩擦 13 / 15
可通过 brew、pip、uvx 或独立安装包获取,但抓包 HTTPS 需客户端信任本地 CA 证书。
- Available via Homebrew, PyPI, and official binaries
能力覆盖与边际价值 13 / 15
排查 SDK/移动端流量、搭建 --server-replay Mock 服务及导出 HAR 文件的利器。
- Native HAR export/import,
-sPython addons, and--server-replay
维护与来源背书 9 / 10
mitmproxy 项目组持续积极维护(mitmproxy/mitmproxy,MIT 协议)。
- Official
mitmproxy/mitmproxyrepository
文档与可验证性 8 / 10
docs.mitmproxy.org 对插件、HAR 导出与回放模式的文档完备。
- Official docs at docs.mitmproxy.org
安全边界、鉴权与放权指南
鉴权方式
无需鉴权 本地配置文件
凭证存储位置
在 ~/.mitmproxy/ 下生成并保存本地拦截 CA 私钥,供受信任的客户端解密 HTTPS 流量。
潜在副作用
只读查询 本地写入 远端写入
费用与配额提示
免费开源(MIT 协议)Python CLI。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# mitmdump Agent Rules - `mitmdump` runs as a persistent proxy daemon unless `-nr` (offline read) is passed; start with an explicit timeout or background task and clean up when done. - Captured `.mitm`/`.har` files contain full auth cookies and Bearer tokens—never commit or share raw captures.
Agent 高频安全命令配方
只读查询(安全推荐)
离线解析已保存的抓包文件而不启动代理
mitmdump -nr capture.mitm --flow-detail 2
使用 -nr 离线读取 capture.mitm 并打印请求头与响应体摘要。
受控写入与预演
启动无头代理并将流量保存为 HAR
mitmdump -p 8080 --set hardump=traffic.har -q
在 8080 端口静默监听(-q),退出时将捕获到的请求流写入 traffic.har。
核心优势
- + 原生支持 HAR 导出(
--set hardump=...)与离线抓包检查(-nr)。 - + 具备强大的
-sPython 扩展能力与--server-replay回放机制。
注意事项与踩坑点
- ! 实时代理模式会一直驻留运行,直到收到终止信号。
- ! 导出的
.mitm/.har文件包含完整认证令牌与 Cookie,严禁随意分发。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI