infat0x/l0g

GitHub: infat0x/l0g

一款集日志解析、流量统计与威胁情报关联于一体的 CTI 桌面分析工具,帮助安全分析人员从 Web 访问日志中快速定位可疑 IP 并生成分析报告。

Stars: 0 | Forks: 0

# Log Analysis CTI [![GitHub](https://img.shields.io/badge/GitHub-infat0x%2Fl0g-blue?style=flat-square&logo=github)](https://github.com/infat0x/l0g) [![Python](https://img.shields.io/badge/Python-3.8+-green?style=flat-square&logo=python)](https://python.org) [![License](https://img.shields.io/badge/License-MIT-yellow?style=flat-square)](LICENSE) **测试用户凭据:** ``` user: test password: salam123 ``` ## 使用视频 [![使用演示](https://img.youtube.com/vi/Wd4Sx5E9gqE/0.jpg)](https://youtu.be/Wd4Sx5E9gqE) ## 功能 - **日志解析**:Apache/Nginx combined、JSON Lines/Array、CSV/TSV - **流量分析**:按 IP 统计计数、HTTP 方法/状态、热门路径 - **CTI 扩展**:集成 VirusTotal 与 AbuseIPDB - **多用户支持**:支持每个用户独立的 API token 和设置 - **交互式 UI**:点击任意 IP 获取详细的威胁情报 - **历史记录**:查看历史查询并复用缓存结果 - **报告导出**:支持导出 Markdown/HTML/TXT/PDF 格式的报告 - **安全可靠**:API 密钥按用户存储在数据库中 - **现代 GUI**:暗色主题,界面直观 ## 2) 项目结构 (已更新) ``` C:\Users\Student\Desktop\log_analysis_cti ├── .env # user tokens (DO NOT SHARE) ├── .venv/ # virtual environment (optional) ├── README.md # this file ├── src/ # source code (package) │ └── log_analysis_cti/ │ ├── __init__.py │ ├── gui_app.py # GUI entry (python -m log_analysis_cti.gui_app) │ ├── main.py # CLI entry (python -m log_analysis_cti.main) │ ├── ai_client.py │ ├── behavior_analyzer.py │ ├── config.py │ ├── file_validator.py │ ├── log_parser.py │ ├── report_generator.py # writes to out/reports by default │ ├── assets/ │ │ └── l0g_dark_green.ico │ └── cti_apis/ │ ├── __init__.py │ ├── abuseipdb.py │ ├── virustotal.py │ └── cti_manager.py ├── scripts/ │ └── packaging/ │ ├── build_exe.py # builds using log_analysis_cti.spec │ ├── log_analysis_cti.spec # PyInstaller spec (points to src/.../gui_app.py) │ ├── setup.py # helper setup script │ └── requirements.txt # dependencies └── out/ ├── build/ # PyInstaller build artifacts ├── dist/ # LogAnalysisCTI.exe output └── reports/ # generated reports (runtime) ``` ## 安装与快速开始 ### 选项 A — 下载 EXE (推荐) 1. 前往 [Releases](https://github.com/infat0x/l0g/releases) 2. 从最新版本中下载 `LogAnalysisCTI.exe` 3. 运行程序 4. 使用测试凭据登录 (如下) 5. 在设置中配置 API 密钥 ### 选项 B — 从源码运行 ``` # 克隆 repository git clone https://github.com/infat0x/l0g.git cd l0g # 安装 dependencies pip install -r scripts/packaging/requirements.txt # 运行 GUI python -m src.log_analysis_cti.gui_app # 或运行 CLI python -m src.log_analysis_cti.main ``` ## 3) 快速开始 (Windows) ### 选项 A — 运行打包好的 EXE 1. 双击: C:\Users\Student\Desktop\log_analysis_cti\out\dist\LogAnalysisCTI.exe 2. 使用测试账号登录 (如上)。 3. 前往 **Settings → API Keys** 并粘贴你的 token。 4. **Open Log** → 选择文件;点击 **Analyze** → 点击任意 IP 查看详情。 5. 使用 **History** 查看历史查询;按需 **Export** 报告。 ### 选项 B — 从源码运行 (venv) ``` cd C:\Users\Student\Desktop\log_analysis_cti . .venv\Scripts\Activate.ps1 pip install -U pip pip install -r .\scripts\packaging\requirements.txt # GUI python -m log_analysis_cti.gui_app # 或 CLI python -m log_analysis_cti.main ``` ## API 配置 ### 方法 1:应用内设置 (推荐) 1. 运行应用程序 2. 使用测试凭据登录 3. 前往 **Settings → API Keys** 4. 输入你的 API 密钥: - **VirusTotal API Key**:从 [virustotal.com](https://www.virustotal.com/gui/my-apikey) 获取 - **AbuseIPDB API Key**:从 [abuseipdb.com](https://www.abuseipdb.com/account/api) 获取 - **AI API Key**:选填,用于 AI 分析功能 ### 方法 2:环境文件 在项目根目录创建 `.env` 文件: ``` VIRUSTOTAL_API_KEY=your_virustotal_key_here ABUSEIPDB_API_KEY=your_abuseipdb_key_here AI_API_URL=https://api.mistral.ai/v1/chat/completions AI_API_KEY=your_ai_api_key_here ``` ## 5) 应用使用 (流程) 1. 使用提供的测试用户 **登录**。 2. **Open Log** → 选择格式 (自动检测): - Combined (Apache/Nginx) - JSONL/JSON - CSV/TSV 3. **Analyze** → 查看按 IP 的统计信息 + 高亮可疑的 User-Agent。 4. **点击 IP** → 查看 VirusTotal + AbuseIPDB 详情。 5. **History** → 复用缓存结果。 6. **Export** 报告 (MD/HTML/TXT/PDF)。 ## 6) 注意事项 - EXE 是最简单的测试方式 (无需配置 Python 环境)。 - 必须设置 token 才能使用数据扩展功能。 - 为安全起见,`.env` 已被版本控制忽略。 - 报告默认保存在 `out/reports/` 目录下。 ## 8) 构建 EXE (可选) ``` cd C:\Users\Student\Desktop\log_analysis_cti python .\scripts\packaging\build_exe.py # 输出: # - out\dist\LogAnalysisCTI.exe # - out\LogAnalysisCTI_Standalone\ (准备分享) ``` ## 许可证 本项目基于 MIT 许可证授权 - 详情请参阅 [LICENSE](LICENSE) 文件。 ## 安全说明 - 妥善保管 `.env` 文件,不要公开 - 不要在截图中分享 API token - 遵守 VirusTotal/AbuseIPDB 的使用政策 - 请私下报告安全问题
标签:AbuseIPDB, AI安全, Apache日志, API集成, Ask搜索, Chat Copilot, DInvoke, ESC4, GUI应用, HTTP/HTTPS抓包, IP 地址批量处理, IP查询, Markdown, Nginx日志, OSINT, PDF导出, Python, VirusTotal, Web安全, 可观测性, 多用户系统, 密码管理, 态势感知, 数字化取证, 无后门, 无线安全, 日志解析, 漏洞挖掘, 网络威胁情报, 网络安全, 蓝队分析, 证书伪造, 逆向工具, 隐私保护, 黑灰产对抗