Skip to content

Techris93/OpenSentinel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ OpenSentinel

AI-Powered SOC Command Center

Natural Language β†’ SIEM Queries Β· Real-Time Detection Β· AI Copilot Β· Automated Response

Features β€’ Architecture β€’ Quickstart β€’ API β€’ Security β€’ Contributing

OpenSentinel Command Center Dashboard


Overview

OpenSentinel is a full-stack Security Operations Center (SOC) platform that combines AI-driven analysis with traditional SIEM capabilities. It translates natural language queries into Splunk SPL, runs automated detection rules mapped to MITRE ATT&CK, and provides an AI copilot for incident investigation β€” all behind an API hardened against the OWASP API Security Top 10.

Features

πŸ€– NLP Query Engine

  • Natural language β†’ Splunk SPL translation via spaCy NER
  • Support for custom fine-tuned NLP models
  • Entity extraction: IPs, domains, users, security actions
  • Context-aware query building with time range support

πŸ” Sentinel Detection Engine

  • 6 built-in detection rules mapped to MITRE ATT&CK
  • Real-time alert lifecycle (new β†’ acknowledged β†’ closed)
  • Configurable thresholds and time windows
  • Anomaly detection module
Rule MITRE Severity
Brute Force Detection T1110 High
Suspicious PowerShell T1059.001 Critical
DNS Exfiltration T1048.003 Critical
Lateral Movement (SMB) T1021.002 High
Privilege Escalation T1068 Critical
C2 Beaconing T1071 High

πŸ“‹ Incident Management

  • Full incident lifecycle with timeline tracking
  • Alert-to-incident linking
  • Notes, status updates, and severity tracking
  • BOLA-protected object-level access control

🧠 AI Copilot (Google Gemini)

  • Script Analyzer β€” Deobfuscate and assess suspicious scripts
  • Threat Intel Enrichment β€” IOC lookups via VirusTotal & AbuseIPDB
  • Investigator β€” AI-guided investigation workflows
  • Summarizer β€” Natural language summaries of SIEM query results

🎯 Threat Hunting

  • Pre-built hunt library with categorized queries
  • Hunt notebook for tracking investigations
  • One-click hunt execution against live SIEM data

⚑ Automated Playbooks

  • 5 built-in response playbooks
  • Action-based execution engine
  • Execution statistics and audit trail

πŸ–₯️ Dashboard

  • Glassmorphism dark-theme UI
  • Responsive design with hamburger menu
  • Real-time status indicators
  • Interactive chat interface for NLP queries

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Dashboard (HTML)                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              FastAPI Server (main.py)                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Security β”‚  β”‚  Auth    β”‚  β”‚ Input Validator   β”‚  β”‚
β”‚  β”‚Middlewareβ”‚  β”‚ Manager  β”‚  β”‚ (SSRF/Injection)  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚   SOC    β”‚  β”‚ Sentinel β”‚  β”‚   AI     β”‚          β”‚
β”‚  β”‚  Agent   β”‚  β”‚  Engine  β”‚  β”‚ Copilot  β”‚          β”‚
│  │(NLP→SPL)│  │(Detect)  │  │(Gemini)  │          │
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜          β”‚
β”‚       β”‚                           β”‚                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚ Splunk   β”‚  β”‚Playbooks β”‚  β”‚VirusTotalβ”‚          β”‚
β”‚  β”‚  SIEM    β”‚  β”‚ Engine   β”‚  β”‚AbuseIPDB β”‚          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Quickstart

Prerequisites

  • Python 3.10+
  • Splunk instance (optional β€” Gemini AI works without SIEM)
  • API Keys for Gemini, VirusTotal, AbuseIPDB (optional)

Installation

# Clone the repository
git clone https://github.com/Techris93/OpenSentinel.git
cd OpenSentinel

# Create virtual environment
python -m venv venv
source venv/bin/activate  # macOS/Linux
# venv\Scripts\activate   # Windows

# Install dependencies
pip install -r requirements.txt

# Download spaCy model
python -m spacy download en_core_web_sm

Configuration

Create a .env file in the project root:

# Google Gemini API (https://aistudio.google.com/app/apikey)
GEMINI_API_KEY=your_gemini_key_here

# VirusTotal API (https://www.virustotal.com)
VIRUSTOTAL_API_KEY=your_vt_key_here

# AbuseIPDB API (https://www.abuseipdb.com)
ABUSEIPDB_API_KEY=your_abuseipdb_key_here

# Splunk Connection (optional)
SPLUNK_HOST=localhost
SPLUNK_PORT=8089
SPLUNK_USERNAME=admin
SPLUNK_PASSWORD=changeme

# Security
OPENSENTINEL_API_KEY=your-secure-api-key
RATE_LIMIT=60
CORS_ORIGINS=http://localhost:5001

Run

