Skip to content

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Purple-Ops

πŸ›‘οΈ Purple-Ops

Enterprise-Grade AI-Powered Security Operations Center (SOC) Platform

Python FastAPI React Docker License MCA Project


Real-time vulnerability scanning Β· CVE intelligence Β· NIST + ISO compliance Β· PDF reporting Β· RBAC auth


$ docker-compose up --build
βœ“ Backend   β†’ http://localhost:8000
βœ“ Frontend  β†’ http://localhost:5173
βœ“ Swagger   β†’ http://localhost:8000/docs
βœ“ ZAP       β†’ http://localhost:8090

πŸ“‹ Table of Contents


πŸ” Overview

Purple-Ops is a full-stack, production-ready Security Operations Center platform that integrates automated vulnerability scanning, real-time CVE threat intelligence, and regulatory compliance automation into a single deployable system.

Built as an MCA Final Year Major Project at Chandigarh University, it demonstrates that enterprise-grade SOC capabilities β€” typically costing $100K+/year in commercial tools β€” can be delivered through open-source technologies.

The Problem It Solves

Traditional Approach Purple-Ops
Manual, fragmented tools Single unified platform
No real-time CVE correlation Automatic NIST NVD API lookup
Manual compliance mapping Auto NIST 800-53 + ISO 27001
Sequential scanning (slow) Parallel scanning (~4x faster)
No PDF reporting One-click SOC reports
No RBAC 3-tier role enforcement

✨ Features

πŸ” Scanning Engine

  • Nmap network port scanner β€” TCP SYN, service version detection, OS fingerprinting
  • OWASP ZAP web application scanner β€” Spider + Active scan, OWASP Top 10 detection
  • Parallel Scanning β€” ThreadPoolExecutor (5 workers), ~4x throughput improvement
  • Auto-routing: IP targets β†’ Nmap, URLs β†’ ZAP

🧠 Threat Intelligence

  • Real-time NIST NVD API v2.0 integration
  • Automatic CVE ID fetching per discovered service
  • CVSS 3.x severity scoring (Critical / High / Medium / Low)
  • AI-based risk prioritization with asset criticality weighting

πŸ” Security & Auth

  • JWT authentication (HS256 signed tokens)
  • bcrypt password hashing (cost factor 12)
  • 3-tier RBAC β€” Admin / Analyst / Viewer
  • Route-level enforcement on all 14 API endpoints
  • CORS, input validation, SQL injection prevention via ORM

πŸ“‹ Compliance Automation

  • NIST SP 800-53 Rev 5 β€” 9 control families, 39 controls mapped
  • ISO/IEC 27001:2022 β€” Annex A technological controls, 28 controls mapped
  • Per-vulnerability control cross-referencing
  • Control frequency analysis for systemic gap identification

πŸ“„ Reporting

  • ReportLab PDF SOC reports β€” executive summary, vuln tables, compliance section
  • Prioritized remediation recommendations
  • Downloadable from dashboard in one click

🎯 Dashboard (14 Pages)

Page Description
Dashboard SOC command center β€” stat cards, live alerts, threat meter
Analytics 5 Recharts visualizations β€” donut, bar, area, horizontal bar, line
Alert Center Real-time alert feed with severity filtering + detail panel
Assets Asset inventory with CRUD + quick-scan button
Threats Vulnerability intelligence with inline status editing
Web Scanner OWASP ZAP-powered web assessment interface
Net Scanner Nmap network scanning with terminal output
Threat Intel IOC lookup β€” IP, domain, hash reputation analysis
Tickets Auto-generated incident tickets for Critical/High vulns
Case Board Card-based case management with status transitions
History Scan history trend charts + detailed log table
Compliance NIST + ISO mapping charts + audit-ready evidence table
Log Explorer Searchable activity log with severity color-coding
Terminal Real-time system activity stream

πŸ› οΈ Tech Stack

Layer Technologies
Backend FastAPI, SQLAlchemy, PostgreSQL/SQLite, Celery, Redis, APScheduler
Frontend React 18, Vite 5, Recharts, Lucide React
Security Tools Nmap 7.94+, OWASP ZAP (Docker), NIST NVD API v2.0
Auth JWT (python-jose), bcrypt, RBAC middleware
Reporting ReportLab, FastAPI-Mail
DevOps Docker Compose, 5-service architecture
Standards NIST SP 800-53 Rev 5, ISO/IEC 27001:2022, CVSS 3.x

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              πŸ‘€ User / Browser                       β”‚
β”‚         Admin  |  Analyst  |  Viewer                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ HTTPS / JWT Bearer
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       ⬑  React 18 + Vite  (localhost:5173)          β”‚
β”‚   14 Pages  |  5 Charts  |  Dark CyberPlatform UI   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ REST API / JSON
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     βš™οΈ  FastAPI Backend  (localhost:8000)            β”‚
β”‚  JWT Auth  |  RBAC  |  SQLAlchemy ORM  |  14 APIs   β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚          β”‚          β”‚          β”‚
  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β” β”Œβ”€β”€β”€β–Όβ”€β”€β”€β” β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β” β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
  β”‚Celery  β”‚ β”‚Scan   β”‚ β”‚Report  β”‚ β”‚Complianceβ”‚
  β”‚Workers β”‚ β”‚Engine β”‚ β”‚Engine  β”‚ β”‚Mapper    β”‚
  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚         β”‚
  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”  β”Œβ”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚Redis  β”‚  β”‚ Nmap        OWASP ZAP    NVD API β”‚
  β”‚:6379  β”‚  β”‚ (network)   (web :8090)  (CVEs)  β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  PostgreSQL   β”‚
  β”‚  (prod DB)    β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

  🐳 All services via Docker Compose β€” 1 command deploy

πŸš€ Quick Start

Prerequisites

  • Docker + Docker Compose v2
  • Git

1. Clone the repository

git clone https://github.com/yourusername/VulnGuardAI.git
cd VulnGuardAI

2. Configure environment

cp backend/.env.example backend/.env

Edit backend/.env:

SECRET_KEY=your-super-secret-jwt-key-min-64-chars
DATABASE_URL=sqlite:///./vulnguard.db
REDIS_URL=redis://redis:6379/0
ZAP_API=http://zap:8090
NVD_API_KEY=your-nvd-api-key-optional
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-password
MAIL_FROM=your-email@gmail.com

3. Start all services

docker-compose up --build

This starts all 5 services:

Service URL Description
Frontend http://localhost:5173 React dashboard
Backend API http://localhost:8000 FastAPI server
Swagger UI http://localhost:8000/docs API documentation
Redis localhost:6379 Celery broker (internal)
OWASP ZAP localhost:8090 Web scanner (internal)

4. Create your first admin user

curl -X POST http://localhost:8000/auth/register \
  -H "Content-Type: application/json" \
  -d '{"username": "admin", "password": "Admin@123", "role": "admin"}'

5. Login and start scanning

Open http://localhost:5173, login with your credentials, and add your first asset!


Manual Setup (without Docker)

# Terminal 1 β€” Redis
docker run -d -p 6379:6379 redis:alpine

# Terminal 2 β€” OWASP ZAP
docker run -d -p 8090:8090 ghcr.io/zaproxy/zaproxy:stable \
  zap.sh -daemon -host 0.0.0.0 -port 8090 -config api.disablekey=true

# Terminal 3 β€” Backend
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --host 0.0.0.0 --port 8000

# Terminal 4 β€” Celery worker
cd backend
celery -A task_queue.celery_app worker --loglevel=info

# Terminal 5 β€” Frontend
cd frontend
npm install
npm run dev

πŸ“ Project Structure

VulnGuardAI/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                    # App entry point, CORS, routers
β”‚   β”œβ”€β”€ database.py                # SQLAlchemy engine + session
β”‚   β”œβ”€β”€ .env                       # Environment config (secrets)
β”‚   β”œβ”€β”€ requirements.txt
β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ asset.py
β”‚   β”‚   β”œβ”€β”€ vulnerability.py
β”‚   β”‚   β”œβ”€β”€ user.py
β”‚   β”‚   β”œβ”€β”€ ticket.py
β”‚   β”‚   β”œβ”€β”€ audit.py
β”‚   β”‚   └── scan_history.py
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ auth.py                # Login, register, /me
β”‚   β”‚   β”œβ”€β”€ assets.py              # CRUD assets
β”‚   β”‚   β”œβ”€β”€ scan.py                # Single + parallel scan
β”‚   β”‚   β”œβ”€β”€ vulnerabilities.py     # Vuln list + status update
β”‚   β”‚   β”œβ”€β”€ tickets.py             # Incident tickets
β”‚   β”‚   β”œβ”€β”€ dashboard.py           # Summary stats
β”‚   β”‚   β”œβ”€β”€ history.py             # Scan history
β”‚   β”‚   └── report.py              # PDF + compliance reports
β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”œβ”€β”€ jwt_handler.py         # Token create/verify
β”‚   β”‚   β”œβ”€β”€ security.py            # bcrypt helpers
β”‚   β”‚   └── auth.py                # RBAC dependency injection
β”‚   β”œβ”€β”€ scanner/
β”‚   β”‚   β”œβ”€β”€ nmap_scanner.py        # Nmap integration
β”‚   β”‚   └── zap_scanner.py         # OWASP ZAP integration
β”‚   β”œβ”€β”€ intelligence/
β”‚   β”‚   β”œβ”€β”€ cve_fetcher.py         # NIST NVD API client
β”‚   β”‚   └── compliance_mapper.py   # NIST 800-53 + ISO 27001
β”‚   β”œβ”€β”€ ai_engine/
β”‚   β”‚   β”œβ”€β”€ cvss_calculator.py     # CVSS scoring logic
β”‚   β”‚   └── risk_model.py          # Risk prioritization
β”‚   β”œβ”€β”€ reports/
β”‚   β”‚   └── pdf_report.py          # ReportLab PDF generator
β”‚   β”œβ”€β”€ alerts/
β”‚   β”‚   └── email_alert.py         # FastAPI-Mail alerts
β”‚   β”œβ”€β”€ task_queue/
β”‚   β”‚   β”œβ”€β”€ celery_app.py          # Celery configuration
β”‚   β”‚   └── scan_tasks.py          # Background scan tasks
β”‚   └── core/
β”‚       β”œβ”€β”€ config.py              # Settings from .env
β”‚       β”œβ”€β”€ scheduler.py           # APScheduler jobs
β”‚       └── alert_engine.py        # Alert trigger logic
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── App.jsx                # All 14 pages (single SPA)
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ .env                       # VITE_API_BASE=http://localhost:8000
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ vite.config.js
β”‚   └── Dockerfile
β”œβ”€β”€ docker-compose.yml             # 5-service orchestration
└── README.md

