How mohitsharma-2007/aegisai works
Project Type and Purpose
• This is a full-stack security simulation tool called AEGIS-AI.
High-Level File Structure Analysis
• Top-level “frontend/” – static web UI (HTML, CSS, JS), bundled via Vite (see .vite/, node_modules/).
• Top-level “backend/” – Python Flask monolith (app.py), script engine, AI-SCRIPT folder for per-model implementations, detection logic, downloaded example scripts.
• Config & tooling: package.json for frontend dependencies, various SCRIPT_*.md docs, VSCode settings.
Key Insights from README
• Frontend: console.html, dashboards, script management pages, uses AJAX/Fetch to call Flask API.
• Backend: a Flask API server (port 5050), loading attack scripts via BaseScript, calling external LLM services (OpenAI, Claude, Gemini), running detection algorithms, returning JSON results.
• Deployment: simple HTTP server for static files (port 8080) + Flask server.
Components
a. Frontend Layer
• Browser clients → static HTTP server (serving HTML/CSS/JS).
• UI modules: Console Interface, Dashboard, Script Management pages.
• Script-bridge and console-functions JS call REST endpoints.
b. Backend Layer
• Flask API Server (app.py)
• Script Manager / Loader
• Attack Simulation Modules:
• AI-SCRIPT (Claude, GPT, Gemini)
• Web/DDoS/Bot/Recon scripts under backend/scripts
• Detection Engine (ai_detection.py)
• External Services: OpenAI API, Anthropic Claude, Google Gemini
• Downloaded third-party scripts
c. Data Stores & Artifacts
• In-memory or file-based logs (honeypot_dashboard, logs.html)
• Static config (honeypots.json)
d. External Integrations
• Third-party LLM APIs
• Optional browser-launched static server
Relationships & Data Flow
1. User selects an attack in the browser UI
2. Frontend JS → HTTP POST to Flask endpoint (/run_attack, /test_detection, etc.)
3. Flask receives request → Script Manager loads target script
4. Attack Simulation module executes (locally or via external LLM API)
5. Detection Engine observes, simulates blocking, records events
6. Flask returns JSON results & logs
7. Frontend updates console/dashboard in real time
8. For dashboards, frontend polls logs endpoints or receives push updates
Architectural Patterns & Design Principles
• Monolithic backend exposing RESTful API
• Modular script architecture: plugin pattern (BaseScript subclasses)
• Separation of concerns: UI layer vs. API vs. script implementations vs. detection logic
• Extensibility: easily add new scripts in categorized directories
Technologies & Frameworks to Annotate
• Frontend: HTML5, CSS3, Vanilla JavaScript, Vite bundler
• Backend: Python 3.8+, Flask, custom script loader
• External APIs: OpenAI, Anthropic, Google Gemini
• Deployment: Python HTTP server, Windows batch script
Elements
• Component labels (e.g., “Console UI”, “Flask API Server”)