AI-powered cybersecurity tabletop exercise scenario generator that creates comprehensive, realistic scenarios for security training and incident response exercises.
- π€ Multi-AI Provider Support - Generate scenarios using OpenAI GPT or Anthropic Claude
- π― Smart Scenario Generation - Create detailed, realistic cybersecurity scenarios
- π Reroll Capability - Regenerate specific sections of scenarios on-demand
- π° Cost Estimation - Compare costs across different AI providers before generation
- π’ Customizable Parameters - Company size, industry, threat actors, technologies
- π Scenario History - Track and review previously generated scenarios
- π¨ Modern UI - Responsive design with cyberpunk theme
- β‘ Real-time Generation - Fast, async scenario creation
- π± Export Options - Download scenarios as text files
- π§ Production Ready - Docker support with nginx and gunicorn
# One-liner deployment
docker-compose -f docker-compose.prod.yml up -d
# Visit the application
open http://localhostThat's it! The application will be available at http://localhost with both frontend and backend running.
- Framework: FastAPI with async support
- Validation: Pydantic v2 for data validation
- AI Integration: OpenAI API, Anthropic API
- Server: Gunicorn with uvicorn workers
- Testing: pytest, pytest-cov
- Code Quality: Black, Ruff
- Framework: Vue 3 with Composition API
- Build Tool: Vite for fast development
- UI Components: PrimeVue 4
- HTTP Client: Axios
- Styling: CSS Variables with cyberpunk theme
- Containerization: Multi-stage Docker builds
- Web Server: Nginx for static file serving and API proxy
- Process Manager: Gunicorn for production WSGI serving
- Python 3.11+
- Node.js 20+
- Docker (optional, for containerized development)
-
Clone the repository
git clone https://github.com/xFreed0m/threatforge.git cd threatforge -
Backend Setup
cd backend python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Frontend Setup
cd ../frontend npm install -
Environment Configuration
cp .env.example .env # Edit .env and add your API keys -
Run Development Servers
Backend (from
backend/directory):source venv/bin/activate uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Frontend (from
frontend/directory):npm run dev
-
Access the Application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
# Development with hot-reloading
docker-compose -f docker-compose.dev.yml up
# Access at http://localhost:3000 (frontend) and http://localhost:8000 (backend)ThreatForge implements comprehensive security scanning to prevent secrets from being exposed:
- TruffleHog: Scans for verified secrets in git history
- GitLeaks: Comprehensive secret detection with custom patterns
- Pre-commit hooks: Prevent secrets from being committed
- Weekly scans: Automated security audits
- β Secret Detection: Automated scanning for API keys, tokens, and credentials
- β False Positive Filtering: Excludes test data and examples
- β Git History Scanning: Full repository history analysis
- β Pre-commit Protection: Hooks prevent accidental secret commits
- β SARIF Reports: Integration with GitHub Security tab
# Quick setup (recommended)
./scripts/setup-security.sh
# Manual setup
pip install pre-commit
pre-commit install
# Run GitLeaks scan (no license required for personal repos)
gitleaks detect --config-path=.gitleaks.toml --verbose
# Run TruffleHog scan
trufflehog --only-verified --fail .cd backend
pytestcd frontend
npm run test# Backend
cd backend
black .
ruff check .
# Frontend
cd frontend
npm run lintCreate a .env file in the project root:
# API Keys (at least one required)
OPENAI_API_KEY=sk-your-openai-key-here
ANTHROPIC_API_KEY=sk-ant-your-anthropic-key-here
# Application Settings
ENVIRONMENT=production
SECRET_KEY=your-secret-key-here
DATABASE_URL=sqlite:///./threatforge.db
# Optional: Custom ports
FRONTEND_PORT=80
BACKEND_PORT=8000- OpenAI: Get your API key from OpenAI Platform
- Anthropic: Get your API key from Anthropic Console
At least one API key is required for scenario generation. For testing, the application will use a mock provider if no keys are configured.
-
Fill out the scenario form with your requirements:
- Company name and industry
- Company size (small to enterprise)
- Threat actor type (ransomware, APT, insider, etc.)
- Exercise duration
- Technologies and participants
- AI provider preference
-
Generate scenarios with a single click
-
Use the reroll feature to regenerate specific sections
-
Compare costs across different AI providers
-
Review and export your generated scenario
threatforge/
βββ backend/ # FastAPI backend
β βββ app/
β β βββ api/ # API routes
β β βββ core/ # Configuration
β β βββ models/ # Database models
β β βββ schemas/ # Pydantic models
β β βββ services/ # Business logic & AI services
β βββ tests/ # Test files
β βββ requirements.txt # Python dependencies
βββ frontend/ # Vue.js frontend
β βββ src/
β β βββ components/ # Vue components
β β βββ assets/ # Static assets
β β βββ views/ # Page components
β βββ package.json # Node dependencies
β βββ vite.config.js # Vite configuration
βββ docker/ # Docker configuration
β βββ Dockerfile.frontend
β βββ Dockerfile.backend
β βββ nginx.conf
βββ docs/ # Documentation
βββ docker-compose.dev.yml # Development setup
βββ docker-compose.prod.yml # Production setup
βββ README.md
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style (Black for Python, ESLint for JavaScript)
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
- π Multi-user Support - User authentication and scenario sharing
- π Analytics Dashboard - Usage statistics and scenario metrics
- π Scenario Templates - Pre-built templates for common scenarios
- π± Mobile App - Native mobile application
- π Multi-language Support - Internationalization
- π API Integrations - Connect with security tools and platforms
- π Advanced Analytics - Scenario effectiveness tracking
- π― Custom AI Models - Fine-tuned models for specific industries
- Collaborative Editing - Real-time scenario collaboration
- Advanced AI Features - Custom model training
- Enterprise Features - SSO, RBAC, audit logs
- API Marketplace - Third-party integrations
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with FastAPI and Vue.js
- UI components from PrimeVue
- AI capabilities powered by OpenAI and Anthropic
- Icons from Heroicons
This feature provides AI-powered threat modeling analysis for cybersecurity systems. Users can upload diagram files or provide text descriptions of systems to generate comprehensive threat models using various frameworks.
- DRAWIO (.drawio) - Diagram files for system architecture
- PNG (.png) - Image files
- JPG (.jpg) - Image files
- SVG (.svg) - Vector graphics
- XML (.xml) - XML-based diagrams
- Maximum file size: 10MB
The system uses advanced AI models (OpenAI GPT and Anthropic Claude) to generate comprehensive threat models based on:
- System descriptions - Text-based descriptions of systems, architectures, or components
- Uploaded diagrams - Visual representations of system architecture
- Multiple frameworks - STRIDE, LINDDUN, PASTA, and Attack Trees analysis
- System Overview - Brief description of the analyzed system
- Asset Identification - Key assets, data, and components
- Threat Actors - Potential attackers and their motivations
- Threat Analysis - Detailed threats using the selected framework
- Risk Assessment - Threat ratings (High/Medium/Low) based on likelihood and impact
- Mitigation Strategies - Recommended controls and countermeasures
- Security Recommendations - Overall security posture improvements
POST /api/threat-model/uploadβ Upload a diagram file (multipart/form-data, field:file)GET /api/threat-model/filesβ List uploaded filesDELETE /api/threat-model/files/{file_id}β Delete a file by its IDPOST /api/threat-model/generateβ Generate AI-powered threat model (synchronous)POST /api/threat-model/generate-asyncβ Generate AI-powered threat model (asynchronous)GET /api/threat-model/jobs/{job_id}β Get async job status and progressDELETE /api/threat-model/jobs/{job_id}β Cancel an async jobGET /api/threat-model/jobsβ List recent jobsPOST /api/threat-model/estimate-costβ Estimate costs across all AI providersGET /api/threat-model/providersβ Get available AI providers
curl -X POST "http://localhost:8000/api/threat-model/generate-async" \
-H "Content-Type: application/json" \
-d '{
"content": "A web application with user authentication and database storage",
"framework": "STRIDE",
"file_id": "optional-uploaded-file-id",
"llm_provider": "openai"
}'curl -X GET "http://localhost:8000/api/threat-model/jobs/{job_id}"curl -X POST "http://localhost:8000/api/threat-model/generate" \
-H "Content-Type: application/json" \
-d '{
"content": "A web application with user authentication and database storage",
"framework": "STRIDE",
"file_id": "optional-uploaded-file-id",
"llm_provider": "openai"
}'curl -X POST "http://localhost:8000/api/threat-model/estimate-cost" \
-H "Content-Type: application/json" \
-d '{
"content": "A cloud-based microservices application",
"framework": "STRIDE",
"llm_provider": "openai"
}'- Use the "Threat Model Upload" button at the top of the app to switch to the threat modeling interface
- Upload supported diagram files for additional context (optional)
- Provide a detailed system description in the text area
- Select a threat modeling framework (STRIDE, LINDDUN, PASTA, Attack Trees)
- Choose an AI provider (OpenAI or Anthropic)
- Generate comprehensive threat models with cost estimation
- Export results in multiple formats (Text, Markdown, JSON, PDF)
- Drag & Drop Upload - Easy file upload with visual feedback
- Multi-file Support - Upload and manage multiple diagram files
- Bulk Operations - Select and delete multiple files at once
- Progress Tracking - Real-time upload progress indicators
- Cost Comparison - Compare costs across different AI providers
- Export Options - Download threat models in various formats
- Form Validation - Real-time validation and error handling
- Async Processing - Background job processing for complex analyses
- Progress Monitoring - Real-time job status and progress tracking
- Result Caching - Automatic caching to avoid regenerating similar models
- Job Management - View, cancel, and manage async generation jobs
- Dual Generation Modes - Choose between synchronous and asynchronous processing
- Visual Threat Modeling - Interactive diagram-based threat modeling
- Component Library - Pre-built components for common system elements
- Threat Mapping - Visual threat assignment to system components
- Advanced Export - Professional PDF reports and executive summaries
- Compliance Reports - Framework-specific compliance analysis
- Custom Templates - Configurable export templates and formats
- Quick Start Guide - Get up and running in 5 minutes
- Threat Modeling User Guide - Comprehensive guide to threat modeling
- Best Practices - Best practices for effective threat modeling
- Sample Threat Models - Examples and templates
- Multiple Frameworks: STRIDE, LINDDUN, PASTA, Attack Trees
- AI Providers: OpenAI GPT and Anthropic Claude integration
- Async Processing: Background job processing with progress tracking
- Intelligent Caching: Automatic result caching for similar requests
- Interactive Diagrams: Drag-and-drop system component creation
- Component Library: Pre-built components for common system elements
- Threat Mapping: Visual threat assignment to system components
- Real-time Collaboration: Multi-user threat modeling sessions
- Diagram Export: Export diagrams in multiple formats
- PDF Reports: Professional PDF reports with executive summaries
- Executive Summaries: High-level summaries for stakeholders
- Technical Reports: Detailed technical analysis for security teams
- Compliance Reports: Compliance-focused reports with controls mapping
- Custom Templates: Configurable export templates and formats
- File Upload: Support for DRAWIO, PNG, JPG, SVG, XML diagrams
- Job Monitoring: Real-time tracking of async threat model generation
- Cost Comparison: Compare costs across different AI providers
- Export Integration: Export to various formats and platforms
- Threat Modeling API:
POST /api/threat-model/generate,POST /api/threat-model/generate-async - File Management:
POST /api/threat-model/upload,GET /api/threat-model/files,DELETE /api/threat-model/files/clear - Job Management:
GET /api/threat-model/jobs/{job_id},DELETE /api/threat-model/jobs/{job_id} - Cost Estimation:
POST /api/threat-model/estimate-cost - Provider Information:
GET /api/threat-model/providers
- Built-in Tutorial: Click the "Tutorial" button in the threat modeling interface
- Visual Modeling: Switch between text-based and visual threat modeling
- Real-time Job Monitoring: Track async threat model generation progress
- Cost Comparison: Compare costs across different AI providers
- Advanced Export: Generate professional reports in multiple formats
