🛡️ 网络防御演练

XSS攻击

SQL注入

DDoS攻击

钓鱼攻击

", sql: "注入恶意SQL: ' OR 1=1 --", ddos: "来自192.168.0.*的10000个请求...", phishing: "紧急通知:点击此处重置密码 → fakeurl.com" }; document.getElementById(`${type}-log`).innerHTML += `
${logs[type]}
`; updateHealth(-20); } // 防御机制 function defend(type) { const results = { xss: "已转义特殊字符 → <script>...", sql: "使用预编译语句阻止注入", ddos: "流量清洗成功,拦截95%请求", phishing: "检测到伪造发件人地址" }; document.getElementById(`${type}-log`).innerHTML += `
${results[type]}
`; updateHealth(10); } // 更新血条 function updateHealth(value) { health = Math.min(Math.max(health + value, 0), 100); document.getElementById('health').style.width = `${health}%`; if(health <= 0) { alert('系统已被攻破!游戏结束'); location.reload(); } }