ankitvishwakarmavishwas/smart-log-analyzer
GitHub: ankitvishwakarmavishwas/smart-log-analyzer
基于Python的轻量级网络安全日志分析工具,通过正则匹配检测暴力破解攻击和黑名单IP访问,并自动生成威胁报告。
Stars: 0 | Forks: 0
# 🔐 智能 Log Analyzer 与威胁检测系统



**关键词:** Cybersecurity,SOC,Log Analysis,威胁检测,Python,SIEM 基础
## 📌 概述
一个基于 Python 的 Cybersecurity 工具,用于分析系统日志以检测可疑活动,例如暴力破解攻击和黑名单 IP 访问。
## 🚀 功能
- 检测暴力破解登录尝试
- 识别黑名单 IP 地址
- 生成自动化安全报告
## 🛠️ 技术栈
- Python
- Regex
- File Handling
## 📂 项目结构
```
smart-log-analyzer/
│── analyzer.py # Main script for log analysis and threat detection
│── logs.txt # Sample log file for testing
│── blacklist.txt # List of malicious/blocked IPs
│── README.md # Project documentation
│── requirements.txt # Project dependencies
│── .gitignore # Files to ignore in version control
│
├── output/
│ └── report.txt # Generated alert report
│
├── screenshots/
│ ├── terminal-output.png # Execution output screenshot
│ └── detected-threats.png # Threat detection report screenshot
```
## ▶️ 如何运行
```
git clone https://github.com/ankitvishwakarmavishwas/smart-log-analyzer.git
cd smart-log-analyzer
pip install -r requirements.txt
python analyzer.py
```
### 🔹 威胁检测输出


## 🏗️ 架构
系统遵循一个简单的检测 pipeline:
1. Log Ingestion → 从文件读取原始日志
2. Parsing Engine → 使用 regex 提取 IP 和状态
3. Detection Engine → 应用规则:
- 暴力破解检测(≥3 次失败尝试)
- 黑名单匹配
4. Alert Generation → 将警报写入 report.txt
## 🧠 检测逻辑
- 暴力破解检测:
使用 dictionary counter 跟踪每个 IP 的失败登录尝试。
标记超过阈值(≥3 次尝试)的 IP
- 黑名单检测:
将传入 IP 与预定义的恶意 IP 列表进行匹配
## 📄 示例日志格式
2026-05-01 LOGIN FAILED user=admin ip=192.168.1.10
## 字段:
- Timestamp(时间戳)
- Status(状态)(FAILED/SUCCESS)
- Username(用户名)
- IP Address(IP 地址)
## 🌍 真实世界用例
模拟 SOC (Security Operations Center) 日志监控,以检测暴力破解攻击和可疑 IP 行为。
## 🔮 未来增强
- 使用 file watcher 进行实时日志监控
- 与 SIEM 工具(Splunk)集成
- 恶意 IP 的 GeoIP 跟踪
- 使用 Streamlit 构建 Web dashboard
## 📦 版本
当前发布版本:v1.0
## 📌 作者
Ankit Vishwakarma
https://github.com/ankitvishwakarmavishwas
https://www.linkedin.com/in/ankitvishwakarmavishwas/
标签:AMSI绕过, CCTV/网络接口发现, IP 地址批量处理, Python, 免杀技术, 威胁检测, 安全运营中心, 异常行为检测, 文件处理, 无后门, 日志解析, 暴力破解检测, 红队行动, 网络安全, 网络映射, 自动化安全报告, 证书伪造, 逆向工具, 隐私保护, 黑名单IP