An intelligent system that ingests security logs, detects anomalous patterns, and leverages Google Generative AI to explain incidents and suggest mitigation strategies.
β
Real-time Log Analysis - Upload CSV/TXT security logs instantly
β
AI Threat Detection - Identifies 4+ threat categories using pattern matching
β
Automated Risk Scoring - Real-time severity assessment (High/Medium/Low)
β
AI-Generated Reports - Google Gemini creates comprehensive incident reports
β
Interactive Security Bot - Ask questions, get expert security advice
β
Beautiful Visualizations - Interactive threat breakdown charts with Plotly
β
JSON Export - Download detailed analysis reports for compliance
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β STREAMLIT FRONTEND (Port 8501) β
β β File Upload & Visualization β
β β Real-time Threat Dashboard β
β β AI-Powered Security Bot Chat β
ββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β HTTP/REST API
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β FLASK BACKEND (Port 5000) β
β β Anomaly Detection Engine β
β β Pattern-Based Threat Scoring β
β β AI Report Generation β
β β Security Q&A Processing β
ββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β GOOGLE GENERATIVE AI (Gemini 2.0) β
β β Incident Report Writing β
β β Expert Security Guidance β
β β Threat Analysis & Explanations β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
- Python 3.12+
- Google Generative AI API Key (free tier)
- 2 minutes setup
# Clone repository
git clone https://github.com/deekshithaby/ThreatIntelAI.git
cd ThreatIntelAI
# Install dependencies
pip install -r requirements.txt
# Create .env file with your Google API key
echo 'GOOGLE_API_KEY=your_key_here' > .envTerminal 1 - Start Backend:
python3 backend.pyExpected:
π Flask Backend Starting...
π http://localhost:5000
β
AI Chatbot ENABLED (Google Gemini)
Terminal 2 - Start Frontend:
streamlit run app.pyExpected:
Local URL: http://localhost:8501
Open Browser:
http://localhost:8501
User uploads security logs (CSV/TXT) containing system events, authentication attempts, network activity.
Backend analyzes logs for threats:
- Brute Force Attacks - Multiple failed login attempts
- Privilege Escalation - Unauthorized sudo/admin access
- Data Exfiltration - Suspicious data transfers
- System Anomalies - Crashes, errors, timeouts
Threats are quantified:
- π΄ High Risk (>10 anomalies)
- π‘ Medium Risk (3-10 anomalies)
- π’ Low Risk (<3 anomalies)
Google Gemini generates:
- Executive summary
- Root cause analysis
- Immediate action items
- Long-term remediation plans
- Prevention strategies
Ask questions like:
- "What does this threat mean?"
- "How do I fix this?"
- "What are my top 3 risks?"
AI responds with expert security guidance.
| Threat | Detection Method | Severity |
|---|---|---|
| Brute Force Attack | Failed login patterns | π΄ Critical |
| Privilege Escalation | Sudo/admin access logs | π΄ Critical |
| Data Exfiltration | Large transfer detection | π‘ High |
| System Anomaly | Error/crash patterns | π‘ Medium |
Detects threats in logs.
{
"logs": "log file content"
}Response:
{
"threat_scores": {...},
"total_anomalies": 14,
"top_threat": "Brute Force Attack",
"risk_level": "π΄ High"
}Generates AI incident report.
Answers security questions about threats.
| Component | Technology |
|---|---|
| Frontend | Streamlit |
| Backend | Flask (REST API) |
| Detection | Regex pattern matching |
| AI/LLM | Google Generative AI (Gemini) |
| Visualization | Plotly |
| Data Processing | Pandas, NumPy |
- Built AI-driven security log analysis system to detect and classify anomalous patterns across multiple threat categories
- Designed Flask REST API backend with pattern-based anomaly detection achieving real-time threat scoring
- Integrated Google Generative AI (Gemini) for automated incident report generation and expert security guidance
- Developed Streamlit frontend with interactive visualizations and AI-powered security chatbot
- Implemented full-stack architecture connecting data ingestion β analysis β visualization β AI explanation
- Real-time log streaming from SIEM tools
- Machine learning-based anomaly detection (Isolation Forest, Autoencoders)
- Database integration for log persistence
- Multi-user dashboard with role-based access control
- Automated alert notifications (email, Slack)
- Integration with security tools (Splunk, Datadog, ELK)
- Docker containerization & Kubernetes deployment
- Advanced threat intelligence correlation
- MITRE ATT&CK framework mapping
MIT License - Free for educational and commercial use
Created as an AI security automation project.
Status: Active Development
Last Updated: January 6, 2025