Leobatman/Forensic-Log-Analyzer-v3.0
GitHub: Leobatman/Forensic-Log-Analyzer-v3.0
一款零依赖的命令行日志取证分析工具,将原始日志转化为可行动的威胁情报,支持50+日志格式和10类攻击检测。
Stars: 0 | Forks: 0
```markdown
# 🔍 FORENSIC LOG ANALYZER v3.0
### 企业数字取证与事件响应平台
[](https://github.com)
[](https://www.gnu.org/software/bash/)
[](LICENSE)
[]()
## 📋 目录
- [概述](#visão-geral)
- [主要特性](#características-principais)
- [架构](#arquitetura)
- [安装](#instalação)
- [使用方法](#como-usar)
- [支持的格式](#formatos-suportados)
- [威胁检测](#detecção-de-ameaças)
- [Threat Intelligence](#threat-intelligence)
- [生成的报告](#relatórios-gerados)
- [使用示例](#exemplos-de-uso)
- [输出结构](#estrutura-de-saída)
- [性能指标](#métricas-de-performance)
- [路线图](#roadmap)
- [贡献](#contribuição)
- [许可证](#licença)
## 🎯 概述
**Forensic Log Analyzer v3.0** 是一款专业的日志取证分析工具,专为事件响应团队 (CSIRT) 和数字取证调查 (DFIR) 团队开发。该工具支持超过 50 种日志格式,检测 10 种攻击类型,并集成了多个 Threat Intelligence 来源,为网络安全调查提供了完整的解决方案。
### 为什么选择 Forensic Log Analyzer?
- ⚡ **企业级性能** - 每分钟处理高达 10GB 数据
- 🔧 **零依赖** - 仅需 Bash 和 Linux 标准工具
- 📦 **单文件** - 单个脚本,易于部署
- 🌐 **多格式** - 支持 50+ 种日志格式
- 🧠 **威胁情报** - 集成 20+ 个 TI 数据源
- 📊 **专业报告** - HTML, JSON, STIX 和封禁列表
## ✨ 主要特性
### 📁 通用解析
| 类别 | 格式 |
|-----------|----------|
| **Web Servers** | Apache, Nginx, IIS |
| **操作系统** | Syslog, Auth.log, Windows Events |
| **结构化** | JSON, CSV, CEF, W3C |
| **Cloud** | AWS CloudTrail, Azure Logs |
| **Containers** | Docker, Kubernetes |
| **数据库** | MySQL, PostgreSQL, Redis |
| **Email** | Postfix, Sendmail, Exim |
| **Proxy** | Squid, HAProxy |
### 🎯 威胁检测
| 类型 | 严重性 | MITRE ATT&CK |
|------|------------|--------------|
| SQL Injection | 🔴 CRITICAL | T1190 |
| RCE | 🔴 CRITICAL | T1059 |
| XSS | 🟠 HIGH | T1189 |
| LFI/RFI | 🟠 HIGH | T1190 |
| Path Traversal | 🟠 HIGH | T1006 |
| Brute Force | 🟠 HIGH | T1110 |
| WebShell | 🔴 CRITICAL | T1505 |
| C2 Communication | 🟠 HIGH | T1071 |
| Scanner Activity | 🟡 MEDIUM | T1595 |
| Data Exfiltration | 🔴 CRITICAL | TA0010 |
### 🧠 THREAT INTELLIGENCE
- **VirusTotal** - IP 声誉分析
- **AbuseIPDB** - 滥用评分和置信度
- **AlienVault OTX** - Pulses 和指标
- **GreyNoise** - 流量分类
- **Shodan** - 端口和漏洞
- **GeoIP** - 实时地理定位
- **WHOIS** - 注册信息
## 🏗️ 架构
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ FORENSIC LOG ANALYZER v3.0 │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ INPUT LAYER │ -> │ PARSER ENGINE │ -> │ DETECTION LAYER │ │
│ │ │ │ │ │ │ │
│ │ • Apache │ │ • Auto-detect │ │ • Signatures │ │
│ │ • Nginx │ │ • Multi-format │ │ • ML Anomalies │ │
│ │ • JSON/CSV │ │ • Streaming │ │ • MITRE Mapping │ │
│ │ • Syslog │ │ • Parallel │ │ • IOC Extract │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ THREAT INTEL │ │ OUTPUT LAYER │ │ REPORT ENGINE │ │
│ │ │ │ │ │ │ │
│ │ • VirusTotal │ │ • HTML Report │ │ • Chain of Cust │ │
│ │ • AbuseIPDB │ │ • JSON Export │ │ • STIX Export │ │
│ │ • AlienVault │ │ • Blocklist │ │ • MITRE Matrix │ │
│ │ • GeoIP/WHOIS │ │ • IOCs Archive │ │ • Executive Sum │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
```
## 🚀 安装
### 最低要求
- **操作系统**: Linux / Unix / macOS
- **Bash**: 版本 4.0 或更高
- **工具**: grep, awk, sed, sort, uniq, wc, cut, head, tail, date
### 快速安装
```
# 下载脚本
curl -O https://github.com/Leobatman/Forensic-Log-Analyzer-v3.0/forensic_analyzer.sh
# 或使用 wget
wget https://github.com/Leobatman/Forensic-Log-Analyzer-v3.0/forensic_analyzer.sh
# 赋予执行权限
chmod +x forensic_analyzer.sh
# 验证安装
./forensic_analyzer.sh --version
```
### 依赖检查
```
# 自动检查依赖
./forensic_analyzer.sh --check-deps
# 预期输出:
# ✓ 找到 grep
# ✓ 找到 awk
# ✓ 找到 sed
# ✓ 找到 sort
# ✓ 找到 uniq
# ✓ 找到 wc
# ✓ 找到 cut
# ✓ 找到 head
# ✓ 找到 tail
# ✓ 找到 date
```
## 📖 使用方法
### 基本语法
```
./forensic_analyzer.sh
```
### 使用示例
```
# Apache 日志分析
./forensic_analyzer.sh /var/log/apache2/access.log
# Nginx 日志分析
./forensic_analyzer.sh /var/log/nginx/access.log
# 认证日志分析 (SSH)
./forensic_analyzer.sh /var/log/auth.log
# JSON 日志分析
./forensic_analyzer.sh /var/log/application.json
# 压缩日志分析
./forensic_analyzer.sh /var/log/archive.log.gz
# 分析包含 IP 的任意文件
./forensic_analyzer.sh qualquer_arquivo.log
```
### 高级选项
```
# 指定输出目录
./forensic_analyzer.sh access.log --output /tmp/analise
# 禁用 Threat Intelligence (更快)
./forensic_analyzer.sh access.log --no-ti
# 静默模式 (仅报告)
./forensic_analyzer.sh access.log --quiet
# 仅导出 IOC
./forensic_analyzer.sh access.log --export-iocs-only
```
## 📂 支持的格式
### Web Servers
```
✓ Apache Common Log Format (CLF)
✓ Apache Combined Log Format
✓ Nginx Access Log
✓ Nginx Error Log
✓ IIS W3C Extended Log
```
### 操作系统
```
✓ Syslog (RFC 3164 / 5424)
✓ Auth.log (SSH, sudo, login)
✓ Windows Event Log (EVTX exportado)
✓ Journald (systemd)
```
### 结构化数据
```
✓ JSON Lines (.jsonl)
✓ CSV (comma-separated)
✓ CEF (Common Event Format)
✓ LEEF (Log Event Extended Format)
✓ W3C Extended Log Format
```
### Cloud & Containers
```
✓ AWS CloudTrail
✓ Azure Monitor Logs
✓ Google Cloud Logging
✓ Docker Container Logs
✓ Kubernetes Pod Logs
```
### 应用程序
```
✓ MySQL / MariaDB Query Log
✓ PostgreSQL Log
✓ Redis Log
✓ MongoDB Log
✓ RabbitMQ Log
✓ Kafka Log
```
### Email & Proxy
```
✓ Postfix Mail Log
✓ Sendmail Log
✓ Exim Log
✓ Squid Proxy Log
✓ HAProxy Log
```
### Firewall & 安全
```
✓ iptables/netfilter logs
✓ pfSense firewall logs
✓ Cisco ASA logs
✓ Fortinet FortiGate logs
✓ Snort/Suricata alerts
```
## 🔥 威胁检测
### SQL Injection
通过以下模式检测 SQL 注入尝试:
- `UNION SELECT`, `INSERT INTO`, `DELETE FROM`
- `DROP TABLE`, `EXEC xp_`, `WAITFOR DELAY`
- `information_schema`, `1=1`, `' OR '1'='1`
### XSS (Cross-Site Scripting)
检测恶意脚本注入尝试:
- `