# mitm_filter **Repository Path**: fatgrass/mitm_filter ## Basic Information - **Project Name**: mitm_filter - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-04 - **Last Updated**: 2025-11-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mitm_filter.py 用户手册 ## 概述 mitm_filter.py 是一个用于过滤 mitmproxy 流量数据的命令行工具,支持多种过滤选项,可单独使用或组合使用。 ## 基本用法 ```bash python src/mitm_filter.py [过滤选项] input.json output.json ``` ## 过滤选项 ### 字段过滤 - `--fout-req-system`:删除 request.system 字段 - `--fout-req-tools`:删除 request.tools 字段 ### 记录删除 - `--no-req-w-events`:删除第一个子对象为 events 的整条记录 - `--no-resp-w-raw_content "FILTER_STRING"`:删除 response.raw_content 值等于指定字符串的整条记录 ## 使用示例 ### 单个过滤器 ```bash # 删除 system 字段 python src/mitm_filter.py --fout-req-system data/dump.json filtered.json # 删除 raw_content 为 "Not Found" 的记录 python src/mitm_filter.py --no-resp-w-raw_content "Not Found" data/dump.json filtered.json ``` ### 组合过滤器 ```bash # 同时删除多个字段 python src/mitm_filter.py --fout-req-system --fout-req-tools data/dump.json filtered.json # 同时删除不同类型的记录 python src/mitm_filter.py --no-req-w-events --no-resp-w-raw_content "Error" data/dump.json filtered.json ``` ### 完整过滤流程 ```bash # 删除 system/tools 字段,同时删除 events-first 记录和错误记录 python src/mitm_filter.py --fout-req-system --fout-req-tools --no-req-w-events --no-resp-w-raw_content "Not Found" data/dump.json filtered.json ``` ## 输出说明 工具会显示处理结果: ``` 成功处理 899 条记录,输出 873 条记录到 filtered.json ``` ## 注意事项 - 输入文件必须是包含 JSON 数组的有效 JSON 文件 - 过滤器按顺序执行,后面的过滤器在前面过滤结果的基础上工作 - 使用 `--help` 查看完整的帮助信息