📌 Project Overview
⚠️ For full scripts and explanation, you can visit my github: https://github.com/ramveil/Automated-Threat-Detection-and-Triage-using-a-Wazuh-Discord-Integration-and-Large-Language-Models
This project implements an automated Security Operations Center (SOC) pipeline that detects, analyzes, and triages security events in real time using:
- Wazuh SIEM
- Discord (ChatOps interface)
- Google Gemini (LLM-based threat analysis)
The system transforms raw logs into actionable intelligence and delivers alerts directly to analysts via Discord.
🧠 Architecture
The system follows an event-driven pipeline:
- Wazuh Agent collects logs from endpoints
- Wazuh Manager analyzes events using rules
- High-severity alerts trigger a custom integration script
- Alert data is enriched using a Large Language Model
- Structured alerts are sent to Discord
- Analysts interact with alerts via buttons (WHOIS / FULL LOG)
📌 As described in the system design, alerts are processed, enriched, and transmitted in real-time using an asynchronous pipeline
⚙️ Infrastructure
| Role | System | Description |
|---|---|---|
| Attacker | Kali Linux | Simulated attacks |
| Target | Ubuntu | Victim machine |
| SIEM Server | Ubuntu | Wazuh Manager |
| ChatOps | Discord Bot | Alert interface |
| AI Engine | Gemini API | Threat summarization |
🚀 Features
- 🔍 Real-time threat detection (Wazuh)
- 🤖 AI-powered alert summarization
- 💬 Discord-based SOC dashboard
- 🕵️ WHOIS lookup integration
- 📜 Raw log retrieval via chat interaction
- ⚡ Asynchronous alert delivery (instant notification + delayed AI insight)
🔧 Setup
1. Install dependencies
pip install -r requirements.txt2. Configure environment
Create .env:
GEMINI_API_KEY=your_keyDISCORD_BOT_TOKEN=your_tokenCHANNEL_ID=your_channel_id3. Deploy Wazuh Integration
Copy script to:
/var/ossec/integrations/custom-discord.py4. Run Discord Bot
python bot/discord_listener.py🔄 Detection & Alert Flow
🔐 SSH Brute Force Attack
- Attacker performs SSH login attempts
- Wazuh detects authentication failures
- Alert reaches threshold (Level ≥ 5)
- Integration script triggers
⚡ Alert Processing Pipeline
- Alert sent instantly to Discord (“Processing…”)
- LLM analyzes log data
- Message updated with AI-generated insight
📌 This design ensures no delay in alert visibility while AI processes in background
🧠 Interactive Triage
- WHOIS Button → Fetch IP intelligence
- FULL LOG Button → Retrieve raw syslog
💥 Example Attack Scenario
- Brute-force attack escalates to successful login
- Wazuh triggers Level 12 critical alert
- Discord displays alert with AI summary
- Analyst retrieves raw logs and confirms compromise
📌 As shown in testing, successful credential compromise is detected and escalated with contextual intelligence
🛡️ Mitigation
- Block attacker IP using Wazuh active response:
sudo /var/ossec/bin/agent_control -b <attacker_ip> -f firewall-drop0