hamayl-ali/Automated-PowerShell-Incident-Response-System

GitHub: hamayl-ali/Automated-PowerShell-Incident-Response-System

一套零依赖的轻量级 SOAR 系统,用于自动检测、评分和响应基于 PowerShell 的恶意攻击活动。

Stars: 0 | Forks: 0

# 🛡️ 自动化 PowerShell 事件响应系统 ![Python](https://img.shields.io/badge/Python-3.x-blue.svg) ![Platform](https://img.shields.io/badge/Platform-Cross--Platform-lightgrey.svg) ![License](https://img.shields.io/badge/License-MIT-green.svg) ## 📌 概述 传统的安全运营中心(SOC)虽然能够检测到可疑的 PowerShell 活动,但仍依赖分析师进行手动调查和响应。 本项目通过结合以下功能来填补这一空白: - 🔍 基于特征的检测 - ⚡ 自动化响应 - 📊 审计日志 - 🛡️ 可配置的安全控制 最终实现了一个轻量级的 **SOAR 风格(安全编排、自动化与响应)** pipeline,能够自动检测、评分并响应基于 PowerShell 的攻击。 # ✨ 功能特性 - 检测恶意的 PowerShell 活动 - 映射 MITRE ATT&CK 的检测规则 - 自动终止进程 - 文件隔离 - 模拟网络 IOC 封禁 - 可配置的严重性阈值 - 仅检测模式 - 自动响应模式 - 详细的审计日志 - 事件报告生成 - 可选的 Slack webhook 集成 - 零外部 Python 依赖 # 🏗️ 架构 ``` PowerShell Events │ ▼ Detection Engine │ ▼ Severity Scoring │ ▼ Decision Engine │ ├──────── Detect Only │ │ │ ▼ │ Alert + Log │ └──────── Auto Respond │ ┌───────────────┼────────────────┐ ▼ ▼ ▼ Terminate Quarantine File Block IOC │ │ │ └───────────────┼────────────────┘ ▼ Audit Logs & Reports ``` # 🎯 检测规则 | 规则 | MITRE ATT&CK | 严重性 | |------|--------------|----------| | Base64 编码命令 | T1027 | 高 | | 下载 Cradle | T1105 | 高 | | 脚本混淆 | T1027.005 | 中 | | AMSI 绕过 | T1562.001 | 严重 | | 凭据转储 | T1003 | 严重 | | 持久化 | T1053 / T1547 | 高 | | 防御规避 | T1562 | 中 | # 📂 项目结构 ``` . ├── detection_engine.py ├── response_engine.py ├── incident_response.py ├── sample_data/ │ ├── powershell_events.json │ └── malware_samples/ ├── quarantine/ ├── logs/ ``` # 🚀 快速开始 ## 克隆仓库 ``` git clone https://github.com/hamayl-ali/Automated-PowerShell-Incident-Response-System.git cd Automated-PowerShell-Incident-Response-System ``` ## 仅检测模式 ``` python3 incident_response.py \ --input sample_data/powershell_events.json \ --mode detect_only ``` ## 自动响应模式 ``` python3 incident_response.py \ --input sample_data/powershell_events.json \ --mode auto_respond ``` ## 使用配置文件 ``` python3 incident_response.py \ --input sample_data/powershell_events.json \ --config config.json ``` # ⚙️ 配置 ``` { "mode": "auto_respond", "min_severity_to_act": "high", "quarantine_dir": "./quarantine", "blocklist_path": "./logs/blocklist.txt", "webhook_url": null } ``` # 📊 输出 系统会自动生成: ``` logs/ ├── audit_log_.json ├── incident_report_.csv └── blocklist.txt ``` # 🛡️ 安全设计 响应引擎遵循 **安全优先(safe-by-default)** 的理念。 ✔ 仅检测模式永远不会修改系统。 ✔ 自动响应仅在以下情况执行: - 严重性超过配置的阈值 - 启用了自动响应模式 这在实现快速遏制的同时,最大限度地减少了误报。 # 🧰 技术栈 - Python 3 - 正则表达式 - JSON - CSV - Base64 - OS 与 Signal 模块 - shutil - urllib - argparse 无需任何第三方库。 # 📈 未来改进 - Windows Event Log (4104) 接入 - 实时 Sysmon 集成 - Sigma 规则支持 - YARA 集成 - 防火墙自动化 - Slack 与 Microsoft Teams 格式化 - Flask/FastAPI Dashboard - SIEM 集成(Splunk、Wazuh、Elastic) # 📸 示例工作流 ``` PowerShell Execution ↓ Detection Rules Trigger ↓ Severity Calculated ↓ Decision Engine ↓ Auto Containment ↓ Audit Logging ↓ Incident Report ``` # 📜 许可证 本项目基于 MIT License 发布。 # 👨‍💻 作者 **Hamayl** 计算机科学学士 | 网络安全爱好者 研究兴趣: - 事件响应 - 威胁检测 - SOAR - 恶意软件分析 - 安全领域的机器学习
标签:Homebrew安装, OpenCanary, PB级数据处理, PowerShell监控, Python, SOAR, 安全运维, 安全运营中心, 无后门, 网络映射, 自动化响应