python main.py
πŸ›‘οΈ OpenSentinel Command Center v1.0.0 starting on port 5001...
   API Docs:    http://localhost:5001/api/docs
   Dashboard:   http://localhost:5001/dashboard
   OWASP:       API1-10 protections active

API Reference

All endpoints are available at /api/v1/ (versioned) and /api/ (legacy).

Public Endpoints

Method Path Description
GET /api/v1/health Health check with system status
GET /dashboard Web dashboard UI
GET /api/docs Interactive OpenAPI docs

Authenticated Endpoints

Include X-API-Key: <your-key> header in all requests.

Method Path Role Description
POST /api/v1/connect admin Connect to Splunk SIEM
POST /api/v1/chat analyst NLP query interface
POST /api/v1/sentinel/start admin Start detection engine
POST /api/v1/sentinel/stop admin Stop detection engine
GET /api/v1/sentinel/alerts analyst Get security alerts
GET /api/v1/anomalies analyst Get detected anomalies
GET /api/v1/incidents analyst List incidents (BOLA-filtered)
GET /api/v1/incidents/{id} analyst Get incident detail
GET /api/v1/hunts analyst List threat hunts
POST /api/v1/hunts/{id}/execute analyst Execute a threat hunt
POST /api/v1/copilot/analyze-script analyst AI script analysis
POST /api/v1/copilot/enrich analyst IOC enrichment
GET /api/v1/playbooks analyst List playbooks
GET /api/v1/playbooks/stats analyst Playbook execution stats

Example: Chat Query

curl -X POST http://localhost:5001/api/v1/chat \
  -H "X-API-Key: your-key" \
  -H "Content-Type: application/json" \
  -d '{"message": "Show me failed login attempts from 192.168.1.100"}'

Security

OpenSentinel implements all OWASP API Security Top 10 protections:

# Vulnerability Mitigation
API1 BOLA Ownership verification on incident endpoints
API2 Broken Auth Key expiry, timing-safe comparison, brute-force lockout
API3 Property Auth Field-level response filtering by role
API4 Rate Limiting Global + per-endpoint rate limits
API5 Function Auth Role-based access (admin/analyst/readonly)
API6 Anti-Automation Per-endpoint throttling on sensitive flows
API7 SSRF Private IP blocking in recon targets
API8 Misconfiguration Security headers (HSTS, CSP, X-Frame-Options)
API9 Inventory API versioning + OpenAPI documentation
API10 Unsafe Consumption External API response truncation and sanitization

Role Hierarchy

admin > analyst > readonly
  • admin β€” Full access: SIEM connection, sentinel control, all data
  • analyst β€” Query, investigate, hunt, view own incidents
  • readonly β€” View limited incident fields only

Project Structure

OpenSentinel/
β”œβ”€β”€ main.py                   # FastAPI server (19 endpoints)
β”œβ”€β”€ soc_agent.py             # NLP β†’ Splunk SPL engine
β”œβ”€β”€ gemini_client.py         # Google Gemini AI client
β”œβ”€β”€ dashboard.html           # Web UI (glassmorphism)
β”œβ”€β”€ requirements.txt         # Python dependencies
β”œβ”€β”€ .gitignore
β”‚
β”œβ”€β”€ security/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ auth.py              # API key management & RBAC
β”‚   β”œβ”€β”€ middleware.py         # Rate limiting, headers, audit
β”‚   └── input_validator.py   # Injection & SSRF prevention
β”‚
β”œβ”€β”€ sentinel/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ detection_engine.py  # Rule-based threat detection
β”‚   β”œβ”€β”€ rules.py             # MITRE ATT&CK detection rules
β”‚   β”œβ”€β”€ anomaly_detector.py  # Statistical anomaly detection
β”‚   └── incidents.py         # Incident lifecycle manager
β”‚
β”œβ”€β”€ copilot/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ summarizer.py        # AI event summarization
β”‚   β”œβ”€β”€ script_analyzer.py   # Malicious script analysis
β”‚   β”œβ”€β”€ investigator.py      # AI investigation assistant
β”‚   └── threat_intel.py      # VirusTotal & AbuseIPDB
β”‚
β”œβ”€β”€ hunting/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ hunt_library.py      # Pre-built hunt queries
β”‚   └── notebook.py          # Hunt investigation notebook
β”‚
β”œβ”€β”€ playbooks/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ engine.py            # Playbook execution engine
β”‚   └── actions.py           # Response action definitions
β”‚
└── connectors/
    └── __init__.py           # SIEM connector interface

Contributing

Contributions are welcome! Areas where help is especially valued:

  • Detection Rules β€” Add new MITRE ATT&CK-mapped rules
  • SIEM Connectors β€” Extend beyond Splunk (Elastic, QRadar, Sentinel)
  • Playbook Actions β€” Add automated response capabilities
  • Tests β€” Improve test coverage
  • Documentation β€” Improve guides and tutorials

License

MIT License β€” see LICENSE for details.


Built with ❀️ for the Blue Team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors