Skip to content

atf-inc/dec25_intern_E_security

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Status Version License

πŸ›‘οΈ ShadowGuard AI

Real-Time Shadow AI/IT Detection Platform
AI-powered security monitoring for enterprise environments


πŸ“‹ Overview

ShadowGuard AI is an enterprise-grade security platform that detects and monitors unauthorized AI tools and Shadow IT usage in real-time. It uses a multi-layer detection engine combining semantic analysis, behavioral analysis, and rule-based detection to identify potential data exfiltration risks.

🎯 Key Highlights

  • 🧠 AI-Powered Detection β€” Semantic similarity analysis using embeddings
  • πŸ“Š Real-Time Dashboard β€” Live alerts with risk scores and explanations
  • πŸ”Œ Browser Extension β€” Capture real user browsing activity
  • ⚑ Instant Alerts β€” Slack notifications for high-risk events
  • 🐳 Docker-Ready β€” Full containerized deployment

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              ShadowGuard AI                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚                            β”‚                            β”‚
         β–Ό                            β–Ό                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Browser Extensionβ”‚         β”‚   Generator     β”‚         β”‚   Dashboard     β”‚
β”‚  (Real Traffic)  β”‚         β”‚ (Synthetic Logs)β”‚         β”‚  (React + API)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                            β”‚                            β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                            β”‚
                          β–Ό                                        β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                               β”‚
                 β”‚    Collector    β”‚                               β”‚
                 β”‚    (FastAPI)    β”‚                               β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜                               β”‚
                          β”‚ Redis Pub/Sub                          β”‚
                          β–Ό                                        β”‚
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                               β”‚
                 β”‚     Worker      β”‚                               β”‚
                 β”‚ (Detection Engine)                              β”‚
                 β”‚  β”œβ”€β”€ Semantic   β”‚                               β”‚
                 β”‚  β”œβ”€β”€ Behavioral β”‚                               β”‚
                 β”‚  └── Fusion     β”‚β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
                          β–Ό
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚  Slack Notifier β”‚
                 β”‚ (Real-time Alerts)β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

shadowguard-ai/
β”œβ”€β”€ πŸ“ collector/              # Log ingestion service (FastAPI)
β”‚   β”œβ”€β”€ app/                   # API routes and handlers
β”‚   β”œβ”€β”€ core/                  # Configuration and Redis client
β”‚   β”œβ”€β”€ models/                # Data models
β”‚   β”œβ”€β”€ schemas/               # Pydantic schemas
β”‚   β”œβ”€β”€ services/              # Business logic
β”‚   β”œβ”€β”€ main.py                # Application entry point
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ πŸ“ worker/                 # Multi-layer detection engine
β”‚   β”œβ”€β”€ worker.py              # Main event consumer
β”‚   β”œβ”€β”€ fusion.py              # Risk score fusion algorithm
β”‚   β”œβ”€β”€ semantic.py            # Semantic similarity analysis
β”‚   β”œβ”€β”€ behavior.py            # Behavioral anomaly detection
β”‚   β”œβ”€β”€ rules.py               # Rule-based detection
β”‚   β”œβ”€β”€ slack_notifier.py      # Slack alert integration
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ πŸ“ dashboard/              # Web UI and backend API
β”‚   β”œβ”€β”€ frontend/              # React 19 + Vite + TailwindCSS v4
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ components/    # UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”‚   └── App.tsx
β”‚   β”‚   β”œβ”€β”€ package.json
β”‚   β”‚   └── vite.config.ts
β”‚   β”œβ”€β”€ backend/               # FastAPI backend
β”‚   β”‚   β”œβ”€β”€ main.py            # API endpoints
β”‚   β”‚   └── requirements.txt
β”‚   β”œβ”€β”€ nginx.conf             # Reverse proxy configuration
β”‚   β”œβ”€β”€ start.sh               # Orchestration script
β”‚   └── Dockerfile             # Multi-stage build
β”‚
β”œβ”€β”€ πŸ“ generator/              # Synthetic log generator
β”‚   β”œβ”€β”€ generate_logs.py       # Log generation script
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ πŸ“ extension/              # Chrome browser extension
β”‚   β”œβ”€β”€ manifest.json          # MV3 extension manifest
β”‚   β”œβ”€β”€ background.js          # Service worker
β”‚   β”œβ”€β”€ content.js             # Content script
β”‚   β”œβ”€β”€ popup/                 # Extension popup UI
β”‚   β”œβ”€β”€ options/               # Extension settings page
β”‚   └── icons/
β”‚
β”œβ”€β”€ πŸ“ config/                 # Shared configuration
β”‚   β”œβ”€β”€ anchors.json           # Category definitions for semantic analysis
β”‚   β”œβ”€β”€ blacklist.json         # Blocked domains
β”‚   └── whitelist.json         # Allowed domains
β”‚
β”œβ”€β”€ πŸ“ docs/                   # Documentation
β”‚   β”œβ”€β”€ API.md
β”‚   β”œβ”€β”€ ARCHITECTURE.md
β”‚   └── SETUP.md
β”‚
β”œβ”€β”€ docker-compose.yml         # Service orchestration
β”œβ”€β”€ .env.example               # Environment variables template
β”œβ”€β”€ .gitignore
β”œβ”€β”€ TESTING.md
└── README.md

πŸ› οΈ Tech Stack

Category Technology
Frontend React TypeScript Vite TailwindCSS Framer Motion
Backend Python FastAPI Uvicorn
Database Redis
AI/ML OpenRouter Gemini NumPy
Infrastructure Docker Nginx
Extension Chrome Extension

✨ Features

πŸ” Multi-Layer Detection Engine

Layer Description
Semantic Analysis Uses AI embeddings to detect category matches (Generative AI, File Storage, Anonymous Services, etc.)
Behavioral Analysis Tracks user patterns and flags anomalies (first-time access, unusual upload volumes)
Rule-Based Detection Configurable whitelist/blacklist for immediate allow/block decisions
Fusion Engine Combines all signals with intent-aware scoring (POST/PUT uploads weighted differently than GET)

πŸ“Š Real-Time Dashboard

  • Live Alert Feed β€” Real-time security events with risk scores
  • Alert Simulation β€” Test scenarios for demo purposes
  • Risk Level Indicators β€” CRITICAL, HIGH, MEDIUM, LOW, SAFE
  • AI-Generated Explanations β€” Powered by Gemini API
  • Responsive Design β€” Modern glassmorphism UI with animations

πŸ”Œ Browser Extension

  • Passive Monitoring β€” Captures browsing activity without user intervention
  • Configurable Endpoint β€” Point to any collector instance
  • Privacy-Focused β€” Only sends metadata, not page content
  • Chrome MV3 β€” Built on the latest manifest version

πŸ”” Notifications

  • Slack Integration β€” Real-time alerts to security team channels
  • Threshold-Based β€” Only notify on HIGH/CRITICAL events

πŸš€ Quick Start

Prerequisites

  • Docker + Docker Compose
  • Node.js (v18+) β€” for frontend development
  • Python 3.11 β€” for local development
  • API keys (optional but recommended):
    • OPENROUTER_API_KEY β€” For semantic embeddings
    • GEMINI_API_KEY β€” For AI-generated explanations

1️⃣ Clone & Configure

git clone https://github.com/your-org/shadowguard-ai.git
cd shadowguard-ai

# Copy environment template
cp .env.example .env

# Edit .env with your API keys
nano .env

2️⃣ Start All Services (Docker)

docker-compose up --build

This starts:

Service Port Description
Redis 6379 Message broker & data store
Collector Internal Log ingestion (accessible via dashboard)
Worker 8000 Detection engine
Dashboard 3000 UI + API gateway

3️⃣ Access the Dashboard

Open http://localhost:3000 in your browser.

4️⃣ Generate Test Alerts

Option A: Use the Browser Extension (Recommended)

  1. Open chrome://extensions/
  2. Enable "Developer mode"
  3. Click "Load unpacked" β†’ Select the extension/ folder
  4. Configure the collector URL: http://localhost:3000/logs
  5. Browse the web normally β€” events are captured automatically

Option B: Synthetic Logs

python generator/generate_logs.py \
  --url http://localhost:3000/logs \
  --type mixed \
  --num-logs 50 \
  --once

βš™οΈ Environment Configuration

Create a .env file at the project root:

# Redis Configuration
REDIS_HOST=redis
REDIS_PORT=6379

# Service Ports
COLLECTOR_PORT=8000
DASHBOARD_PORT=3000

# AI/ML APIs (optional but recommended)
OPENROUTER_API_KEY=your_openrouter_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here

# Self-hosted Embedding Model (alternative to OpenRouter)
EMBEDDING_API_URL=http://YOUR_VM_IP:8000/embed

API Keys

Key Purpose Required
OPENROUTER_API_KEY Semantic embeddings for domain categorization Optional (falls back to keyword matching)
GEMINI_API_KEY AI-generated alert explanations Optional (shows "AI explanation unavailable" if missing)
EMBEDDING_API_URL Self-hosted embedding model endpoint Optional (alternative to OpenRouter)

πŸ§ͺ Development

Hybrid Mode (Recommended for Frontend Dev)

Terminal 1 β€” Backend Services (Docker)

docker-compose up redis collector worker

Terminal 2 β€” Frontend (Vite HMR)

cd dashboard/frontend
npm install
npm run dev

Access at: http://localhost:3000 (with hot reload)

Full Local Development

Collector:

cd collector
pip install -r requirements.txt
uvicorn main:app --reload --port 8000

Worker:

cd worker
pip install -r requirements.txt
python worker.py

Dashboard Backend:

cd dashboard/backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8001

Dashboard Frontend:

cd dashboard/frontend
npm install
npm run dev

πŸ”„ API Endpoints

Dashboard API (http://localhost:3000/api/)

Method Endpoint Description
GET /api/health Health check with Redis status
GET /api/alerts Fetch security alerts
GET /api/users Get user statistics

Collector API (Internal, proxied through dashboard)

Method Endpoint Description
POST /logs Ingest log events
GET /logs?params Ingest via query params (for proxies)
GET /health Collector health check

πŸ”§ Operations

Reset All Data

docker-compose down -v
docker-compose up --build

The -v flag removes volumes, wiping all stored alerts.

View Service Logs

# All services
docker-compose logs -f

# Specific service
docker-compose logs -f worker

Health Checks

# Dashboard API
curl http://localhost:3000/api/health

# Collector (via proxy)
curl http://localhost:3000/health

About

GitHub Repo for Team E

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6