内容
# 漏洞扫描服务器
Model Context Protocol(MCP)服务器,用于与 **Nessus** 漏洞扫描器交互。该服务器将 Nessus 功能作为 MCP 工具、资源和提示公开,使 Claude 等 AI 助手能够管理扫描、分析漏洞和生成报告。
## 功能
### 🔧 工具(30+)
| 类别 | 工具 |
|----------|-------|
| **身份验证** | `nessus_login`, `nessus_server_info`, `nessus_server_status` |
| **扫描管理** | `nessus_list_scans`, `nessus_create_scan`, `nessus_launch_scan`, `nessus_pause_scan`, `nessus_resume_scan`, `nessus_stop_scan`, `nessus_delete_scan`, `nessus_configure_scan` |
| **扫描结果** | `nessus_get_scan_details`, `nessus_get_host_details`, `nessus_get_plugin_output`, `nessus_search_vulnerabilities`, `nessus_get_scan_history` |
| **导出** | `nessus_export_scan`, `nessus_download_export` |
| **模板和策略** | `nessus_list_templates`, `nessus_list_policies` |
| **文件夹** | `nessus_list_folders`, `nessus_create_folder`, `nessus_delete_folder` |
| **插件** | `nessus_list_plugin_families`, `nessus_get_plugin_family`, `nessus_get_plugin_details`, `nessus_list_plugin_rules` |
| **系统** | `nessus_list_scanners`, `nessus_list_users`, `nessus_list_timezones` |
### 📚 资源
- `nessus://server/info` — 服务器元数据
- `nessus://scans/list` — 所有扫描概览
- `nessus://templates/list` — 可用的扫描模板
### 💡 提示
- `vulnerability_report` — 生成漏洞评估报告
- `compare_scans` — 比较两次扫描结果
- `scan_creation_wizard` — 引导式扫描创建
---
## 安装
### 先决条件
- Python 3.10+
- 运行中的 Nessus 扫描器(已测试 Nessus Expert 10.x)
- MCP SDK (`pip install mcp`)
### 设置
```bash
# 克隆或复制服务器文件
cd nessus-mcp
# 安装依赖项
pip install -r requirements.txt
# 设置环境变量(或使用默认值)
export NESSUS_URL="https://localhost:8834"
export NESSUS_USERNAME="XXXX"
export NESSUS_PASSWORD="XXXX"
# 测试服务器
python nessus_mcp_server.py
```
---
## 配置
### Claude 桌面版
将以下内容添加到您的 Claude 桌面版配置(Windows:`%APPDATA%\Claude\claude_desktop_config.json`,macOS:`~/Library/Application Support/Claude/claude_desktop_config.json`):
```json
{
"mcpServers": {
"nessus": {
"command": "python",
"args": ["C:\\path\\to\\nessus_mcp_server.py"],
"env": {
"NESSUS_URL": "https://localhost:8834",
"NESSUS_USERNAME": "your_username",
"NESSUS_PASSWORD": "your_password"
}
}
}
}
```
### Claude 代码
```bash
claude mcp add nessus -- python /path/to/nessus_mcp_server.py
```
### 环境变量
| 变量 | 默认值 | 描述 |
|----------|---------|-------------|
| `NESSUS_URL` | `https://localhost:8834` | Nessus 服务器 URL |
| `NESSUS_USERNAME` | `XXXX` | 身份验证用户名 |
| `NESSUS_PASSWORD` | `XXXX` | 身份验证密码 |
---
## 使用示例
### 列出所有扫描
```
> 使用 nessus_list_scans 显示所有当前扫描
```
### 创建和启动扫描
```
> 创建一个针对 192.168.1.0/24 的基本网络扫描,命名为 "内部网络审计"
> 然后启动它
```
### 分析扫描结果
```
> 显示扫描 5 的详细信息,关注关键和高严重性发现
```
### 搜索特定漏洞
```
> 在扫描 5 中搜索任何 SSL/TLS 相关漏洞
```
### 导出结果
```
> 将扫描 5 导出为 CSV 文件
```
### 获取插件详细信息
```
> 显示 Nessus 插件 10287 的详细信息
```
---
## 架构
```
┌─────────────────┐ stdio ┌──────────────────┐ HTTPS/REST ┌─────────────┐
│ Claude / LLM │ ◄────────────► │ Nessus MCP │ ◄──────────────► │ Nessus │
│ (MCP Client) │ │ Server │ │ Scanner │
└─────────────────┘ └──────────────────┘ └─────────────┘
```
- **传输**: stdio(标准输入/输出)
- **身份验证**: 基于会话的令牌身份验证与 Nessus API
- **SSL**: 自签名证书验证已禁用(本地 Nessus 的标准)
---
## 安全注意事项
- 凭证通过环境变量传递(生产环境中不硬编码)
- 禁用 SSL 证书验证以支持 Nessus 的自签名证书
- 服务器一次性身份验证并重用会话令牌
- 对于生产使用,请考虑实施令牌轮换和安全凭证存储
---
## API 覆盖范围
该服务器涵盖了核心 Nessus REST API 端点:
| 端点 | 方法 | 覆盖 |
|----------|---------|---------|
| `/session` | POST | ✅ |
| `/server/properties` | GET | ✅ |
| `/server/status` | GET | ✅ |
| `/scans` | GET, POST | ✅ |
| `/scans/{id}` | GET, PUT, DELETE | ✅ |
| `/scans/{id}/launch` | POST | ✅ |
| `/scans/{id}/pause` | POST | ✅ |
| `/scans/{id}/resume` | POST | ✅ |
| `/scans/{id}/stop` | POST | ✅ |
| `/scans/{id}/export` | POST | ✅ |
| `/scans/{id}/hosts/{id}` | GET | ✅ |
| `/scans/{id}/hosts/{id}/plugins/{id}` | GET | ✅ |
| `/editor/scan/templates` | GET | ✅ |
| `/policies` | GET | ✅ |
| `/folders` | GET, POST, DELETE | ✅ |
| `/plugins/families` | GET | ✅ |
| `/plugins/families/{id}` | GET | ✅ |
| `/plugins/plugin/{id}` | GET | ✅ |
| `/plugin-rules` | GET | ✅ |
| `/scanners` | GET | ✅ |
| `/users` | GET | ✅ |
| `/scans/timezones` | GET | ✅ |
---
## 许可证
MIT 许可证