How tni-cybersec/tnicybersec-cwc works
Project Type and Purpose
• This is a full-stack, microservices-style platform for running CTF (Jeopardy) and King-of-the-Hill competitions.
• Key capabilities: real-time score tracking, KOTH capture events, custom scoring hooks, web UI for players/admins, Java-based simulators for testing, and SDKs for extension.
File Structure
• Top-level service/component folders:
• ctf-web-frontend (Vue.js SPA)
• ctf-web-backend (Firebase Cloud Functions + Firestore)
• ctf-koth-endpoint-agent (Node.js)
• ctf-koth-tracking-server (Node.js)
• custom-scoring-sdk (TypeScript library)
• capturesim / capturesim-cwc2020 (Java simulation frameworks)
• point-calculator (Java point calculation service)
• web-dashboard-sample (static HTML/JS demo)
• guides + write-ups (documentation, not part of runtime)
README
• Confirms the repo is “CWC” – a CTF & KOTH cybersecurity competition platform.
a. Main Components
• Frontend: Vue.js SPA (ctf-web-frontend)
• Backend: Firebase Firestore + Cloud Functions (ctf-web-backend)
• KOTH Capture Pipeline:
– Endpoint Agent (Node.js)
– Tracking Server (Node.js)
• Scoring & Rules:
– custom-scoring-sdk (TS library)
– point-calculator service (Java)
• Simulation/Test Harness: capturesim, capturesim-cwc2020 (Java)
• Static Dashboard Demo: web-dashboard-sample
b. Relationships & Data Flows
1. User (Admin/Player) ↔ Vue SPA
2. Vue SPA ⇄ Firestore (reads/writes game state, scores, profiles)
3. Firestore triggers Cloud Functions for:
– onFlagAnswered, onItemPurchased, onMissionChanged, etc.
4. Endpoint Agent monitors real KOTH servers, generates push IDs, posts events to the Tracking Server.
5. Tracking Server writes KOTH capture events into Firestore (via Firebase SDK).
6. Point-Calculator service (if run as standalone or triggered via Cloud Functions) applies custom point logic (via custom-scoring-sdk).
7. Simulators connect to GameService APIs or directly invoke FlagService/HillService to model games for offline testing.
c. Architectural Patterns & Principles
• Frontend/Backend separation with serverless backend (Firebase).
• Event-driven architecture using Firestore triggers.
• Modular scoring via an SDK so custom rules can be pluggable.
• Microservice agents for real-time KOTH capture ingestion.
• Java-based simulators follow Strategy pattern for games/scenarios.
d. Key Technologies
• ctf-web-frontend: Vue.js, Vuex, Vue Router, Firebase JS SDK
• ctf-web-backend: Node.js, Firebase Cloud Functions, Firestore, Firebase Security Rules
• Endpoint & Tracker: Node.js, Firebase Admin SDK
• custom-scoring-sdk: TypeScript, npm, Firebase SDK, Event Emitter
• Point Calculator & Simulators: Java, Maven, custom Java interfaces/services
Don’t Overthink—Be Exhaustive
• Firestore triggers from functions/src/triggers.
• Custom-scoring-sdk as a shared library referenced by both Cloud Functions and point-calculator.
• Interactions, even if flows are simple read/write operations.