πŸ“‘ API Endpoints

All endpoints except /auth/login and /auth/register require Authorization: Bearer <token>.

Method Endpoint Role Required Description
POST /auth/register Public Register new user
POST /auth/login Public Login + get JWT
GET /auth/me All Get current user info
GET /assets/ All List all assets
POST /assets/ Admin / Analyst Add new asset
GET /vulnerabilities/ All List vulnerabilities
PUT /vulnerabilities/{id}/status Admin / Analyst Update status
POST /scan/{asset_id} Admin / Analyst Scan single asset
POST /scan/parallel Admin / Analyst Parallel scan all
GET /tickets/ All List tickets
PUT /tickets/{id}/status Admin / Analyst Update ticket
GET /dashboard/summary All Dashboard stats
GET /history/ All Scan history
GET /reports/vulnerabilities/pdf Admin / Analyst Download PDF
GET /reports/compliance All Compliance mapping

Full interactive docs: http://localhost:8000/docs


πŸ‘₯ RBAC Roles

Permission Admin Analyst Viewer
View dashboard / analytics βœ… βœ… βœ…
View assets / vulnerabilities βœ… βœ… βœ…
View tickets / history βœ… βœ… βœ…
Add / edit assets βœ… βœ… ❌
Trigger scans βœ… βœ… ❌
Update vulnerability status βœ… βœ… ❌
Generate PDF reports βœ… βœ… ❌
Manage users βœ… ❌ ❌
View audit logs βœ… ❌ ❌

πŸ“Š Performance

Metric Result
API response time (GET endpoints) < 70ms avg
PDF generation time < 4s
Parallel scan speedup (5 workers) ~4x vs sequential
JWT auth coverage 100% of protected endpoints
Unit test cases 97 passed, 0 failed
Backend test coverage 89.8%
NIST SP 800-53 control coverage 83% (39/47 relevant controls)
ISO 27001 control coverage 82.4% (28/34 tech controls)

βœ… Compliance Frameworks

NIST SP 800-53 Revision 5

Auto-mapped control families: AC, IA, SC, SI, RA, CM, AU, IR, SA

ISO/IEC 27001:2022 Annex A

Auto-mapped themes: Organizational Controls (A.5), Technological Controls (A.8)

OWASP Top 10 (2021)

100% coverage via OWASP ZAP active scanning engine


πŸ§ͺ Running Tests

cd backend
pip install pytest pytest-mock
pytest tests/ -v --tb=short

Expected output:

97 passed in 12.4s

πŸ“Έ Screenshots

Dashboard, Analytics, Compliance, Alert Center β€” screenshots available in /docs/Screenshots/

Dashboard

⚠️ Ethical Use Notice

Purple-Ops is designed exclusively for authorized security assessment of systems you own or have explicit written permission to test.

Unauthorized scanning of systems you do not own may violate the Computer Fraud and Abuse Act (CFAA), Computer Misuse Act, or equivalent legislation in your jurisdiction.

Always obtain written authorization before scanning any target.


πŸŽ“ Academic Information

Field Details
Project Type MCA Final Year Major Project
Student Ayush Kumar Thakur
UID 24MCA20322 (MCA 5'B)
Institution University Institute of Computing, Chandigarh University
Academic Year 2024–26
Domain Cybersecurity

πŸ“„ License

This project is licensed under the MIT License β€” see LICENSE for details.


Purple-Ops β€” Built with ❀️ for the cybersecurity community

"From scan to compliance report in minutes, not days."

About

Purple-Ops is a full-stack, production-ready Security Operations Center platform that integrates automated vulnerability scanning, real-time CVE threat intelligence, and regulatory compliance automation into a single deployable system.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages