README: full Chinese/English bilingual documentation
This commit is contained in:
parent
601773d487
commit
561ddaaab5
238
README.md
238
README.md
@ -1,5 +1,6 @@
|
||||
# MemScan-EDR
|
||||
|
||||
> **开源、轻量化、内存专项的 Windows 终端威胁检测与响应 (EDR) 工具**
|
||||
> **Open-Source, Lightweight, Memory-Focused Windows Endpoint Detection & Response (EDR) Tool**
|
||||
|
||||
[](LICENSE)
|
||||
@ -7,195 +8,206 @@
|
||||
[](https://www.microsoft.com/windows)
|
||||
[](https://github.com/dotnet/wpf)
|
||||
|
||||
MemScan-EDR scans all running processes, inspects memory for shellcode/injection/C2 patterns, and uses AI (OpenAI / Claude / local models) to classify threats in real time. Built with C# WPF for zero-dependency deployment as a single `.exe`.
|
||||
**中文** | MemScan-EDR 扫描所有运行中的进程,检查内存中的 Shellcode / 注入 / C2 特征,并利用 AI(OpenAI / Claude / 本地模型)实时分类威胁。基于 C# WPF 构建,通过 `dotnet publish` 打包为单个 `.exe`,无需目标机器安装 .NET 运行时。
|
||||
|
||||
**English** | MemScan-EDR scans all running processes, inspects memory for shellcode/injection/C2 patterns, and uses AI (OpenAI / Claude / local models) to classify threats in real time. Built with C# WPF for zero-dependency deployment as a single `.exe`.
|
||||
|
||||
---
|
||||
## Screenshots
|
||||
|
||||
| Dashboard | Scan Progress | Settings |
|
||||
|-----------|--------------|----------|
|
||||
| Real-time risk dashboard with live process statistics | Real-time scan log with per-process results | Multi-provider AI configuration panel |
|
||||
## 功能特性 / Features
|
||||
|
||||
### 核心能力 / Core Capabilities
|
||||
|
||||
| 能力 Capability | 描述 Description |
|
||||
|---|---|
|
||||
| **进程全量采集 Process Enumeration** | PID、进程名、路径、父进程树、启动命令行、数字签名、线程数、内存用量 / PID, name, path, parent tree, command line, digital signature, thread count, memory usage |
|
||||
| **内存扫描 Memory Scanning** | `VirtualQueryEx` 遍历每个已提交内存区域;检测 RWX 私有内存、未映射可执行页 / Traverses every committed region; detects RWX private memory, unbacked executable pages |
|
||||
| **签名匹配 Signature Matching** | 12 条内置检测规则:NOP sled、CALL/POP EIP、ROR13 hash、CobaltStrike Beacon、Meterpreter、ReflectiveLoader、Mimikatz 等 / 12 built-in rules covering shellcode, C2, injection, and malware patterns |
|
||||
| **AI 威胁分类 AI Threat Classification** | 多提供商支持(OpenAI 兼容 / Claude / Ollama / LM Studio)+ 启发式规则降级引擎 / Multi-provider support + heuristic fallback engine |
|
||||
| **CE-MCP 集成 CE-MCP Integration** | 自动启动 Cheat Engine MCP 服务器,提供内核级内存操作能力 / Auto-launch Cheat Engine MCP server for kernel-level memory operations |
|
||||
| **中英文界面切换 Chinese/English UI** | 一键切换全部标签、按钮、告警文本 / One-click language toggle; all labels, buttons, and alerts switch instantly |
|
||||
| **单文件 EXE Single-File EXE** | `dotnet publish` 生成自包含 `MemScan-EDR.exe`,目标机器无需 .NET 运行时 / Produces a self-contained EXE — no .NET runtime needed on target |
|
||||
|
||||
### AI 提供商 / AI Providers
|
||||
|
||||
| 提供商 Provider | 描述 Description | Base URL 示例 |
|
||||
|---|---|---|
|
||||
| **OpenAI 兼容 OpenAI-Compatible** | OpenAI / DeepSeek / 通义千问 / 智谱 等任意 OpenAI 格式 API | `https://api.openai.com/v1` |
|
||||
| **Claude** | Anthropic Claude Messages API | `https://api.anthropic.com` |
|
||||
| **本地模型 Local** | Ollama / LM Studio / vLLM / llama.cpp server | `http://127.0.0.1:11434` |
|
||||
| **启发式规则 Heuristic** | 内置规则引擎,无需 API Key | N/A |
|
||||
|
||||
### 内置签名 / Built-in Signatures
|
||||
|
||||
| 签名 Signature | 类别 Category | 严重性 Severity |
|
||||
|---|---|---|
|
||||
| `SHELLCODE_NOP_SLED` | Shellcode | 中 Medium |
|
||||
| `SHELLCODE_GETEIP` | Shellcode | 中 Medium |
|
||||
| `SHELLCODE_ROR13` | Shellcode | 中 Medium |
|
||||
| `C2_COBALTSTRIKE` | C2 | 高 High |
|
||||
| `C2_METERPRETER` | C2 | 中 Medium |
|
||||
| `INJECTION_REFLECTIVE` | 注入 Injection | 高 High |
|
||||
| `INJECTION_CRT` | 注入 Injection | 中 Medium |
|
||||
| `INJECTION_VAE` | 注入 Injection | 中 Medium |
|
||||
| `MALWARE_MIMIKATZ` | 恶意软件 Malware | 高 High |
|
||||
| `CRYPTO_MINER` | 挖矿 Crypto | 高 High |
|
||||
| `RANSOM_NOTE` | 恶意软件 Malware | 高 High |
|
||||
| `PS_DOWNLOAD` | 恶意软件 Malware | 中 Medium |
|
||||
|
||||
---
|
||||
## Features
|
||||
|
||||
### Core Capabilities
|
||||
|
||||
| Capability | Description |
|
||||
|------------|-------------|
|
||||
| **Process Enumeration** | Full process list with PID, name, path, parent tree, command line, digital signature, thread count, memory usage |
|
||||
| **Memory Scanning** | `VirtualQueryEx` traversal of every committed region; detects RWX private memory, unbacked executable pages |
|
||||
| **Signature Matching** | 12 built-in detection rules: NOP sled, CALL/POP EIP, ROR13 hash, CobaltStrike Beacon, Meterpreter, ReflectiveLoader, Mimikatz, etc. |
|
||||
| **AI Threat Classification** | Multi-provider support (OpenAI-compatible / Claude / Ollama / LM Studio) + heuristic fallback engine |
|
||||
| **CE-MCP Integration** | Auto-launch Cheat Engine MCP server for kernel-level memory operations |
|
||||
| **Chinese / English UI** | One-click language toggle; all labels, buttons, and alerts switch instantly |
|
||||
| **Single-File EXE** | `dotnet publish` produces a self-contained `MemScan-EDR.exe` — no .NET runtime needed on target |
|
||||
|
||||
### AI Providers
|
||||
|
||||
| Provider | Description | Base URL Example |
|
||||
|----------|-------------|-----------------|
|
||||
| **OpenAI-Compatible** | OpenAI / DeepSeek / Qwen / Zhipu / any OpenAI-format API | `https://api.openai.com/v1` |
|
||||
| **Claude** | Anthropic Claude via Messages API | `https://api.anthropic.com` |
|
||||
| **Local** | Ollama / LM Studio / vLLM / llama.cpp server | `http://127.0.0.1:11434` |
|
||||
| **Heuristic** | Built-in rule engine (no API key needed) | N/A |
|
||||
|
||||
### Built-in Signatures
|
||||
|
||||
| Signature | Category | Severity |
|
||||
|-----------|----------|----------|
|
||||
| `SHELLCODE_NOP_SLED` | Shellcode | Medium |
|
||||
| `SHELLCODE_GETEIP` | Shellcode | Medium |
|
||||
| `SHELLCODE_ROR13` | Shellcode | Medium |
|
||||
| `C2_COBALTSTRIKE` | C2 | High |
|
||||
| `C2_METERPRETER` | C2 | Medium |
|
||||
| `INJECTION_REFLECTIVE` | Injection | High |
|
||||
| `INJECTION_CRT` | Injection | Medium |
|
||||
| `INJECTION_VAE` | Injection | Medium |
|
||||
| `MALWARE_MIMIKATZ` | Malware | High |
|
||||
| `CRYPTO_MINER` | Crypto | High |
|
||||
| `RANSOM_NOTE` | Malware | High |
|
||||
| `PS_DOWNLOAD` | Malware | Medium |
|
||||
|
||||
---
|
||||
## Architecture
|
||||
## 架构 / Architecture
|
||||
|
||||
```
|
||||
TitleBar ── Window Chrome (Min/Max/Close, Language Toggle)
|
||||
Sidebar ── Navigation (Dashboard / Processes / Scan / Settings)
|
||||
Content ── 4 Views (WPF Grid Visibility switching)
|
||||
TitleBar ── 窗口控制(最小化/最大化/关闭,语言切换)
|
||||
Window Chrome (Min/Max/Close, Language Toggle)
|
||||
Sidebar ── 导航(仪表盘 / 进程 / 扫描 / 设置)
|
||||
Navigation (Dashboard / Processes / Scan / Settings)
|
||||
Content ── 4 个视图(WPF Grid Visibility 切换)
|
||||
4 Views (WPF Grid Visibility switching)
|
||||
|
||||
Services:
|
||||
ProcessCollector ── CreateToolhelp32Snapshot + WMI → ProcessInfo[]
|
||||
MemoryScanner ── VirtualQueryEx + signature walk → SignatureMatch[]
|
||||
AIAnalyzer ── HTTP → OpenAI/Claude/Ollama API → ScanResult
|
||||
MemoryScanner ── VirtualQueryEx + 签名遍历 → SignatureMatch[]
|
||||
AIAnalyzer ── HTTP → OpenAI/Claude/Ollama API → ScanResult
|
||||
CeMcpManager ── Process.Start → python server.py
|
||||
```
|
||||
|
||||
Data flows:
|
||||
数据流 / Data Flow:
|
||||
```
|
||||
[Start Scan] → ProcessCollector.CollectAll()
|
||||
→ for each ProcessInfo:
|
||||
→ MemoryScanner.ScanProcess() → signature matches
|
||||
→ MemoryScanner.GetSuspiciousRegions() → RWX private regions
|
||||
→ QuickPreScore() — skip API if score < 0.05
|
||||
[开始扫描 Start Scan] → ProcessCollector.CollectAll()
|
||||
→ 每个 ProcessInfo:
|
||||
→ MemoryScanner.ScanProcess() → 签名匹配
|
||||
→ MemoryScanner.GetSuspiciousRegions() → RWX 私有区域
|
||||
→ QuickPreScore() — score < 0.05 则跳过 API
|
||||
→ AIAnalyzer.AnalyzeProcessAsync() → ScanResult
|
||||
→ API call with structured prompt
|
||||
→ 结构化 Prompt API 调用
|
||||
→ ParseResponse() → RiskLevel + Score + Indicators
|
||||
→ Update DataGrid / Stats in real-time via IProgress<>
|
||||
→ 通过 IProgress<> 实时更新 DataGrid / 统计数据
|
||||
```
|
||||
|
||||
---
|
||||
## Quick Start
|
||||
|
||||
### Prerequisites
|
||||
## 快速开始 / Quick Start
|
||||
|
||||
### 环境要求 / Prerequisites
|
||||
|
||||
- Windows 10 / 11 (x64)
|
||||
- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) (for building)
|
||||
- Administrator privileges (for memory scanning)
|
||||
- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)(用于编译 / for building)
|
||||
- 管理员权限(用于内存扫描 / for memory scanning)
|
||||
|
||||
### Build
|
||||
### 编译构建 / Build
|
||||
|
||||
```powershell
|
||||
# Clone
|
||||
# 克隆项目 Clone
|
||||
git clone https://github.com/Huang-158/MemScan-EDR.git
|
||||
cd MemScan-EDR\src-csharp
|
||||
|
||||
# Build (Debug)
|
||||
# Debug 编译
|
||||
dotnet build MemScanEDR.sln
|
||||
|
||||
# Publish single-file EXE (Release)
|
||||
# 发布单文件 EXE(Release)
|
||||
dotnet publish MemScanEDR\MemScanEDR.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o publish
|
||||
|
||||
# Run
|
||||
# 运行 Run
|
||||
.\publish\MemScan-EDR.exe
|
||||
```
|
||||
|
||||
Or use the convenience script:
|
||||
或使用便捷脚本 / Or use the convenience script:
|
||||
|
||||
```powershell
|
||||
.\scripts\build_csharp.bat
|
||||
```
|
||||
|
||||
### CE-MCP Setup (Optional)
|
||||
### CE-MCP 配置(可选 / Optional)
|
||||
|
||||
CE-MCP 通过 Cheat Engine 提供更深层的内存扫描能力。启动时如果找到 `server.py` 会自动启动。
|
||||
|
||||
CE-MCP provides deeper memory scanning via Cheat Engine. The application auto-starts it at launch if `server.py` is found.
|
||||
|
||||
1. Place [ce-mcp-server](https://github.com/Huang-158/ce-mcp-server) next to the project
|
||||
2. Or configure the path in Settings → CE-MCP Server Path
|
||||
3. Set to `disabled` to run without CE-MCP
|
||||
1. 将 [ce-mcp-server](https://github.com/Huang-158/ce-mcp-server) 放在项目同级目录 / Place ce-mcp-server next to the project
|
||||
2. 或在设置界面配置 CE-MCP 服务器路径 / Or configure the path in Settings → CE-MCP Server Path
|
||||
3. 设为 `disabled` 可跳过 CE-MCP / Set to `disabled` to run without CE-MCP
|
||||
|
||||
### AI Configuration
|
||||
### AI 配置 / AI Configuration
|
||||
|
||||
Open Settings panel in the application:
|
||||
在应用设置面板中 / Open Settings panel in the application:
|
||||
|
||||
1. Select provider: Heuristic / OpenAI-Compatible / Claude / Local
|
||||
2. Enter API Base URL (pre-filled defaults for each provider)
|
||||
3. Enter API Key (stored locally in `data/settings.json`)
|
||||
4. Enter Model name (e.g. `gpt-4o-mini`, `claude-3-5-sonnet`, `llama3`)
|
||||
5. Click Save
|
||||
1. 选择提供商 / Select provider:启发式 / OpenAI 兼容 / Claude / 本地
|
||||
2. 填写 API 地址(每个提供商有预填默认值)/ Enter API Base URL (pre-filled defaults)
|
||||
3. 填写 API Key(本地存储于 `data/settings.json`)/ Enter API Key (stored locally)
|
||||
4. 填写模型名称(如 `gpt-4o-mini`, `claude-3-5-sonnet`, `llama3`)/ Enter Model name
|
||||
5. 点击保存 / Click Save
|
||||
|
||||
---
|
||||
## Project Structure
|
||||
|
||||
## 项目结构 / Project Structure
|
||||
|
||||
```
|
||||
MemScan-EDR/
|
||||
├── src-csharp/
|
||||
│ ├── MemScanEDR.sln
|
||||
│ └── MemScanEDR/
|
||||
│ ├── MemScanEDR.csproj # .NET 8 WPF project
|
||||
│ ├── MemScanEDR.csproj # .NET 8 WPF 项目配置文件
|
||||
│ ├── app.manifest # UAC asInvoker
|
||||
│ ├── App.xaml / App.xaml.cs # Application entry + crash logging
|
||||
│ ├── MainWindow.xaml # WPF UI (white theme, 4 views)
|
||||
│ ├── MainWindow.xaml.cs # UI logic + scan orchestrator + Lang helper
|
||||
│ ├── App.xaml / App.xaml.cs # 应用入口 + 崩溃日志 / Entry + crash logging
|
||||
│ ├── MainWindow.xaml # WPF 界面(白色主题,4 视图) / UI (white theme, 4 views)
|
||||
│ ├── MainWindow.xaml.cs # UI 逻辑 + 扫描编排 + 语言切换 / Logic + orchestrator + Lang helper
|
||||
│ ├── Models/
|
||||
│ │ ├── ProcessInfo.cs # Data models (ProcessInfo, ScanResult, Signature, etc.)
|
||||
│ │ ├── AIConfig.cs # AI provider enum + config class
|
||||
│ │ └── AppSettings.cs # JSON persistence (settings.json)
|
||||
│ │ ├── ProcessInfo.cs # 数据模型 / Data models
|
||||
│ │ ├── AIConfig.cs # AI 提供商枚举 + 配置类 / Provider enum + config class
|
||||
│ │ └── AppSettings.cs # JSON 持久化 / JSON persistence
|
||||
│ └── Services/
|
||||
│ ├── ProcessCollector.cs # P/Invoke process enumeration + WMI command lines
|
||||
│ ├── MemoryScanner.cs # VirtualQueryEx scanning + 12 built-in signatures
|
||||
│ ├── AIAnalyzer.cs # Multi-provider AI + heuristic fallback + pre-filter
|
||||
│ └── CeMcpManager.cs # CE-MCP subprocess lifecycle
|
||||
│ ├── ProcessCollector.cs # P/Invoke 进程枚举 + WMI 命令行 / Process enumeration
|
||||
│ ├── MemoryScanner.cs # VirtualQueryEx 扫描 + 12 条签名 / Memory scanning + signatures
|
||||
│ ├── AIAnalyzer.cs # 多提供商 AI + 启发式降级 + 预过滤 / AI + heuristic + pre-filter
|
||||
│ └── CeMcpManager.cs # CE-MCP 子进程生命周期管理 / Subprocess lifecycle
|
||||
├── rules/
|
||||
│ ├── shellcode.yar # YARA shellcode rules
|
||||
│ ├── injection.yar # YARA injection rules
|
||||
│ └── malware_strings.yar # YARA malware string rules
|
||||
│ ├── shellcode.yar # YARA Shellcode 规则
|
||||
│ ├── injection.yar # YARA 注入检测规则 / Injection rules
|
||||
│ └── malware_strings.yar # YARA 恶意字符串规则 / Malware string rules
|
||||
├── scripts/
|
||||
│ └── build_csharp.bat # Build + publish shortcut
|
||||
│ └── build_csharp.bat # 编译 + 发布快捷脚本 / Build + publish shortcut
|
||||
├── LICENSE
|
||||
└── README.md
|
||||
```
|
||||
|
||||
---
|
||||
## How AI Analysis Works
|
||||
|
||||
The AI analyzer uses a carefully designed prompt to reduce false positives:
|
||||
## AI 分析机制 / How AI Analysis Works
|
||||
|
||||
1. **Pre-filter**: Processes with zero suspicious indicators (signed, system path, no RWX memory, no signature matches) are marked `Safe` without any API call — saving cost and time.
|
||||
AI 分析器通过精心设计的 Prompt 降低误报率:
|
||||
|
||||
2. **Structured Prompt**: Each process gets a formatted report including:
|
||||
- Process metadata (PID, name, path, parent, command line, signer)
|
||||
- Network connections (protocol, remote address, state)
|
||||
- Memory signature matches (category, severity, description)
|
||||
- Suspicious memory regions (RWX private, unbacked executable)
|
||||
The AI analyzer uses a carefully designed prompt to reduce false positives:
|
||||
|
||||
3. **Safe-by-Default Policy**: The AI is instructed that >95% of processes are benign. It requires **multiple concurring indicators** to elevate risk level — a single RWX region or signature match alone is not enough.
|
||||
1. **预过滤 Pre-filter**:没有任何可疑特征的进程(有签名、系统路径、无 RWX 内存、无签名匹配)直接标记为 `安全`,不调用 API,节省成本和耗时 / Processes with zero suspicious indicators are marked `Safe` without any API call.
|
||||
|
||||
4. **Heuristic Fallback**: If the AI API is unavailable, a weighted heuristic engine takes over with conservative thresholds (≥0.50 for suspicious, ≥0.75 for high).
|
||||
2. **结构化 Prompt Structured Prompt**:每个进程生成格式化报告,包含 / Each process gets a formatted report including:
|
||||
- 进程元数据(PID、名称、路径、父进程、命令行、签名者)/ Process metadata
|
||||
- 网络连接(协议、远程地址、状态)/ Network connections
|
||||
- 内存签名匹配(类别、严重性、描述)/ Memory signature matches
|
||||
- 可疑内存区域(RWX 私有、非映像可执行页)/ Suspicious memory regions
|
||||
|
||||
3. **默认安全策略 Safe-by-Default Policy**:AI 被指示 >95% 的进程是良性的。需要 **多个并发指标** 才能提升风险等级——单一 RWX 区域或签名匹配并不足够 / The AI is instructed that >95% of processes are benign; requires multiple concurring indicators.
|
||||
|
||||
4. **启发式降级 Heuristic Fallback**:AI API 不可用时,加权启发式引擎接管,采用保守阈值(≥0.50 为可疑,≥0.75 为高危)/ Conservative thresholds take over (≥0.50 for suspicious, ≥0.75 for high).
|
||||
|
||||
---
|
||||
## Disclaimer
|
||||
|
||||
> **Third-Party / Non-Affiliation Statement**
|
||||
## 声明 / Disclaimer
|
||||
|
||||
> **第三方 / 非关联声明 Third-Party / Non-Affiliation Statement**
|
||||
>
|
||||
> This project is not affiliated with Cheat Engine, its original author Dark Byte, or any AI provider (OpenAI, Anthropic, etc.).
|
||||
> 本项目与 Cheat Engine、其原作者 Dark Byte 以及任何 AI 提供商(OpenAI、Anthropic 等)无任何关联。
|
||||
> This project is not affiliated with Cheat Engine, Dark Byte, or any AI provider (OpenAI, Anthropic, etc.).
|
||||
>
|
||||
> **Legal Use Statement**
|
||||
> **合法使用声明 Legal Use Statement**
|
||||
>
|
||||
> This tool is intended for **legitimate security research, education, and authorized security assessments only**. Unauthorized use against systems you do not own or have permission to test is illegal. Users are responsible for complying with all applicable laws.
|
||||
> 本工具仅用于**合法的安全研究、教育及授权的安全评估**。未经授权对非自有或未被许可的系统使用属违法行为。使用者须遵守当地法律法规并自行承担所有风险。
|
||||
> This tool is intended for **legitimate security research, education, and authorized security assessments only**. Unauthorized use is illegal. Users are responsible for complying with all applicable laws.
|
||||
|
||||
---
|
||||
## License
|
||||
|
||||
MIT License — see [LICENSE](LICENSE) for full text.
|
||||
## 许可证 / License
|
||||
|
||||
MIT License — 详见 [LICENSE](LICENSE) / See [LICENSE](LICENSE) for full text.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user