SecByShresth/winsec-timeline
GitHub: SecByShresth/winsec-timeline
将 Windows 事件日志转化为攻击时间线和易读安全叙事的分析引擎。
Stars: 0 | Forks: 0
# 🛡️ WinSec 时间线
**Windows 安全分析引擎** — 将结构化的 Windows 事件日志转化为攻击时间线和清晰易读的安全叙事。
[](https://pypi.org/project/winsec-timeline/)
[](https://pypi.org/project/winsec-timeline/)
[](https://opensource.org/licenses/MIT)
## 🚀 功能特性
- **攻击时间线生成** — 按时间顺序排列的高信号事件序列
- **进程树可视化** — 清晰的父子进程关系映射,并突出显示可疑链条
- **行为模式检测** — 识别 Office 宏攻击、编码命令执行、横向移动和持久化机制
- **自动化判定与置信度评分** — 机器可读的判定结果及可解释的置信度百分比
- **多种输出格式** — 纯文本、JSON 和精美的 HTML 报告
- **CLI 与库模式** — 可作为独立工具使用,也可集成到您的 Python 流水线中
- **生产级** — 确定且一致的输出,适用于自动化安全流水线
## 📦 安装
```
pip install winsec-timeline
```
用于开发:
```
pip install winsec-timeline[dev]
```
## ⚡ 快速开始
### Python API
```
from winsec_timeline import SecurityAnalyzer
analyzer = SecurityAnalyzer()
data = {
"timeline": [
{
"timestamp": "2024-03-15T09:15:23Z",
"event": "Process Created",
"process": "WINWORD.EXE",
"parent": "explorer.exe",
"details": "User opened Word document"
},
{
"timestamp": "2024-03-15T09:15:45Z",
"event": "Process Created",
"process": "powershell.exe",
"parent": "WINWORD.EXE",
"details": "PowerShell spawned with encoded command"
}
],
"process_tree": {
"root": "explorer.exe",
"children": [
{
"name": "WINWORD.EXE",
"children": [
{"name": "powershell.exe", "children": []}
]
}
]
},
"flags": [
"office_spawned_powershell",
"encoded_command"
]
}
report = analyzer.analyze(data)
print(report.to_text())
```
### CLI
```
# 从 JSON 文件分析
winsec-timeline analyze input.json
# 输出为 JSON
winsec-timeline analyze input.json --format json
# 生成 HTML 报告
winsec-timeline analyze input.json --format html --output report.html
```
## 📊 输出结构
每次分析都会生成:
| 部分 | 描述 |
|---------|-------------|
| **Timeline (时间线)** | 按时间顺序排列的高信号事件 |
| **Process Tree (进程树)** | 父子进程执行链 |
| **Key Observations (关键观察)** | 行为模式与可疑指标 |
| **Summary (摘要)** | 3-5 行的执行摘要 |
| **Verdict (判定)** | `Likely Malicious` / `Suspicious` / `Benign` |
| **Confidence (置信度)** | 基于指标严重程度的 0-100% 评分 |
## 🔍 检测能力
| 模式 | 描述 |
|---------|-------------|
| Office → Shell | Office 应用程序生成 cmd/powershell |
| Encoded Commands | Base64/混淆的命令执行 |
| Network Activity | 执行后的外部网络连接 |
| Persistence | 计划任务、服务、注册表 |
| Process Injection | 可疑的父子进程链 |
| Rapid Staging | 短时间内的多阶段执行 |
## 📄 许可证
MIT License — 详见 [LICENSE](LICENSE)。
标签:Conpot, HTML报告生成, IP 地址批量处理, PE 加载器, Python安全工具, Windows事件日志, Windows安全, 事件溯源, 安全分析引擎, 安全叙事生成, 安全管道, 宏攻击检测, 库, 应急响应, 持久化检测, 攻击时间线, 数字取证, 文档结构分析, 横向移动检测, 网络信息收集, 置信度评分, 聊天机器人, 自动化脚本, 行为模式检测, 进程树可视化, 逆向工具