DFIR-MCP
统一法医分析MCP工具包

1.概述
该项目为数字取证和事件响应(DFIR)提供了一个强大、统一的工具包。它集成了几个行业标准的开源工具--电锯、隼鸟、后见之明、等离子和时间素描--该系统由模型上下文协议(MCP)驱动。这允许单个AI助手跨多个工具编排复杂的分析工作流程,简化调查并关联来自不同来源的数据。
此存储库旨在为DFIR团队提供一个可共享的一体化解决方案。它包括所有必要的服务器配置、依赖关系和客户端脚本,以快速启动和运行。
包含的工具
- 链锯 用于使用Sigma规则在事件日志中搜索威胁。
- 隼鸟 用于快速高效地生成和分析Windows事件日志时间线。
- 后见之明 用于深入分析web浏览器历史。
- Plaso 用于从大量法医文物中创建超级时间线。
- 时间示意图 用于协作时间线分析和可视化。
2.依赖关系
在开始之前,请确保您的系统上安装了以下依赖项。
系统级依赖关系
- Python 3.13: 所有MCP服务器和脚本的核心运行时。
- Git: 克隆存储库和管理版本所需。
- Docker桌面: 需要轻松运行Timestact所需的后端服务(PostgreSQL和Redis)。标准时间草图
docker-compose.yml是启动这些服务的推荐方式。
Python包
所有必需的Python包都列在 requirements.txt 文件,并将在安装过程中自动安装。
二进制依赖关系
此项目包含几个命令行工具。您必须下载它们的预编译二进制文件并将其放置在正确的目录中:
- 链锯: 从以下网址下载适用于您系统的二进制文件 电锯发布页面 并将可执行文件放置在
servers/Chainsaw/bin/chainsaw. - 隼鸟: 从以下网址下载适用于您系统的二进制文件 隼鸟发布页面 并将可执行文件放置在
servers/Hayabusa/bin/hayabusa.
3.初始项目设置
按照以下步骤首次设置项目。
步骤3.1:创建虚拟环境
强烈建议使用专用的Python虚拟环境。这个项目已经用Python 3.13进行了测试和稳定。
# Navigate to the project root directory
cd /path/to/DFIR-MCP
# Create a new virtual environment
python3 -m venv venv步骤3.2:激活环境并安装依赖项
激活新环境并从安装所有必需的软件包 requirements.txt 文件。
# Activate the virtual environment
source venv/bin/activate
# Install all dependencies
pip install -r requirements.txt步骤3.3:启动时间草图后端
Timesketch需要运行两个后台进程:Celery工作进程和web服务器。
终端1-启动Celery Worker:
# Make sure your venv is active
source venv/bin/activate
# Navigate to the Timesketch server directory
cd servers/Timesketch
# Start the worker
celery -A timesketch.lib.tasks worker --loglevel=info终端2-启动Timesketch Web服务器:
# Make sure your venv is active
source venv/bin/activate
# Navigate to the Timesketch server directory
cd servers/Timesketch
# Start the web server
python start_server.py一旦这些运行完毕,您就可以继续使用MCP服务器。
4.如何使用MCP服务器
所有MCP服务器都在中定义 mcp_config.json 并且可以由兼容的MCP客户端(如Windsurf IDE扩展)调用。以下部分提供了使用每个服务器工具的自然语言提示。
4.1链锯服务器
使用Sigma规则为事件日志提供威胁搜索功能。
- 运行Sigma扫描(
run_chainsaw_scan)
> Run a Chainsaw scan on the directory /path/to/evtx/logs.- 使用更高的阈值运行扫描
> Run a Chainsaw scan on /path/to/evtx/logs with a detection level of 'critical'.- 使用模式搜索日志(
search_chainsaw_logs)
> Search the logs in /path/to/evtx/logs for the pattern 'powershell.exe'.- 使用正则表达式搜索日志
> Search the logs in /path/to/evtx/logs with the regex `.*mimikatz.*`.- 转储工件文件(
dump_artifact)
> Dump the artifact file /path/to/some.evtx in JSON format.- 列出可用的Sigma规则(
list_sigma_rules)
> List the available Sigma rule sets for Chainsaw.4.2隼鸟服务器
分析Windows事件日志(.evtx)创建时间表和指标。
- 创建CSV时间线(
csv_timeline)
> With Hayabusa, create a CSV timeline from the event logs in /path/to/evtx/logs and save it to /path/to/hayabusa_timeline.csv.- 创建JSON时间线(
json_timeline)
> Use Hayabusa to generate a JSON timeline from the logs at /path/to/evtx/logs.- 获取事件ID指标(
eid_metrics)
> Get the Event ID metrics from the logs in /path/to/evtx/logs using Hayabusa.- 获取计算机指标(
computer_metrics)
> Using Hayabusa, get the computer metrics for the logs at /path/to/evtx/logs.- 检查隼鸟版本(
hayabusa_version)
> What version of Hayabusa is installed?4.3后视服务器
分析web浏览器历史记录和工件。
- 分析浏览器历史文件(
analyze_browser_history)
> Use the Hindsight server to analyze the Chrome history file at /path/to/History.- 分析完整浏览器配置文件(
analyze_chrome_profile)
> Perform a full analysis of the Chrome profile located at /path/to/chrome/Default.- 列出已完成的分析(
list_analyses)
> List all completed Hindsight analyses.- 获取分析摘要(
get_analysis_summary)
> Get the summary for Hindsight analysis 'history_1'.- 搜索分析结果(
search_analysis_results)
> In Hindsight analysis 'history_1', search for the term 'malicious.com'.4.4 plaso服务器
从各种法医文物中创建超级时间线。
- 创建Plaso存储文件(
create_timeline)
> Using the Plaso server, create a storage file at /path/to/output.plaso from the source evidence at /path/to/evidence.E01.- 从Plaso文件导出时间线(
export_timeline)
> With the Plaso server, export a CSV timeline from the storage file /path/to/output.plaso and save it to /path/to/exported_timeline.csv.- 导出筛选的时间线
> Using the Plaso server, export a timeline from /path/to/output.plaso to /path/to/filtered_timeline.csv, but only include events where the date is after '2025-01-01'.4.5时间草图服务器
处理与Timesketch时间线分析平台的交互。
- 列出现有草图(
list_sketches)
> List all my sketches in Timesketch.- 创建新草图(
create_sketch)
> Create a new Timesketch sketch named 'My New Investigation'.- 上传时间线(
upload_timeline)
> Upload the file /path/to/my_timeline.csv to sketch 'My New Investigation' and name the timeline 'CSV Timeline'.5.端到端工作流示例
此工作流程演示了如何组合服务器来分析Windows事件日志和Chrome浏览器历史记录,然后将这两个时间线聚合到一个Timesketch草图中进行分析。
提示:
> I want to perform a full forensic analysis. First, create a new Timesketch sketch named 'Suspicious Activity Investigation'. Next, use Hayabusa to create a timeline from the event logs at /path/to/logs. Also, use Hindsight to analyze the Chrome history from /path/to/History. Finally, upload both the Hayabusa and Hindsight timelines to the new Timesketch sketch you created, naming them 'Hayabusa EVTX Timeline' and 'Hindsight Browser Timeline' respectively.这个单一而强大的提示将协调整个工作流程,为您的调查提供统一的证据视图。
6.项目结构
.
├── mcp_config.json # Main configuration for all MCP servers
├── requirements.txt # All Python dependencies for the project
├── README.md # This file
└── servers/
├── Chainsaw/ # Chainsaw server and binaries
├── Hayabusa/ # Hayabusa server, client, and binaries
├── Hindsight/ # Hindsight server, client, and source code
├── Plaso/ # Plaso server, client, and source code
└── Timesketch/ # Timesketch server, client, and startup scripts