Vigneshwaran-018/cybersentinels-lolbinsdetection
GitHub: Vigneshwaran-018/cybersentinels-lolbinsdetection
基于 Python 的 Windows 端点实时监控系统,专注于检测和阻断攻击者对合法系统二进制文件的滥用行为。
Stars: 1 | Forks: 0
# Cyber Sentinels LoLBINS:高级端点防御系统
**Cyber Sentinels 检测系统** - 高级端点防御与 Living-Off-The-Land (LOLBins) 检测
这是一个综合安全解决方案,旨在检测和防止现代网络攻击中滥用的合法 Windows 二进制文件。该系统实时监控进程执行,并通过模式检测和风险评分识别可疑活动。
## 🎯 概述
LOLBINS-X 是一个为 KTR Hackathon 构建的端点防御系统,专注于检测攻击者通常利用的合法 Windows 二进制文件 的滥用行为。该系统具有以下特点:
- **实时进程监控**:持续监控进程执行和父子关系
- **LOLBins 检测**:识别合法 Windows 工具的可疑使用模式
- **风险评分引擎**:根据进程行为和上下文计算威胁等级
- **交互式仪表板**:提供可视化监控和实时威胁警报
- **模拟模式**:使用合成攻击场景测试系统
- **取证时间线**:生成用于事件调查的取证记录
## 📁 项目结构
```
lolbins/
├── main.py # Entry point - starts the engine
├── requirements.txt # Python dependencies
├── forensics_timeline.json # Forensic event log
├── config/ # Configuration files
│ ├── settings.json # Main settings & LOLBins list
│ ├── trusted_parents.json # Trusted parent processes
│ └── loader.py # Configuration loader
├── core/ # Core engine modules
│ ├── engine.py # Orchestrator - coordinates all components
│ ├── defense/ # Defense mechanisms
│ │ └── defender.py # Blocking & response actions
│ ├── detection/ # Detection rules
│ │ └── lolbins_rules.py # LOLBins detection patterns
│ ├── monitor/ # Process monitoring
│ │ ├── process_watcher.py # Main process monitoring loop
│ │ ├── command_parser.py # Command-line parsing
│ │ ├── parent_tracker.py # Process hierarchy tracking
│ │ ├── dedup.py # Event deduplication
│ │ └── __init__.py
│ └── scoring/ # Risk scoring engine
│ ├── risk_engine.py # Risk calculation & scoring
│ └── __init__.py
├── gui/ # User interface
│ └── dashboard.py # Tkinter dashboard
├── forensics/ # Forensic analysis
│ └── timeline.py # Forensic timeline generation
├── knowledge/ # Knowledge base
│ └── lolbins_db.json # LOLBins database
├── simulation/ # Testing & simulation
│ ├── simulator.py # Attack simulation engine
│ ├── datasets.json # Simulation datasets
│ ├── benign/ # Benign process samples
│ └── lolbin_attacks/ # Attack scenario samples
└── tests/ # Test suite
```
## 🚀 快速开始
### 前置条件
- **Python 3.7+**
- **Windows OS**(用于进程监控)
- **psutil** 库
### 安装
1. **克隆/导航到项目目录:**
cd "c:\Users\Vignesh\Desktop\ktr hackathon\lolbins"
2. **安装依赖项:**
pip install -r requirements.txt
3. **配置设置(可选):**
编辑 `config/settings.json` 以自定义监控的 LOLBins 和阈值。
### 运行系统
```
python main.py
```
这将:
1. 启动进程监控引擎
2. 加载攻击模拟场景
3. 启动交互式仪表板 GUI
4. 开始实时威胁检测和日志记录
## ⚙️ 配置
### 主要设置 (`config/settings.json`)
```
{
"defense_mode": "block",
"risk_block_threshold": 60,
"lolbins": [
"powershell.exe",
"cmd.exe",
"certutil.exe",
"rundll32.exe",
"wmic.exe"
]
}
```
- **defense_mode**:`block`(主动防御)或 `monitor`(仅检测)
- **risk_block_threshold**:触发阻止的最低风险评分 (0-100)
- **lolbins**:受监控的合法二进制文件列表
### 受信任的父进程 (`config/trusted_parents.json`)
定义不应触发警报的父进程,即使在生成 LOLBins 时也是如此。
## 🔍 核心组件
### 1. **进程监视器** (`core/monitor/process_watcher.py`)
- 持续监控 Windows 进程
- 捕获命令行参数和环境
- 跟踪父子进程关系
- 对事件进行去重以减少噪音
### 2. **LOLBins 检测** (`core/detection/lolbins_rules.py`)
检测模式包括:
- 带有编码命令的 PowerShell (`-enc`, `-encodedcommand`)
- CMD 命令执行 (`/c`)
- Certutil 滥用
- 以及更多...
### 3. **风险评分引擎** (`core/scoring/risk_engine.py`)
基于以下因素计算威胁评分:
- 进程特征
- 命令行指标
- 父进程上下文
- 已知攻击模式
### 4. **防御模块** (`core/defense/defender.py`)
- 阻止高风险进程
- 记录安全事件
- 生成警报
### 5. **仪表板 GUI** (`gui/dashboard.py`)
- 实时事件监控
- 进程树可视化
- 风险评分显示
- 系统状态和统计信息
### 6. **取证** (`forensics/timeline.py`)
- 创建用于事件调查的 `forensics_timeline.json`
- 记录所有检测到的事件及其时间戳和上下文
## 📊 风险评分
风险引擎根据以下因素分配评分 (0-100):
| 因素 | 评分影响 |
|--------|--------------|
| 已知 LOLBins 可执行文件 | +20-40 |
| 可疑命令参数 | +15-30 |
| 可疑父进程 | +10-25 |
| 编码/混淆命令 | +25-40 |
| 网络通信尝试 | +10-20 |
**阻止阈值**:评分超过 60 分的进程将被阻止(可配置)。
## 🎮 模拟模式
使用合成攻击场景测试系统:
```
# 从 Python 运行
from simulation.simulator import run_simulation
run_simulation()
```
模拟包括:
- 良性进程样本
- LOLBins 攻击场景
- 模式验证
## 📈 取证分析
所有检测到的事件都会记录到 `forensics_timeline.json` 以供后续分析:
```
{
"timestamp": "2026-01-30T10:30:45Z",
"process": "powershell.exe",
"pid": 1234,
"command": "powershell.exe -enc ",
"risk_score": 85,
"threat_type": "Encoded Powershell",
"action": "BLOCKED"
}
```
## 🛠️ 开发
### 添加新的检测规则
编辑 `core/detection/lolbins_rules.py`:
```
def detect_lolbins(event):
suspicious = []
name = event["name"].lower()
cmd = " ".join(event["cmd"]).lower()
# Add your custom detection logic
if name == "your_lolbin.exe" and "suspicious_flag" in cmd:
suspicious.append("Your custom threat description")
return suspicious
```
### 调整阈值
修改 `core/scoring/risk_engine.py` 中的评分权重,以微调检测灵敏度。
## 📝 依赖项
- **psutil**:跨平台进程监控库
有关完整列表,请参阅 `requirements.txt`。
## 🔐 安全说明
- 该系统专为 **Windows 端点**设计
- 需要**管理员/提升的权限**才能实现完整功能
- 在 `block` 模式下运行将主动阻止进程执行
- 请务必先在受控环境中进行测试
## 📄 许可证与致谢
本项目是为 KTR Hackathon 开发的,专注于高级端点防御技术和 LOLBins 检测。
## 🤝 支持与贡献
如有问题、疑问或改进建议:
1. 查看代码注释中的现有文档
2. 查看项目结构以找到相关模块
3. 先在模拟模式下测试更改
## 🎯 关键功能摘要
✅ 实时进程监控
✅ Living-Off-The-Land 二进制文件检测
✅ 基于风险的威胁评分
✅ 主动防御与阻止
✅ 交互式仪表板 UI
✅ 攻击模拟与测试
✅ 取证时间线生成
✅ 高度可配置
**最后更新**:2026年1月30日
**系统**:Cyber Sentinels 检测系统 v1.0
标签:Conpot, EDR, Homebrew安装, LOLBins, Python, Qt, Windows安全, 威胁情报, 安全仪表盘, 实时检测, 开发者工具, 恶意软件防护, 攻击模拟, 数字取证, 无后门, 知识库安全, 端点防御, 网络安全, 脆弱性评估, 自动化脚本, 落地生根二进制文件, 逆向工具, 防御规避检测, 隐私保护, 风险评分, 驱动签名利用