sauravbhattacharya001/WinSentinel
GitHub: sauravbhattacharya001/WinSentinel
一款基于 .NET 8 的 Windows 端点安全代理,提供全天候实时监控、AI 威胁关联检测和自动修复能力,解决传统审计工具无法持续防护和主动响应的问题。
Stars: 2 | Forks: 0
# 🛡️ WinSentinel
### 您的全天候 Windows 安全代理
[](https://github.com/sauravbhattacharya001/WinSentinel/actions/workflows/build.yml)
[](https://github.com/sauravbhattacharya001/WinSentinel/actions/workflows/codeql.yml)
[](https://codecov.io/gh/sauravbhattacharya001/WinSentinel)
[](https://github.com/sauravbhattacharya001/WinSentinel/releases)
[](https://dotnet.microsoft.com/)
[](https://www.microsoft.com/windows)
[](LICENSE)
[]()
[]()
**不仅是一个审计器 —— 更是一个 24/7 全天候监控、检测、关联并响应的活跃代理。**
*实时威胁检测 • 13 个审计模块 • 自动修复 • 聊天控制台 • AI 驱动关联 • 合规配置文件*
[🚀 快速开始](#-quick-start) · [📦 安装](#-installation) · [📖 文档](https://sauravbhattacharya001.github.io/WinSentinel/) · [🐛 问题反馈](https://github.com/sauravbhattacharya001/WinSentinel/issues) · [📋 更新日志](#-releases)
## 为什么选择 WinSentinel?
大多数 Windows 安全工具只运行一次并生成报告。WinSentinel 与众不同:
- **始终在线** — 作为 Windows 服务运行,24/7 全天候监控系统
- **关联事件** — 不仅仅标记单个事件,还能检测多阶段攻击模式
- **采取行动** — 自动修复威胁,并支持完整的撤销操作
- **懂你的语言** — 基于 Chat 的控制台,支持 25+ 命令以及自然语言
- **感知合规** — 内置 Home、Enterprise、HIPAA、PCI-DSS 和 CIS L1 配置文件
- **深度测试** — 49 个测试文件中包含 1,172 个自动化测试
## 🏗️ 架构
双进程设计:一个后台代理(Windows 服务)和一个通过 Named Pipe IPC 连接的 WPF 仪表板。
```
┌─────────────────────────────────────────┐
│ WinSentinel Agent (Windows Service) │
│ ├── Process Monitor (real-time) │
│ ├── File System Watcher (real-time) │
│ ├── Event Log Listener (real-time) │
│ ├── Network Monitor (real-time) │
│ ├── Scheduled Auditor (13 modules) │
│ ├── Agent Brain + Threat Correlator │
│ ├── Auto-Remediator (7 actions + undo) │
│ ├── Input Sanitizer (security layer) │
│ └── IPC Server (named pipe) │
└──────────────┬──────────────────────────┘
│ Named Pipe IPC
┌──────────────┴──────────────────────────┐
│ WinSentinel Dashboard (WPF) │
│ ├── Live Dashboard + Score Gauge │
│ ├── Real-time Threat Feed │
│ ├── Chat Control Plane │
│ ├── Score History & Trends │
│ ├── Compliance Profile Selector │
│ ├── Finding Ignore/Suppress Rules │
│ ├── Policy Configuration │
│ └── Export Reports (HTML/JSON/MD/Text) │
└─────────────────────────────────────────┘
```
代理持续运行 —— 即使仪表板关闭 —— 监视进程、文件更改、事件日志和网络活动。当它检测到可疑行为时,会关联事件、分类威胁,并根据可配置的策略自动修复。
## ⚡ 功能概览
| 类别 | 您将获得 |
|:---|:---|
| 🔍 **4 个实时监视器** | 进程创建/终止、文件系统更改、Windows 事件日志、网络连接 —— 持续监视 |
| 🧠 **AI 驱动的大脑** | 将单个事件关联成攻击链。检测单事件分析会遗漏的多阶段攻击 |
| 🔧 **7 项自动修复操作** | 终止进程、隔离文件、封锁 IP、禁用账户、恢复 hosts、重新启用 Defender、还原注册表 —— **全部支持撤销** |
| 💬 **Chat 控制台** | 25+ 命令外加自然语言。运行审计、查询威胁、配置策略 —— 尽在 Chat 面板 |
| 📊 **13 个审计模块** | Firewall、Updates、Defender、Accounts、Network、Processes、Startup、System、Privacy、Browser、App Security、Encryption、Event Log |
| 📋 **合规配置文件** | Home、Enterprise、HIPAA、PCI-DSS、CIS L1 —— 感知上下文的评分,针对不同配置文件调整严重性 |
| 🔕 **发现项抑制** | 使用正则规则、过期日期和审计追踪忽略/抑制已知可接受的发现项 |
| 📈 **评分历史** | 基于 SQLite 的审计追踪与趋势。查看您的安全态势随时间的变化 |
| 📤 **导出报告** | HTML、JSON、Text、Markdown —— 保存并分享结果 |
| 🔔 **Toast 通知** | 通过 Windows 通知中心发出关键发现警报 |
| 💻 **CLI 模式** | 完整的 CLI (`winsentinel.exe`),用于脚本编写、自动化和 CI/CD 门禁检查 |
| ⚙️ **系统托盘** | 最小化到托盘并在后台静默运行 |
| 🛡️ **输入净化** | 集中式安全层防止所有面向用户的输入中的命令注入 |
## 📸 审计输出示例
```
╔══════════════════════════════════════════════════════╗
║ WinSentinel Security Audit Report ║
║ 2026-02-21 22:35:00 PST ║
║ Profile: Enterprise ║
╠══════════════════════════════════════════════════════╣
║ ║
║ Security Score: 92 / 100 Grade: A ║
║ ████████████████████████████████░░ 92% ║
║ ║
╠══════════════════════════════════════════════════════╣
║ Module Score Status ║
╠══════════════════════════════════════════════════════╣
║ 🔥 Firewall 100 ██████████ PASS ║
║ 🔄 Updates 95 █████████░ PASS ║
║ 🛡️ Defender 100 ██████████ PASS ║
║ 👤 Accounts 100 ██████████ PASS ║
║ 🌐 Network 90 █████████░ PASS ║
║ ⚙️ Processes 90 █████████░ PASS ║
║ 🚀 Startup 95 █████████░ PASS ║
║ 💻 System 100 ██████████ PASS ║
║ 🔒 Privacy 95 █████████░ PASS ║
║ 🌍 Browser 85 ████████░░ PASS ║
║ 📦 App Security 90 █████████░ PASS ║
║ 🔐 Encryption 80 ████████░░ WARN ║
║ 📋 Event Log 85 ████████░░ PASS ║
╠══════════════════════════════════════════════════════╣
║ Findings: 65 total | 0 critical | 5 warnings ║
║ Suppressed: 2 (accepted risk) ║
╚══════════════════════════════════════════════════════╝
```
## 🚀 快速开始
### 前置条件
- **Windows 10 或 11** (x64)
- [**.NET 8 SDK**](https://dotnet.microsoft.com/download/dotnet/8.0) (用于从源码构建)
### 克隆、构建并运行
```
git clone https://github.com/sauravbhattacharya001/WinSentinel.git
cd WinSentinel
# 构建
dotnet build WinSentinel.sln -p:Platform=x64
# 运行 dashboard
dotnet run --project src/WinSentinel.App -p:Platform=x64
# 运行测试 (1,172 项测试)
dotnet test -p:Platform=x64
```
### 快速审计(无需构建)
```
.\RunAudit.ps1
```
## 📦 安装
### 方式 1:MSIX 安装程序
```
# 下载 cert,安装 MSIX — 一条命令
.\Install-WinSentinel.ps1
```
### 方式 2:Windows 服务
```
dotnet build src/WinSentinel.Agent -c Release
# 安装 (需要管理员权限)
.\Install-Agent.ps1 -Install
# 检查状态
.\Install-Agent.ps1 -Status
```
### 方式 3:从源码构建 MSIX
```
cd src\WinSentinel.Installer
.\Build-Msix.ps1
# → dist\WinSentinel.msix
```
## 🔍 实时监视器
| 监视器 | 监视内容 | 关键检测 |
|:---|:---|:---|
| ⚙️ **Process** | 进程创建与终止 | 可疑可执行文件、未签名二进制文件、临时/下载路径启动、已知恶意名称 |
| 📁 **File System** | 文件创建/修改/删除/重命名 | 系统目录更改、hosts 文件篡改、启动文件夹修改、可疑 DLL |
| 📋 **Event Log** | Windows 安全与系统日志 | 登录失败、权限提升、审核策略更改、服务安装、账户修改 |
| 🌐 **Network** | 活动连接与监听端口 | 新监听器、已知恶意 IP、异常出站端口、DNS 异常 |
## 📊 13 个审计模块
| # | 模块 | 扫描内容 |
|:---:|:---|:---|
| 1 | 🔥 **Firewall** | 所有配置文件状态、规则分析、危险端口暴露 (RDP 3389, SMB 445, Telnet 23) |
| 2 | 🔄 **Updates** | Windows Update 服务、待处理更新、上次安装日期、更新源配置 |
| 3 | 🛡️ **Defender** | 实时保护、云保护、行为监控、定义年龄、防篡改保护 |
| 4 | 👤 **Accounts** | 本地用户、管理员审计、密码策略、来宾账户、空密码 |
| 5 | 🌐 **Network** | 开放端口、SMB/RDP 暴露、LLMNR/NetBIOS 欺骗、Wi-Fi 安全、ARP、IPv6 |
| 6 | ⚙️ **Processes** | 未签名可执行文件、可疑路径、高权限监控 |
| 7 | 🚀 **Startup** | 启动程序、计划任务、Run/RunOnce 键、服务类型 |
| 8 | 💻 **System** | OS 构建、Secure Boot、BitLocker、UAC 级别、RDP 配置、DEP/NX |
| 9 | 🔒 **Privacy** | 遥测、广告 ID、位置跟踪、剪贴板同步、活动历史记录 |
| 10 | 🌍 **Browser** | Chrome/Edge 设置、危险扩展、已保存密码、更新状态 |
| 11 | 📦 **App Security** | 过时软件、EOL 标记、已安装程序分析 |
| 12 | 🔐 **Encryption** | BitLocker、EFS、证书存储、TPM 状态 |
| 13 | 📋 **Event Log** | 登录失败、可疑事件、审核策略缺口 |
## 📋 合规配置文件
内置配置文件针对不同的安全上下文调整严重性权重和评分:
| 配置文件 | 目标环境 | 关键调整 |
|:---|:---|:---|
| 🏠 **Home** | 个人/家庭使用 | 宽松 —— 信息级项目不扣分 |
| 🏢 **Enterprise** | 企业工作站 | 适中 —— 强调补丁、网络、账户 |
| 🏥 **HIPAA** | 医疗环境 | 严格 —— 加密、审计日志、访问控制权重极高 |
| 💳 **PCI-DSS** | 支付卡处理 | 严格 —— 网络分段、防火墙、补丁至关重要 |
| 🔒 **CIS L1** | CIS 基准 Level 1 | 全面 —— 所有组织的安全基线 |
通过仪表板或 CLI 切换配置文件,查看您的系统在不同合规框架下的评分。
## 🔧 自动修复
7 项自主响应操作,每一项都支持完全撤销:
| 操作 | 作用 | 可逆 |
|:---|:---|:---:|
| Kill Process | 终止可疑进程 | — |
| Quarantine File | 移动到隔离目录 | ✅ |
| Block IP | 创建防火墙封锁规则 | ✅ |
| Disable Account | 禁用受损账户 | ✅ |
| Restore Hosts | 将 hosts 文件还原到干净状态 | ✅ |
| Re-enable Defender | 重新开启实时保护 | — |
| Revert Registry | 撤销恶意注册表更改 | ✅ |
## 💬 Chat 控制台
25+ 命令外加自然语言理解:
```
> status # Agent uptime, active monitors
> threats # Recent threat events
> audit # Run full 13-module audit
> audit firewall # Run specific module
> score # Current score and grade
> history # Score trend over time
> monitor status # All 4 monitor states
> start monitor process # Start specific monitor
> policy # Show current policies
> set risk tolerance high # Adjust sensitivity
> quarantine # List quarantined files
> undo - ` | 逗号分隔的模块列表 |
| `--threshold
**基于 .NET 8 使用 C# 构建 · 27k+ 行代码 · 1,172 个测试 · 始终监视 🛡️**
[⭐ Star](https://github.com/sauravbhattacharya001/WinSentinel) · [🐛 报告 Bug](https://github.com/sauravbhattacharya001/WinSentinel/issues) · [💡 请求功能](https://github.com/sauravbhattacharya001/WinSentinel/issues)
标签:AI安全, AI风险缓解, AMSI绕过, BurpSuite集成, Chat Copilot, ChatOps, Conpot, DevSecOps, EDR, GPT, IP 地址批量处理, Mr. Robot, .NET 8, PB级数据处理, TLS, Windows安全, Windows服务, WSL, 上游代理, 动态调试, 后渗透, 威胁检测, 安全代理, 安全运维, 无线安全, 日志关联, 流量嗅探, 漏洞管理, 端点安全, 端点防护, 系统加固, 脆弱性评估, 自动修复, 补丁管理, 请求响应过滤, 速率限制, 防御工具