Skip to content

lvb05/ThreatLens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ThreatLens β€” AI-Powered Security Operations Platform

A production-grade SOC platform for UPI fraud detection, SIEM integration, and AI-assisted incident response.

Live Demo Backend API GitHub


Dashboard

πŸš€ Overview

ThreatLens is a production-grade AI-powered Security Operations Center (SOC) platform built for detecting UPI fraud in real time.

It combines:

  • Machine Learning fraud detection
  • SIEM-based detection engineering
  • MITRE ATT&CK mapped alerting
  • AI SOC analyst for incident triage
  • Real-time dashboard monitoring
  • Purple team attack simulation
  • Automated PDF reporting
  • Slack critical alerting

This project simulates how a real SOC handles financial fraud incidents from detection to response.


🌐 Live Deployment

Frontend: https://threat-lens-weld.vercel.app

Backend API: https://threatlens-em87.onrender.com/docs


πŸŽ₯ Demo

Watch Demo

Click to watch the 3-min walkthrough


Key Features

πŸ” Fraud Detection Engine

  • XGBoost-based fraud detection model
  • Real-time UPI transaction monitoring
  • Multiple fraud scenario detection:
    • Card Testing
    • Velocity Abuse
    • Large Fraud
    • Account Takeover
    • Bot Attack

πŸ›‘οΈ SIEM Integration

  • Wazuh SIEM integration
  • Custom XML detection rules
  • Sigma detection rules
  • MITRE ATT&CK mapping
  • Real log ingestion pipeline

πŸ“Š SOC Dashboard

  • Live WebSocket alert feed
  • Severity triage
  • Case management workflow
  • Alert drill-down view
  • Threat context visualization

🧠 Explainable AI

  • SHAP explainability for fraud predictions
  • Top contributing feature visualization
  • Transparent ML decision-making

πŸ€– ARIA β€” AI SOC Analyst

AI-powered incident response assistant that provides:

  • Executive summaries
  • Risk analysis
  • MITRE technique explanation
  • Response recommendations
  • Analyst-style incident triage

πŸ“„ Incident Response

  • One-click PDF report generation
  • Slack webhook alerting
  • Incident workflow tracking

βš”οΈ Purple Team Simulation

  • Fraud attack simulations
  • Detection validation
  • SOC pipeline testing

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    ThreatLens Architecture                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β”‚
             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚  fraud_generator.py              β”‚
             β”‚  Writes UPI logs to:             β”‚
             β”‚  /var/log/upi_transactions.log   β”‚
             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚ 
                          β”‚ file monitoring
                          β”‚
             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚  Wazuh Manager 4.7               β”‚
             β”‚  Custom rules: fraud_rules.xml   β”‚
             β”‚  MITRE ATT&CK mapping            β”‚
             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚ 
                          β”‚ alerts.json
                          β”‚
             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚  bridge.py                       β”‚
             β”‚  Tails Wazuh alerts              β”‚
             β”‚  POSTs to FastAPI                β”‚
             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚ 
                          β”‚ HTTP POST
                          β”‚
                    Cloud (Production)
             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚  FastAPI Backend (Render)        │───────▢│ Supabase         β”‚
             β”‚  - Alert ingestion               β”‚         β”‚ PostgreSQL      β”‚
             β”‚  - XGBoost ML scoring            β”‚         β”‚ (Mumbai)        β”‚
             β”‚  - SHAP explainability           β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚  - ARIA AI analyst (Groq)        β”‚
             β”‚  - PDF report generation         β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚  - Slack notifications           │───────▢│ Slack Webhook    β”‚
             β”‚  - WebSocket broadcast           β”‚         β”‚ Critical alerts β”‚
             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚ WebSocket + REST
                          β”‚
             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
             β”‚  React Frontend (Vercel)         β”‚
             β”‚  - Live alert queue              β”‚
             β”‚  - SHAP visualization            β”‚
             β”‚  - Case management               β”‚
             β”‚  - ARIA chat interface           β”‚
             β”‚  - PDF export                    β”‚
             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈTech Stack

Frontend

  • React
  • Vite
  • Tailwind CSS

Backend

  • FastAPI
  • SQLAlchemy
  • WebSockets

Machine Learning

  • XGBoost
  • SHAP
  • Scikit-learn
  • Pandas
  • NumPy

Security / SIEM

  • Wazuh
  • Sigma Rules
  • MITRE ATT&CK

Infrastructure

  • Supabase PostgreSQL
  • Render
  • Vercel
  • Slack Webhooks

AI

  • Groq API
  • LLaMA 3

Dataset

The ML model is trained on the Credit Card Fraud Detection dataset from Kaggle.

  1. Download creditcard.csv from the link above
  2. Place it at ml/creditcard.csv
  3. Run python ml/train_model.py β€” this generates fraud_model.pkl and shap_explainer.pkl

Note: The pre-trained model files (fraud_model.pkl, shap_explainer.pkl) are already committed to the repo, so you can skip training and run the backend directly.


πŸ“‚ Project Structure

ThreatLens/
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ requirements.txt
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚
β”œβ”€β”€ ml/
β”‚   β”œβ”€β”€ train_model.py
β”‚   β”œβ”€β”€ fraud_model.pkl
β”‚   └── shap_explainer.pkl
β”‚
β”œβ”€β”€ wazuh/
β”‚   β”œβ”€β”€ fraud_generator.py
β”‚   β”œβ”€β”€ bridge.py
β”‚   β”œβ”€β”€ fraud_rules.xml
β”‚   └── sigma/
β”‚
β”œβ”€β”€ attack_simulation/
β”œβ”€β”€ screenshots/
└── docs/

βš™οΈ Local Setup

Clone Repository

git clone https://github.com/lvb05/ThreatLens.git
cd ThreatLens

Backend Setup

cd backend

python -m venv venv

# Windows
venv\Scripts\activate

# Linux/Mac
source venv/bin/activate

pip install -r requirements.txt

Create .env

DATABASE_URL=your_database_url
SECRET_KEY=your_secret_key
GROQ_API_KEY=your_groq_api_key
SLACK_WEBHOOK_URL=your_slack_webhook

Run backend:

uvicorn app.main:app --reload

Frontend Setup

cd frontend
npm install
npm run dev

ML Model Training

python ml/train_model.py

Wazuh Integration

Ubuntu VM:

python3 fraud_generator.py
sudo python3 bridge.py

Detection Scenarios

ThreatLens detects:

  • Card Testing
  • Velocity Abuse
  • Large Fraud
  • Account Takeover
  • Bot Activity

Mapped to MITRE ATT&CK techniques for security analyst visibility.


πŸ“Έ Screenshots

Dashboard

alerts

Wazuh Alerts

alerts

Slack Alerts

Slack Alerts


About

AI-assisted Security Operations Platform for Threat Detection, Alert Triage, and Incident Response

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors