Lucas18062025/SIEM_Windows_11

GitHub: Lucas18062025/SIEM_Windows_11

面向 Windows 10/11 的轻量级 SIEM 工具,提供实时安全事件监控告警与基于 CVSS 评分的主机漏洞审计能力。

Stars: 0 | Forks: 1

# 🛡️ SIEM v4.0 — Windows 安全监控器 [![Python](https://img.shields.io/badge/python-3.10%2B-3776ab?style=flat-square&logo=python&logoColor=white)](https://www.python.org/) [![Platform](https://img.shields.io/badge/platform-Windows%2010%2F11-0078d4?style=flat-square&logo=windows&logoColor=white)](https://www.microsoft.com/windows) [![License](https://img.shields.io/badge/license-MIT-22c55e?style=flat-square)](LICENSE) [![Status](https://img.shields.io/badge/status-active-22c55e?style=flat-square)]() [![CVSS](https://img.shields.io/badge/scoring-CVSS%20v3.1-dc2626?style=flat-square)]() [![NVD](https://img.shields.io/badge/database-NVD%20%2F%20NIST-1d4ed8?style=flat-square)](https://nvd.nist.gov/) ## 📐 系统架构 ``` ┌─────────────────────────────────────────────────────────────────┐ │ SIEM Personal v4.0 │ │ │ │ Windows Event Logs siem_consola.py (Entry Point) │ │ ┌──────────────┐ ┌────────────────────────────┐ │ │ │ Security │──────────▶ │ SIEMConfig │ │ │ │ System │ │ (config.yaml + .env) │ │ │ └──────────────┘ └───────────┬────────────────┘ │ │ │ │ │ ┌────────────▼────────────────┐ │ │ │ EventProcessor │ │ │ │ ┌──────────────────────┐ │ │ │ │ │ IDs: 4625, 4740, │ │ │ │ │ │ 1102, 4719, 4720... │ │ │ │ │ └──────────┬───────────┘ │ │ │ └─────────────┼───────────────┘ │ │ ┌──────────────────┤ │ │ │ │ │ │ ┌──────────▼──────┐ ┌────────▼────────┐ │ │ │ TelegramNotifier│ │ LogManager │ │ │ │ rate limiting │ │ rotation + gz │ │ │ │ cooldown/type │ │ Logs/ Alertas/ │ │ │ └─────────────────┘ └─────────────────┘ │ └─────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────┐ │ Herramientas de Auditoría │ │ │ │ vuln_hp.py scan_ports.py │ │ ┌─────────────────────┐ ┌────────────────────────┐ │ │ │ nmap -sV (1-1024) │ │ ThreadPoolExecutor │ │ │ │ │ │ │ puertos 1-1024 │ │ │ │ NVD API v2.0 │ │ concurrente │ │ │ │ CVSS v3.1 scoring │ └────────────────────────┘ │ │ │ caché disco TTL │ │ │ │ reporte JSON │ │ │ └─────────────────────┘ │ └─────────────────────────────────────────────────────────────────┘ ``` ## 🚀 组件 ### `siem_consola.py` — 实时事件监控器 - 通过 `win32evtlog` 读取 Windows Event Logs(**只读**模式,主机风险:0/10) - 检测严重的安全事件(见下方完整表格) - 通过 Telegram 发送即时告警,支持速率限制和基于事件类型的冷却时间 - 自动轮转日志(天数 + 最大容量 + `.gz` 压缩) - 带有可配置时间窗口的事件内存(防止垃圾信息刷屏) - 通过 `SIGINT` / `SIGTERM` / `SIGBREAK` (Windows) 实现优雅关闭 ### `vuln_hp.py` — 风险与 CVE 分类器 - 使用 `nmap -sV` 扫描服务(端口 1-1024) - 自动查询 [NVD API v2.0](https://nvd.nist.gov/developers/vulnerabilities) - 基于真实的 **CVSS v3.1** 进行评分(最坏情况,而非单纯计算 CVE 数量) - 主机的执行级分类:`严重 / 高 / 中 / 低` - 具有可配置 TTL 的持久化磁盘缓存(避免触发 NVD 速率限制) - 遇到 HTTP 429 错误时使用指数退避策略进行重试 - 导出包含操作者元数据的 **JSON** 格式报告 ### `scan_ports.py` — 快速网络扫描器 - 使用 `ThreadPoolExecutor` 并发扫描 1-1024 端口 - 针对本地网络进行了低影响优化 ## 🔍 监控的事件 | Event ID | 描述 | 严重程度 | Telegram 告警 | |----------|-------------|-----------|-----------------| | `4625` | 登录失败 | 🔴 高 | ✅ 是 | | `4648` | 使用显式凭据登录 | 🟠 中 | ❌ 否 | | `4719` | 审计策略已修改 | 🔴 高 | ✅ 是 | | `4720` | 已创建用户账户 | 🟠 中 | ❌ 否 | | `4726` | 已删除用户账户 | 🔴 高 | ✅ 是 | | `4740` | 账户被锁定 | 🔴 高 | ✅ 是 | | `7031` | 服务意外停止 | 🟡 中 | ❌ 否 | | `7036` | 服务状态更改 | 🟡 低 | ❌ 否 | | `1102` | **审计日志已被删除** | 🔴 严重 | ✅ 是 | ## 🛠️ 要求 | 要求 | 版本 | 备注 | |-----------|---------|-------| | Windows | 10 / 11 | `win32evtlog` 必需 | | Python | 3.10+ | 已在 3.13 上测试 | | nmap | 任意版本 | 仅 `vuln_hp.py` 需要 — 必须在 `PATH` 中 | | NVD API Key | — | 可选但推荐 — [在此获取](https://nvd.nist.gov/developers/request-an-api-key) | ## 📦 安装 ``` # 1. 克隆仓库 git clone https://github.com/Lucas18062025/SIEM_Windows_11.git cd SIEM_Windows_11 # 2. 创建虚拟环境并安装依赖(推荐使用 uv) uv venv uv pip install -r requirements.txt # 如果不使用 uv: python -m venv .venv .venv\Scripts\activate pip install -r requirements.txt # 3. 配置环境变量 copy .env.example .env # 使用你的 Telegram token、chat ID 和 NVD API key 编辑 .env ``` ## 💻 用法 ``` # 激活虚拟环境 .venv\Scripts\activate # ── SIEM 主程序(持续监控) python siem_consola.py # ── 扫描主机的端口 python scan_ports.py 192.168.1.1 # ── 漏洞分析 + CVEs python vuln_hp.py 192.168.1.1 # ── 验证安装 python verify_siem.py ``` **停止 SIEM:** `Ctrl+C` — 优雅关闭,主机不会受到任何更改。 ## ⚙️ 配置 所有配置都集中在 `config.yaml` 和 `.env` 中: ``` # config.yaml — 操作参数 timing: scan_interval_seconds: 10 memory_window_seconds: 3600 telegram: cooldown_per_type_seconds: 60 global_rate_limit_per_minute: 20 ``` ``` # .env — 凭证(切勿提交) TELEGRAM_TOKEN=tu_token_aqui TELEGRAM_CHAT_ID=tu_chat_id NVD_API_KEY=tu_api_key_nvd CONTACT_NOMBRE=Tu Nombre CONTACT_PORTFOLIO=https://tu-portfolio.com CONTACT_LINKEDIN=https://linkedin.com/in/tu-perfil ``` ## 📁 项目结构 ``` SIEM_Windows_11/ ├── siem/ # Módulos del SIEM │ ├── config.py # Gestión de configuración │ ├── event_processor.py # Procesamiento de eventos Windows │ ├── log_manager.py # Rotación y escritura de logs │ └── notifier.py # Integración Telegram ├── siem_consola.py # Entry point del SIEM ├── vuln_hp.py # Escáner de vulnerabilidades + CVEs ├── scan_ports.py # Escáner rápido de puertos ├── verify_siem.py # Verificación de instalación ├── config.yaml # Configuración operacional ├── requirements.txt # Dependencias Python ├── .env.example # Template de variables de entorno ├── .gitignore ├── CHANGELOG.md └── LICENSE ``` ## ⚠️ 免责声明 本软件**仅用于防御和教育目的**。扫描工具(`scan_ports.py`、`vuln_hp.py`)必须**仅**在获得所有者明确授权的网络或主机上运行。 开发者不对本软件的滥用承担责任。 ## 👤 操作者 **Lucas Villagra** — 网络安全分析师,道德黑客学生 · Red Team / Blue Team · NOA, 阿根廷 [![Portfolio](https://img.shields.io/badge/Portfolio-lucas18062025.github.io-0f172a?style=flat-square&logo=github)](https://lucas18062025.github.io/Portafolio/) [![LinkedIn](https://img.shields.io/badge/LinkedIn-lucas--villagra-0a66c2?style=flat-square&logo=linkedin)](https://www.linkedin.com/in/lucas-villagra-9b5097147/) [![Google Cybersecurity](https://img.shields.io/badge/Google-Cybersecurity%20Certificate-4285f4?style=flat-square&logo=google)](https://www.coursera.org/professional-certificates/google-cybersecurity)
标签:CVE查询, Python, 无后门, 逆向工具