const LessonModule = require('../base/LessonModule'); /** * Comprehensive XSS Lesson * Demonstrates both reflected XSS (URL parameters) and stored XSS (forum comments) * Features: Variant discovery tracking, hint system, time limits */ class XSSComprehensiveLesson extends LessonModule { constructor(config) { super(config); // Track discovered variants per participant this.discoveredVariants = new Map(); // participantId -> Set of variant types // Track step start times per participant this.stepStartTimes = new Map(); // participantId -> timestamp // Track hints used per participant this.hintsUsed = new Map(); // participantId -> { stepId: count } // Maximum time to earn points (15 minutes) this.MAX_TIME_FOR_POINTS = 15 * 60 * 1000; // Point deduction per hint this.HINT_PENALTY = 5; // Total XSS variants to discover this.TOTAL_VARIANTS = 9; } /** * XSS variant patterns to discover */ getVariantPatterns() { return [ { regex: //gi, type: 'SCRIPT_TAG', name: 'Script Tag' }, { regex: /on\w+\s*=\s*["'][^"']*["']/gi, type: 'EVENT_HANDLER', name: 'Event Handler (quoted)' }, { regex: /on\w+\s*=\s*[^"\s>]+/gi, type: 'EVENT_HANDLER_UNQUOTED', name: 'Event Handler (unquoted)' }, { regex: /javascript:/gi, type: 'JAVASCRIPT_PROTOCOL', name: 'JavaScript Protocol' }, { regex: /