NexusCore MCP
英语 | 韩语
NexusCore MCP 是一种先进的 模型上下文协议(MCP) 服务器专门为 AI驱动的动态恶意软件分析它弥合了Claude/GPT-4等大型语言模型(LLM)和低级系统仪器之间的差距,使AI代理能够实时主动调试、检查和分析规避性恶意软件。
为什么选择NexusCore? 传统的沙盒会给你一个静态报告。NexusCore允许AI代理 交互式地 操纵恶意软件执行——通过Frida绕过反调试检查(Themida/VMProtect),转储内存,并实时执行取证分诊。
📑 目录
______________________________________________________________________
🏗️ 建筑
graph TD
A["AI Agent (Claude/Cursor)"] -- "MCP Protocol (Stdio)" --> B["NexusCore MCP Server"]
subgraph "Core Analysis Engine"
B -- "Persistent DB" --> C[("Sled Cache / Job Queue")]
B -- "Large Data" --> D["StreamManager (Dumps)"]
B -- "Observability" --> E["OpenTelemetry (Jaeger)"]
end
subgraph "SOTA Analysis Tools"
B -- "Micro-Emu" --> F["Unicorn Engine"]
B -- "Ref Bridge" --> G["Ghidra/IDA/x64dbg"]
B -- "Py Sandbox" --> H["AI Decryptor Tester"]
B -- "Self-Correction" --> I["YARA Verifier"]
end
subgraph "Host OS (Virtualized)"
B -- "Inject" --> J["Frida Engine (Stealth)"]
B -- "API" --> K["External (DIE, Capa, PE-Sieve)"]
end______________________________________________________________________
🚀 功能和工具
🌟 最新技术(SOTA)能力
| 工具 | 描述 | 创新 |
|---|---|---|
micro_emulate | 执行独立的代码片段/函数。 | 零执行分析 |
sync_reversing_data | 将人工智能的发现直接与Ghidra/IDA联系起来 | 实时工具同步 |
test_decryptor | AI生成的Python解密器的安全沙箱。 | 自定义逻辑反转 |
verify_yara | 根据样品自动验证YARA规则。 | 自校正循环 |
read_memory_chunk | 以块的形式处理GB级内存转储。 | 上下文窗口优化 |
🛡️ 恶意软件分类和动态分析
| 工具 | 描述 | 关键技术 |
|---|---|---|
spawn_process | 通过Frida spawn生成过程,可选择注入隐形钩子。使用 resume_process 继续。 | 弗里达 |
api_monitor | 监视Windows API调用(注册表、网络、文件)。 | 弗里达 |
dump_ssl_keys | 挂钩库以转储HTTPS解密密钥。 | 弗里达 |
generate_yara | 自动生成初始YARA签名。 | 本地 |
scan_pe_sieve | 检测进程空鼓和DLL注入。 | PE筛 |
die_scan / capa_scan | 高速静态分析 Sled缓存DIE/CAPA。 |
🔧 基于会话的调试(src/tools/malware/debug/)
| 工具 | 说明 |
|---|---|
session_start | 启动持久性cdb.exe调试会话(无头)。 |
session_command | 向活动会话发送单个命令。 |
session_batch | 同时发送多个命令。 |
session_end | 终止调试会话。 |
debug_help | 常见的cdb.exe命令参考。 |
🔗 Frida会话管理(src/tools/common/frida_session.rs)
| 工具 | 说明 |
|---|---|
frida_session_create | 创建持久Frida会话(spawn/attach)。 |
frida_session_inject | 将JS脚本注入到现有会话中。 |
frida_session_messages | 从钩子获取收集到的消息。 |
frida_session_destroy | 释放会话资源。 |
🧰 系统和指标
| 工具 | 说明 |
|---|---|
scan_persistence | 扫描注册表运行键和启动文件夹。 |
inspect_gui | 提取窗口标题和类名。 |
get_metrics | 返回性能指标(缓存统计数据、计时)。 |
⚡ 性能优化
- SHA256缓存:按文件哈希缓存的Die/Capa/Floss结果(1小时TTL)
- 批量缓冲:Frida IPC批处理,开销减少10倍
- 异步I/O:
spawn_blocking用于文件操作 - 标准化JSON:具有定时元数据的统一响应格式
______________________________________________________________________
📋 先决条件
在开始之前,请确保您已经:
系统要求
- 操作系统:Windows 10/11(x64)-最好是干净的 虚拟机 (VirtualBox/VMware)
- 随机存取存储器:建议使用4GB以上
- 磁盘空间:5GB+用于工具和依赖项
所需软件(由安装脚本自动安装)
- 巧克力 -包管理器
- 锈 (1.70+)-编译器工具链
- Visual C++构建工具 -MSVC连接器
- Python 3.8+ -对于某些分析工具
- Git -版本控制
分析工具(由安装脚本自动下载)
- 轻松检测(DIE) -打包器/编译器检测
- 纠正和预防措施 -能力分析
- 自由 -字符串提取
- 工具程序集 -工艺公用设施
可选(功能齐全)
- CAPEv2沙盒 -远程恶意软件提交(自托管或公共实例)
- 弗里达 -动态仪表(自动配置)
______________________________________________________________________
⚡ 快速入门(从零到英雄)
步骤1:克隆存储库
git clone https://github.com/sjkim1127/Nexuscore_MCP.git
cd Nexuscore_MCP步骤2:自动环境设置
我们提供 多功能PowerShell脚本 它配置了整个分析环境。
以管理员身份运行 在PowerShell中:
Set-ExecutionPolicy Bypass -Scope Process -Force
.\scripts\setup_tools.ps1此脚本将:
- ✅ 安装Chocolatey软件包管理器
- ✅ 安装Rust、Python、Git、7-Zip和Visual C++构建工具
- ✅ 下载DIE、CAPA、FLOSS和Sysinternals工具
.\bin\ - ✅ 将工具添加到系统PATH
⏱️ 预期时间:10-15分钟(取决于网速)
安装完成后,重新启动终端以应用PATH更改。
步骤3:配置(.env)
创建一个 .env 根目录中的文件:
# .env - Configuration File
CAPE_API_URL=http://192.168.1.100:8000 # Your CAPEv2 instance (optional)
CAPE_API_TOKEN=your_token_here # API token if required (optional)
RUST_LOG=info # Log level (trace, debug, info, warn, error)备注:如果你没有CAPEv2沙盒,你可以跳过此步骤或使用公共实例。其他工具将独立工作。
步骤4:构建NexusCore MCP
cargo build --release构建时间:5-10分钟(首次构建编译所有依赖项)
步骤5:测试服务器
独立运行MCP服务器以验证其是否正常工作:
.\target\release\nexuscore_mcp.exe您应该看到:
[INFO] Starting NexusCore MCP Server (RMCP Standard)...
[INFO] Listening on Stdio...按 Ctrl+C 停止。服务器现在已准备好与AI客户端集成。
______________________________________________________________________
🤖 人工智能集成指南(克劳德桌面/光标)
适用于克劳德桌面
- 找到您的Claude Desktop配置文件:
- 视窗: %APPDATA%\Claude\claude_desktop_config.json - macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - Linux: ~/.config/Claude/claude_desktop_config.json
- 编辑配置文件 并添加NexusCore MCP:
{
"mcpServers": {
"nexuscore": {
"command": "C:\\Path\\To\\NexusCore_MCP\\target\\release\\nexuscore_mcp.exe",
"args": [],
"env": {
"CAPE_API_URL": "http://127.0.0.1:8000",
"RUST_LOG": "info"
}
}
}
}重要:替换C:\\Path\\To\\NexusCore_MCP使用您的实际安装路径。使用双反睫毛(\\)在Windows路径中。
- 重新启动克劳德桌面 完全(退出并重新打开)
- 验证安装:开始新的聊天,然后键入:
Can you list all available NexusCore tools?Claude应该提供一份恶意软件分析工具列表作为回应。
用于游标IDE
- 打开 光标设置 → MCP服务器
- 点击 添加服务器 并输入:
- 名字: NexusCore - 命令: C:\Path\To\NexusCore_MCP\target\release\nexuscore_mcp.exe - 环境变量: - CAPE_API_URL: http://127.0.0.1:8000 - RUST_LOG: info
- 保存 并重新启动Cursor
对于其他MCP客户端
使用stdio传输将服务器配置添加到客户端的MCP设置中:
- 命令:路径
nexuscore_mcp.exe - 运输:Stdio(标准输入/标准输出)
- 协议:MCP(模型上下文协议)
______________________________________________________________________
💬 使用示例
以下是真实世界的对话,展示了如何通过人工智能代理与NexusCore交互:
示例1:快速恶意软件分类
You: I have a suspicious file "invoice.exe". Can you analyze it?
Claude: I'll help you analyze invoice.exe. Let me start with static analysis.
[Claude calls die_scan tool]
Claude: The file is detected as:
- Compiler: Microsoft Visual C++ 8.0
- Packer: **UPX 3.96**
- Entropy: High (7.2/8.0) - Likely packed
Let me check for malware capabilities:
[Claude calls capa_scan]
Claude: CAPA detected the following capabilities:
- ✅ Network communication (HTTP)
- [X] Custom Dashboard UI
- [X] Integration with code analysis (Copilot / DeepSeek)
- [ ] Automated Deobfuscation
- [ ] Sandboxed macOS execution
## Creating Custom Tools
You can easily extend NexusCore MCP by creating and registering your own custom tools using the `Tool` trait and `inventory` crate. No need to touch the central server registry!
### 1. Implement the `Tool` trait
Create a new file for your tool, e.g., `src/tools/custom/my_tool.rs`:
use crate::tools::Tool; use async_trait::async_trait; use serde_json::Value; use anyhow::Result;
pub struct MyCustomTool;
#[async_trait] impl Tool for MyCustomTool { fn name(&self) -> &str { "my_custom_tool" }
fn description(&self) -> &str { "A custom tool that does something awesome." }
// You can optionally override schema to define JSON Schema parameters
async fn execute(&self, args: Value) -> Result { // Your logic here Ok(serde_json::json!({ "status": "success", "message": "Hello from custom tool!" })) } }
// Automatically register the tool inventory::submit! { crate::tools::ToolRegistration::new(|| std::sync::Arc::new(MyCustomTool)) }
### 2.包括模块
确保您的工具模块包含在项目树中。例如,添加 `pub mod my_tool;` 在 `src/tools/custom/mod.rs`The `inventory::submit!` 宏将在启动时自动将您的工具动态注册到系统中!
## 许可证
该项目根据MIT许可证获得许可。
建议:这可能是恶意软件。在虚拟机中继续进行动态分析?
Example 2: Bypassing Anti-Debug Protection
你:我调试恶意软件时它崩溃了。你能帮忙吗?
克劳德:这表示防调试保护。我会在隐形模式下生成它。
\[克劳德将spawn_process称为隐形=真\]
克劳德:用Frida隐形钩子生成的进程(PID:4568):
- Isdebuggerpresenty)→false
- NtQueryInformationProcess()→已修补
- CheckRemoteDebuggerPresent()→绕过
该过程现已暂停。让我扫描一下持久性:
\[克劳德称扫描为持久性\]
Claude:发现持久性机制:
- 位置:HKCU\\软件\\微软\\Windows\\当前版本\\运行
- 关键字:“Windows更新”
- 值:C:\\Users\\Admin\\AppData\\Roaming\\svchost.exe
我应该继续这个过程并监控它的行为吗?
Example 3: Unpacking and Dumping (experimental)
你:你能解压缩这个Themida保护的二进制文件吗?
克劳德:我会试着找到原始入口点(OEP)。
\[Claude调用spawn_process,然后调用find_oep(实验)\]
克劳德:OEP分析:
- 当前EIP:0x004015A0(Themida短截线)
- 在0x00401200处检测到拆包循环
- OEP候选:0x00405000(2450条指令后)
让我附加并转储进程内存:
\[Claude调用attach_process,然后调用内存转储\]
克劳德:内存转储(520 KB)。现在修复导入地址表:
\[Claude调用iat_fixer\]
克劳德:国际航空运输协会重建了89个进口产品。解压缩的二进制文件已准备就绪:
📁 输出:invoice_unpacked.exe
你想让我用CAPA分析解压缩的代码吗?
Example 4: Network Behavior Analysis
你:这个恶意软件会建立什么网络连接?
克劳德:让我生成进程并监视它的行为。
\[Claude调用spawn_process、scan_handles\]
克劳德:检测到网络活动:
- TCP连接到192.168.45.23:8080
- HTTP用户代理:“Mozilla/5.0”
- 静音:全局{5F2A8C9D-1234}
让我检查一下这个IP是否是已知的恶意IP。..
\[继续分析\]
📚 Analysis Scenario: "Cracking Themida"
- Initial Triage:
* Agent calls die_scan -> Result: "Themida / WinLicense 2.x". * Agent calls cape_submit -> Result: "Timeout / Crashed" (Sandbox evasion detected).
- Stealth Execution:
* Agent calls spawn_process(path="malware.exe", stealth=true). * NexusCore spawns process bundled with stealth_unpacker.js to hook IsDebuggerPresent and NtQueryInformationProcess.
- Behavior Monitoring:
* Agent calls scan_handles to find Mutex Global\GoGoMalware. * Agent calls scan_persistence and finds HKCU\..\Run\Updater.
- dumping & Fixing:
* Agent identifies unpacked code region. * Agent calls iat_fixer to rebuild the binary.
🔧 Tool Reference
Complete reference for all available tools with parameters and response formats.
Process Management Tools
spawn_process
Spawns a process in suspended state with optional Frida instrumentation.
Parameters:
{
"path": "C:\\malware\\sample.exe",
"stealth": true, // Optional: Enable anti-debug bypass
"args": ["--config", "test"] // Optional: Command-line arguments
}答复:
{
"pid": 4568,
"status": "suspended",
"stealth_enabled": true
}attach_process
附加到现有正在运行的进程。
参数:
{
"pid": 4568
}resume_process
恢复暂停的进程。
参数:
{
"pid": 4568
}inject_frida_script
将自定义Frida JavaScript注入进程。
参数:
{
"pid": 4568,
"script": "console.log('Hooked!'); Interceptor.attach(...);"
}静态分析工具
die_scan
使用Detect It Easy检测打包器、编译器和保护器。
参数:
{
"file_path": "C:\\malware\\sample.exe"
}答复:
{
"detections": ["UPX 3.96", "MSVS 2019"],
"entropy": 7.2,
"file_type": "PE32"
}capa_scan
使用CAPA分析恶意软件功能。
参数:
{
"file_path": "C:\\malware\\sample.exe"
}答复:
{
"capabilities": [
"create TCP socket",
"enumerate files",
"create registry key"
]
}floss_strings
使用FLOSS提取混淆的字符串。
参数:
{
"file_path": "C:\\malware\\sample.exe"
}动态分析工具
find_oep (实验)
查找打包可执行文件的原始入口点。
参数:
{
"pid": 4568,
"max_instructions": 10000
}答复:
{
"oep_address": "0x00405000",
"instructions_traced": 2450
}code_disassembler
在特定地址反汇编代码。
参数:
{
"pid": 4568,
"address": "0x00401000",
"length": 100
}pe_fixer
修复PE标头和转储可执行文件的部分。
参数:
{
"input_file": "C:\\dumps\\memory.bin",
"output_file": "C:\\dumps\\fixed.exe"
}iat_fixer
使用Scylla重建导入地址表。
参数:
{
"pid": 4568,
"dump_file": "C:\\dumps\\memory.bin"
}系统取证工具
scan_persistence
扫描持久性机制。
参数:
{
"scan_registry": true,
"scan_startup": true
}答复:
{
"registry_keys": [
{
"hive": "HKCU",
"path": "Software\\Microsoft\\Windows\\CurrentVersion\\Run",
"name": "Updater",
"value": "C:\\malware.exe"
}
],
"startup_files": []
}scan_handles
列出进程的打开句柄和互斥对象。
参数:
{
"pid": 4568
}答复:
{
"handles": [
{
"type": "File",
"name": "C:\\Windows\\System32\\notepad.exe"
},
{
"type": "Mutant",
"name": "Global\\MyMalwareMutex"
}
]
}沙盒工具
cape_submit
将样本提交到CAPEv2沙盒。
参数:
{
"file_path": "C:\\malware\\sample.exe",
"timeout": 300
}响应(异步作业):
{
"job_id": "job_...",
"status": "Processing in background. Use check_job_status tool to poll.",
"tool": "cape_submit"
}______________________________________________________________________
🛠️ 故障排除
常见问题及解决方法
❌ 在Claude Desktop中找不到“nexuscore_mcp.exe”
解决方案:
- 确保您构建了项目:
cargo build --release - 使用 完全绝对路径 在您的配置中:
C:\\Users\\YourName\\NexusCore_MCP\\target\\release\\nexuscore_mcp.exe - 使用双反睫毛(
\\)在Windows路径中
❌ “生成进程失败”错误
解决方案:
- 以以下方式运行克劳德桌面/光标 管理员
- 确保目标可执行文件存在并具有读取权限
- 检查防病毒软件是否阻止执行
- 验证Frida是否已安装:
pip install frida-tools
❌ “未找到DIE/CAPA”错误
解决方案:
- 重新运行安装脚本:
.\scripts\setup_tools.ps1
- 手动将工具添加到PATH:
$env:Path += ";C:\NexusCore_MCP\bin\DetectItEasy"
$env:Path += ";C:\NexusCore_MCP\bin\Capa"- 重新启动终端
❌ 构建过程中出现“Rust链接器错误”
解决方案:
- 安装Visual C++生成工具:
choco install visualcpp-build-tools -y- 或从以下网址下载:
❌ CAPEv2连接超时
解决方案:
- 验证CAPE是否正在运行:打开
http://127.0.0.1:8000在浏览器中 - 检查
.env文件正确CAPE_API_URL - CAPE提交是可选的-其他工具独立工作
❌ 扫描进程时“拒绝访问”
解决方案:
- 以以下方式运行MCP客户端(Claude Desktop/Cursor) 管理员
- 一些系统进程受到保护-使用VM进行恶意软件分析
调试模式
通过在您的 .env:
RUST_LOG=debug实时查看日志:
.\target\release\nexuscore_mcp.exe 2> debug.log获取帮助
- 问题:
- 文档:检查
/docs文件夹(如果可用) - 社区:加入存储库中的讨论
______________________________________________________________________
⚠️ 免责声明
此工具用于 授权安全研究和恶意软件分析 只有。作者和贡献者不对本软件造成的任何误用或损坏负责。 始终在隔离的虚拟机中运行恶意软件。
📄 许可证
MIT许可证
