{
  "case_id": "B4",
  "case_name": "遭受攻击的WebOS",
  "prompt": "创建一个模拟\"正在遭受黑客攻击\"的Web操作系统，要求：\n1. 基础Windows风格界面（桌面、任务栏、窗口）\n2. 预装应用：文本编辑器、终端、文件管理器\n3. 攻击效果模拟：\n   - 窗口自动弹出/关闭\n   - 光标乱跑\n   - 屏幕闪烁/花屏\n   - 终端显示\"入侵代码\"\n   - 文件被\"加密\"（文件名变乱码）\n4. 用户可尝试\"反击\"（点击杀毒软件）\n5. 单文件HTML",
  "result": {
    "success": true,
    "content": "这是一个包含完整HTML、CSS和JavaScript的单文件解决方案。它模拟了一个基于Windows 98风格的Web操作系统，并内置了“黑客入侵”的脚本逻辑和“杀毒软件”互动功能。\n\n### 使用说明：\n1.  将下方代码保存为 `.html` 文件（例如 `hacked_os.html`）。\n2.  用浏览器打开。\n3.  **体验：** 页面加载后，系统会立即遭到“攻击”。\n4.  **互动：** 即使鼠标受到干扰，请尝试点击桌面上的 **\"🛡️ System Defender\"** 图标或任务栏，启动杀毒软件进行反击。\n\n```html\n<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>LegacyOS - System Breach Detected</title>\n    <style>\n        :root {\n            --bg-color: #008080;\n            --win-gray: #c0c0c0;\n            --win-blue: #000080;\n            --win-text: #000;\n            --hacker-green: #0f0;\n        }\n\n        body {\n            margin: 0;\n            padding: 0;\n            background-color: var(--bg-color);\n            font-family: 'Courier New', Courier, monospace; /*以此模拟旧系统*/\n            overflow: hidden;\n            user-select: none;\n            cursor: default;\n            height: 100vh;\n            width: 100vw;\n        }\n\n        /* 屏幕故障效果层 */\n        #glitch-layer {\n            position: fixed;\n            top: 0;\n            left: 0;\n            width: 100%;\n            height: 100%;\n            pointer-events: none;\n            z-index: 9999;\n            background: transparent;\n            opacity: 0;\n        }\n\n        @keyframes glitch-anim {\n            0% { transform: translate(0) }\n            20% { transform: translate(-5px, 5px); filter: hue-rotate(90deg); }\n            40% { transform: translate(5px, -5px); filter: invert(1); }\n            60% { transform: translate(-5px, 0); opacity: 0.5; }\n            100% { transform: translate(0); opacity: 0; }\n        }\n\n        .glitching {\n            animation: glitch-anim 0.2s infinite;\n        }\n\n        /* 桌面图标 */\n        .desktop-icons {\n            position: absolute;\n            top: 10px;\n            left: 10px;\n            display: flex;\n            flex-direction: column;\n            gap: 20px;\n            z-index: 1;\n        }\n\n        .icon {\n            width: 80px;\n            text-align: center;\n            color: white;\n            cursor: pointer;\n            text-shadow: 1px 1px 0 #000;\n        }\n\n        .icon-img {\n            width: 40px;\n            height: 40px;\n            margin: 0 auto 5px;\n            background-color: rgba(255,255,255,0.2);\n            border: 1px solid white;\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            font-size: 24px;\n        }\n\n        /* 窗口样式 (Win98 风格) */\n        .window {\n            position: absolute;\n            background: var(--win-gray);\n            border: 2px solid;\n            border-color: #fff #000 #000 #fff;\n            box-shadow: 2px 2px 5px rgba(0,0,0,0.5);\n            display: flex;\n            flex-direction: column;\n            min-width: 200px;\n            min-height: 150px;\n            font-family: sans-serif;\n        }\n\n        .title-bar {\n            background: var(--win-blue);\n            color: white;\n            padding: 2px 5px;\n            font-weight: bold;\n            display: flex;\n            justify-content: space-between;\n            align-items: center;\n            cursor: move;\n        }\n\n        .title-bar.alert {\n            background: red;\n        }\n\n        .close-btn {\n            background: var(--win-gray);\n            color: black;\n            border: 1px solid;\n            border-color: #fff #000 #000 #fff;\n            width: 16px;\n            height: 16px;\n            line-height: 14px;\n            text-align: center;\n            font-size: 12px;\n            cursor: pointer;\n        }\n\n        .window-content {\n            flex-grow: 1;\n            padding: 5px;\n            overflow: auto;\n            font-size: 14px;\n        }\n\n        /* 终端样式 */\n        .terminal {\n            background: black;\n            color: var(--hacker-green);\n            font-family: 'Courier New', monospace;\n            height: 100%;\n            padding: 5px;\n            box-sizing: border-box;\n        }\n\n        /* 任务栏 */\n        .taskbar {\n            position: fixed;\n            bottom: 0;\n            left: 0;\n            width: 100%;\n            height: 35px;\n            background: var(--win-gray);\n            border-top: 2px solid #fff;\n            display: flex;\n            align-items: center;\n            padding: 0 5px;\n            z-index: 10000;\n        }\n\n        .start-btn {\n            background: var(--win-gray);\n            border: 2px solid;\n            border-color: #fff #000 #000 #fff;\n            padding: 2px 10px;\n            font-weight: bold;\n            display: flex;\n            align-items: center;\n            gap: 5px;\n            cursor: pointer;\n        }\n\n        .taskbar-clock {\n            margin-left: auto;\n            border: 2px solid;\n            border-color: #000 #fff #fff #000;\n            padding: 2px 10px;\n            background: #eee;\n        }\n\n        /* 假光标 */\n        #fake-cursor {\n            position: fixed;\n            width: 15px;\n            height: 20px;\n            background: white;\n            clip-path: polygon(0 0, 0 100%, 30% 70%, 50% 100%, 70% 90%, 50% 60%, 100% 60%);\n            border: 1px solid black;\n            pointer-events: none;\n            z-index: 10001;\n            transition: all 0.1s ease;\n            display: none;\n        }\n\n        /* 杀毒软件进度条 */\n        .progress-container {\n            width: 100%;\n            background: white;\n            border: 1px solid #000;\n            height: 20px;\n            margin-top: 10px;\n        }\n        .progress-bar {\n            width: 0%;\n            height: 100%;\n            background: navy;\n            transition: width 0.2s;\n        }\n\n        /* 攻击时的红色滤镜 */\n        .red-alert {\n            animation: red-flash 1s infinite;\n        }\n        @keyframes red-flash {\n            0%, 100% { box-shadow: inset 0 0 0 0 red; }\n            50% { box-shadow: inset 0 0 100px 50px rgba(255,0,0,0.5); }\n        }\n        \n        /* 文件列表样式 */\n        .file-item { padding: 2px; cursor: pointer; }\n        .file-item:hover { background: navy; color: white; }\n    </style>\n</head>\n<body>\n\n    <div id=\"glitch-layer\"></div>\n    <div id=\"fake-cursor\"></div>\n\n    <div class=\"desktop-icons\">\n        <div class=\"icon\" onclick=\"openApp('explorer')\">\n            <div class=\"icon-img\">📁</div>\n            <div>My Files</div>\n        </div>\n        <div class=\"icon\" onclick=\"openApp('terminal')\">\n            <div class=\"icon-img\">💻</div>\n            <div>Terminal</div>\n        </div>\n        <div class=\"icon\" onclick=\"openApp('notepad')\">\n            <div class=\"icon-img\">📝</div>\n            <div>Notepad</div>\n        </div>\n        <div class=\"icon\" onclick=\"openApp('antivirus')\">\n            <div class=\"icon-img\">🛡️</div>\n            <div>System Defender</div>\n        </div>\n    </div>\n\n    <!-- 窗口容器 -->\n    <div id=\"window-area\"></div>\n\n    <div class=\"taskbar\">\n        <div class=\"start-btn\">🪟 Start</div>\n        <div class=\"taskbar-clock\" id=\"clock\">12:00 PM</div>\n    </div>\n\n    <script>\n        // --- 系统状态 ---\n        let isUnderAttack = true;\n        let zIndexCounter = 100;\n        let attackIntervals = [];\n        let windows = [];\n        \n        // --- 攻击参数 ---\n        const attackPhrases = [\n            \"UPLOADING DATA...\", \"SYSTEM COMPROMISED\", \"ENCRYPTING...\", \n            \"CONNECTING TO BOTNET...\", \"ACCESS GRANTED\", \"DELETING SYSTEM32\"\n        ];\n\n        // --- 初始化 ---\n        window.onload = function() {\n            updateClock();\n            setInterval(updateClock, 1000);\n            \n            // 预装应用\n            openApp('notepad');\n            setTimeout(() => openApp('terminal'), 500);\n            \n            // 启动攻击\n            setTimeout(startHackAttack, 2000);\n        };\n\n        function updateClock() {\n            const now = new Date();\n            document.getElementById('clock').innerText = now.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});\n        }\n\n        // --- 窗口管理器 ---\n        function openApp(type) {\n            let title = \"Application\";\n            let content = \"\";\n            let width = 300;\n            let height = 200;\n            let id = 'win-' + Date.now();\n\n            if (type === 'notepad') {\n                title = \"Notepad - Untitled\";\n                content = `<textarea style=\"width:98%; height:90%; resize:none;\">Don't forget to backup the server codes today.</textarea>`;\n            } else if (type === 'terminal') {\n                title = \"Command Prompt\";\n                content = `<div class=\"terminal\" id=\"term-${id}\">C:\\\\User\\\\Admin> _</div>`;\n                width = 400;\n            } else if (type === 'explorer') {\n                title = \"File Explorer\";\n                content = `\n                    <div id=\"files-${id}\">\n                        <div class=\"file-item\">📄 salary_report.xls</div>\n                        <div class=\"file-item\">📄 passwords.txt</div>\n                        <div class=\"file-item\">🖼️ vacation.jpg</div>\n                        <div class=\"file-item\">📁 System</div>\n                    </div>`;\n            } else if (type === 'antivirus') {\n                title = \"System Defender 2000\";\n                content = `\n                    <div style=\"text-align:center; padding:10px;\">\n                        <h3>⚠️ THREAT DETECTED</h3>\n                        <p>System is under heavy attack.</p>\n                        <button onclick=\"runAntivirus('${id}')\" style=\"padding:5px 15px; font-weight:bold; cursor:pointer;\">🔴 NEUTRALIZE THREAT</button>\n                        <div class=\"progress-container\">\n                            <div class=\"progress-bar\" id=\"bar-${id}\"></div>\n                        </div>\n                        <p id=\"status-${id}\">Status: CRITICAL</p>\n                    </div>\n                `;\n                width = 350;\n                height = 250;\n            }\n\n            createWindow(id, title, content, width, height, type);\n        }\n\n        function createWindow(id, title, content, w, h, type) {\n            const win = document.createElement('div');\n            win.className = 'window';\n            win.id = id;\n            win.style.width = w + 'px';\n            win.style.height = h + 'px';\n            win.style.left = (Math.random() * (window.innerWidth - w)) + 'px';\n            win.style.top = (Math.random() * (window.innerHeight - h - 50)) + 'px';\n            win.style.zIndex = ++zIndexCounter;\n            \n            // 攻击时的特殊样式\n            let titleClass = (isUnderAttack && Math.random() > 0.7) ? 'title-bar alert' : 'title-bar';\n\n            win.innerHTML = `\n                <div class=\"${titleClass}\" onmousedown=\"startDrag(event, '${id}')\">\n                    <span>${title}</span>\n                    <div class=\"close-btn\" onclick=\"closeWindow('${id}')\">X</div>\n                </div>\n                <div class=\"window-content\">${content}</div>\n            `;\n\n            document.getElementById('window-area').appendChild(win);\n            windows.push({id: id, type: type});\n\n            if (type === 'terminal' && isUnderAttack) {\n                startTerminalSpam(id);\n            }\n            if (type === 'explorer' && isUnderAttack) {\n                scrambleFiles(id);\n            }\n        }\n\n        function closeWindow(id) {\n            const win = document.getElementById(id);\n            if (win) win.remove();\n            windows = windows.filter(w => w.id !== id);\n        }\n\n        // --- 拖拽逻辑 (简化版) ---\n        let draggedWin = null;\n        let offsetX, offsetY;\n\n        function startDrag(e, id) {\n            draggedWin = document.getElementById(id);\n            draggedWin.style.zIndex = ++zIndexCounter;\n            const rect = draggedWin.getBoundingClientRect();\n            offsetX = e.clientX - rect.left;\n            offsetY = e.clientY - rect.top;\n            document.addEventListener('mousemove', dragWindow);\n            document.addEventListener('mouseup', stopDrag);\n        }\n\n        function dragWindow(e) {\n            if (!draggedWin) return;\n            draggedWin.style.left = (e.clientX - offsetX) + 'px';\n            draggedWin.style.top = (e.clientY - offsetY) + 'px';\n        }\n\n        function stopDrag() {\n            document.removeEventListener('mousemove', dragWindow);\n            document.removeEventListener('mouseup', stopDrag);\n            draggedWin = null;\n        }\n\n        // --- ☠️ 黑客攻击逻辑 ☠️ ---\n\n        function startHackAttack() {\n            if (!isUnderAttack) return;\n            document.body.classList.add('red-alert');\n            \n            // 1. 随机弹窗\n            let popupInt = setInterval(() => {\n                if(Math.random() > 0.6) {\n                    createWindow('err-'+Date.now(), 'ERROR', '<h1 style=\"color:red; text-align:center\">YOU HAVE BEEN HACKED</h1>', 300, 150, 'popup');\n                }\n            }, 2000);\n            attackIntervals.push(popupInt);\n\n            // 2. 窗口自动关闭/移动\n            let chaosInt = setInterval(() => {\n                if(windows.length > 0) {\n                    const target = windows[Math.floor(Math.random() * windows.length)];\n                    const el = document.getElementById(target.id);\n                    if(el) {\n                        // 随机移动\n                        el.style.left = Math.random() * (window.innerWidth - 300) + 'px';\n                        el.style.top = Math.random() * (window.innerHeight - 200) + 'px';\n                    }\n                }\n            }, 800);\n            attackIntervals.push(chaosInt);\n\n            // 3. 屏幕闪烁/花屏\n            let glitchInt = setInterval(() => {\n                const layer = document.getElementById('glitch-layer');\n                layer.className = 'glitching';\n                layer.style.opacity = Math.random();\n                setTimeout(() => { layer.style.opacity = 0; layer.className = ''; }, 200);\n            }, 3000);\n            attackIntervals.push(glitchInt);\n\n            // 4. 光标乱跑 (视觉效果)\n            const fakeCursor = document.getElementById('fake-cursor');\n            fakeCursor.style.display = 'block';\n            let cursorInt = setInterval(() => {\n                fakeCursor.style.left = Math.random() * window.innerWidth + 'px';\n                fakeCursor.style.top = Math.random() * window.innerHeight + 'px';\n                // 真正的鼠标也稍微受点干扰 (CSS cursor)\n                document.body.style.cursor = 'progress'; \n            }, 100);\n            attackIntervals.push(cursorInt);\n        }\n\n        function startTerminalSpam(winId) {\n            const term = document.getElementById('term-' + winId);\n            if(!term) return;\n            \n            let spamInt = setInterval(() => {\n                if (!document.getElementById(winId)) {\n                    clearInterval(spamInt);\n                    return;\n                }\n                const line = document.createElement('div');\n                line.innerText = \"> \" + attackPhrases[Math.floor(Math.random() * attackPhrases.length)] + \" [\" + Math.random().toString(16).substr(2, 8) + \"]\";\n                term.appendChild(line);\n                term.scrollTop = term.scrollHeight;\n            }, 200);\n            attackIntervals.push(spamInt);\n        }\n\n        function scrambleFiles(winId) {\n            const container = document.getElementById('files-' + winId);\n            if(!container) return;\n            \n            let scrambleInt = setInterval(() => {\n                if (!document.getElementById(winId)) {\n                    clearInterval(scrambleInt);\n                    return;\n                }\n                const items = container.getElementsByClassName('file-item');\n                for(let item of items) {\n                    if(Math.random() > 0.8) {\n                        item.innerText = \"📄 \" + Math.random().toString(36).substring(7) + \".enc\";\n                        item.style.color = \"red\";\n                    }\n                }\n            }, 1000);\n            attackIntervals.push(scrambleInt);\n        }\n\n        // --- 🛡️ 杀毒软件反击逻辑 🛡️ ---\n\n        function runAntivirus(winId) {\n            const btn = document.querySelector(`#${winId} button`);\n            const bar = document.getElementById(`bar-${winId}`);\n            const status = document.getElementById(`status-${winId}`);\n            \n            if(btn) btn.disabled = true;\n            \n            let progress = 0;\n            let cleanInt = setInterval(() => {\n                progress += 2;\n                bar.style.width = progress + '%';\n                \n                // 模拟战斗过程，减少攻击频率\n                if(progress % 20 === 0) {\n                    status.innerText = \"Status: REMOVING VIRUS... \" + progress + \"%\";\n                    // 移除部分弹窗\n                    const popups = windows.filter(w => w.type === 'popup');\n                    if(popups.length > 0) closeWindow(popups[0].id);\n                }\n\n                if(progress >= 100) {\n                    clearInterval(cleanInt);\n                    status.innerText = \"Status: SYSTEM SECURE\";\n                    status.style.color = \"green\";\n                    systemRestore();\n                }\n            }, 100);\n        }\n\n        function systemRestore() {\n            isUnderAttack = false;\n            \n            // 清除所有攻击定时器\n            attackIntervals.forEach(clearInterval);\n            attackIntervals = [];\n\n            // 移除视觉特效\n            document.body.classList.remove('red-alert');\n            document.getElementById('glitch-layer').style.display = 'none';\n            document.getElementById('fake-cursor').style.display = 'none';\n            document.body.style.cursor = 'default';\n\n            // 关闭所有错误弹窗\n            windows.filter(w => w.type === 'popup').forEach(w => closeWindow(w.id));\n\n            // 修复文件管理器\n            windows.filter(w => w.type === 'explorer').forEach(w => {\n                const el = document.getElementById('files-' + w.id);\n                if(el) el.innerHTML = `\n                    <div class=\"file-item\">📄 salary_report.xls</div>\n                    <div class=\"file-item\">📄 passwords.txt</div>\n                    <div class=\"file-item\">🖼️ vacation.jpg</div>\n                    <div class=\"file-item\">📁 System</div>\n                `;\n            });\n\n            // 修复终端\n            windows.filter(w => w.type === 'terminal').forEach(w => {\n                const el = document.getElementById('term-' + w.id);\n                if(el) {\n                    el.innerHTML += `<div style=\"color:white; margin-top:10px;\">> SYSTEM RESTORED SUCCESSFULLY.</div>`;\n                    el.innerHTML += `<div style=\"color:white;\">> HAVE A NICE DAY.</div>`;\n                    el.scrollTop = el.scrollHeight;\n                }\n            });\n\n            alert(\"THREAT ELIMINATED. SYSTEM RESTORED.\");\n        }\n\n    </script>\n</body>\n</html>\n```",
    "model": "gemini-3-pro-preview",
    "usage": {
      "prompt_tokens": 149,
      "completion_tokens": 6900,
      "total_tokens": 7049
    },
    "timestamp": "2025-11-19 13:26:39"
  },
  "needs_screenshot": true,
  "needs_manual_test": true
}