Spaces:
Running
Running
File size: 26,684 Bytes
0e13845 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | <!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cyber Warfare Simulator</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');
* {
font-family: 'Orbitron', monospace;
}
.matrix-rain {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: -1;
}
.glow {
box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}
.glow-red {
box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}
.terminal-cursor {
animation: blink 1s infinite;
}
@keyframes blink {
0%, 50% { opacity: 1; }
51%, 100% { opacity: 0; }
}
.scan-line {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 2px;
background: linear-gradient(to right, transparent, #00ff00, transparent);
animation: scan 2s linear infinite;
}
@keyframes scan {
0% { top: 0; }
100% { top: 100%; }
}
.glitch {
animation: glitch 0.3s infinite;
}
@keyframes glitch {
0% { transform: translateX(0); }
20% { transform: translateX(-2px); }
40% { transform: translateX(2px); }
60% { transform: translateX(-1px); }
80% { transform: translateX(1px); }
100% { transform: translateX(0); }
}
.hacker-grid {
background-image:
linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
background-size: 20px 20px;
}
.firewall-pulse {
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.05); opacity: 0.8; }
100% { transform: scale(1); opacity: 1; }
}
</style>
</head>
<body class="bg-black text-green-400 overflow-hidden">
<!-- Matrix Rain Background -->
<canvas class="matrix-rain"></canvas>
<!-- Main Container -->
<div class="min-h-screen flex flex-col">
<!-- Header -->
<header class="bg-gray-900 border-b border-cyan-500/30 p-4">
<div class="flex justify-between items-center">
<h1 class="text-2xl md:text-4xl font-bold text-cyan-400 glow">
<i class="fas fa-skull"></i> <span id="title" data-trans="title">CYBER WARFARE SIMULATOR</span>
</h1>
<button id="lang-switch" class="bg-cyan-800 hover:bg-cyan-700 text-white px-3 py-1 rounded text-sm ml-4">
<i class="fas fa-language"></i> 中文
</button>
<div class="text-sm md:text-base">
<span class="text-red-400" data-trans="status">STATUS:</span>
<span id="status" class="text-green-400" data-trans="online">ONLINE</span>
<span class="terminal-cursor">_</span>
</div>
</div>
</header>
<!-- Main Content -->
<div class="flex-1 flex flex-col md:flex-row">
<!-- Left Panel - Terminal -->
<div class="w-full md:w-1/3 bg-gray-900 border-r border-cyan-500/30 p-4">
<div class="border border-cyan-500/50 rounded-lg p-4 h-full">
<div class="flex justify-between items-center mb-4">
<h2 class="text-cyan-400 text-lg font-bold" data-trans="terminal">TERMINAL</h2>
<div class="flex space-x-2">
<div class="w-3 h-3 bg-red-500 rounded-full"></div>
<div class="w-3 h-3 bg-yellow-500 rounded-full"></div>
<div class="w-3 h-3 bg-green-500 rounded-full"></div>
</div>
</div>
<div id="terminal-output" class="text-sm font-mono h-64 overflow-y-auto">
> Initializing cyber warfare protocols...<br>
> Loading attack vectors...<br>
> System ready for penetration testing<br>
> <span class="terminal-cursor">_</span>
</div>
<div class="mt-4">
<input
id="terminal-input"
type="text"
class="w-full bg-black border border-cyan-500/50 rounded px-3 py-2 text-green-400 placeholder-green-600"
placeholder="Enter command..."
>
</div>
</div>
</div>
<!-- Center Panel - Network Map -->
<div class="flex-1 bg-gray-900 p-4">
<div class="border border-cyan-500/50 rounded-lg p-4 h-full relative">
<div class="scan-line"></div>
<h2 class="text-cyan-400 text-lg font-bold mb-4" data-trans="networkMap">NETWORK MAP</h2>
<div id="network-canvas" class="h-96 bg-black rounded-lg relative overflow-hidden">
<!-- Network nodes will be generated here -->
</div>
<div class="mt-4 grid grid-cols-2 gap-4">
<button
id="scan-btn"
class="bg-cyan-600 hover:bg-cyan-500 text-black font-bold py-2 px-4 rounded glow"
>
<i class="fas fa-search"></i> SCAN
</button>
<button
id="attack-btn"
class="bg-red-600 hover:bg-red-500 text-white font-bold py-2 px-4 rounded glow-red"
>
<i class="fas fa-bolt"></i> ATTACK
</button>
</div>
</div>
</div>
<!-- Right Panel - System Info -->
<div class="w-full md:w-1/3 bg-gray-900 border-l border-cyan-500/30 p-4">
<div class="border border-cyan-500/50 rounded-lg p-4 h-full">
<h2 class="text-cyan-400 text-lg font-bold mb-4" data-trans="systemInfo">SYSTEM INFO</h2>
<!-- Firewall Status -->
<div class="mb-4">
<h3 class="text-yellow-400 mb-2" data-trans="firewall">FIREWALL</h3>
<div class="w-full bg-gray-700 rounded-full h-4">
<div id="firewall-bar" class="bg-green-400 h-4 rounded-full firewall-pulse" style="width: 85%"></div>
</div>
<p class="text-xs mt-1"><span data-trans="protectionLevel">Protection Level:</span> <span id="firewall-level">85%</span></p>
</div>
<!-- Attack Log -->
<div class="mb-4">
<h3 class="text-red-400 mb-2" data-trans="attackLog">ATTACK LOG</h3>
<div id="attack-log" class="text-xs h-32 overflow-y-auto bg-black p-2 rounded">
<div class="text-gray-400" data-trans="noAttacks">No attacks detected</div>
</div>
</div>
<!-- System Resources -->
<div class="mb-4">
<h3 class="text-purple-400 mb-2" data-trans="resources">RESOURCES</h3>
<div class="text-xs space-y-1">
<div>CPU: <span id="cpu-usage">34%</span></div>
<div>RAM: <span id="ram-usage">67%</span></div>
<div>DISK: <span id="disk-usage">45%</span></div>
</div>
</div>
<!-- Quick Actions -->
<div>
<h3 class="text-cyan-400 mb-2" data-trans="quickActions">QUICK ACTIONS</h3>
<div class="grid grid-cols-2 gap-2">
<button class="bg-gray-700 hover:bg-gray-600 text-xs py-1 px-2 rounded">
<i class="fas fa-shield-alt"></i> DEFEND
</button>
<button class="bg-gray-700 hover:bg-gray-600 text-xs py-1 px-2 rounded">
<i class="fas fa-eye"></i> MONITOR
</button>
<button class="bg-gray-700 hover:bg-gray-600 text-xs py-1 px-2 rounded">
<i class="fas fa-bug"></i> EXPLOIT
</button>
<button class="bg-gray-700 hover:bg-gray-600 text-xs py-1 px-2 rounded">
<i class="fas fa-ghost"></i> HIDE
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Notification Popup -->
<div id="notification" class="fixed top-4 right-4 bg-red-600 text-white p-4 rounded-lg shadow-lg hidden">
<div class="flex items-center">
<i class="fas fa-exclamation-triangle mr-2"></i>
<span id="notification-text">Security breach detected!</span>
</div>
</div>
<script>
// Matrix Rain Effect
function setupMatrixRain() {
const canvas = document.querySelector('.matrix-rain');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const drops = [];
for (let i = 0; i < canvas.width / 10; i++) {
drops[i] = 0;
}
function draw() {
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = '#0F0';
ctx.font = '10px monospace';
for (let i = 0; i < drops.length; i++) {
const char = chars[Math.floor(Math.random() * chars.length)];
ctx.fillText(char, i * 10, drops[i] * 10);
if (drops[i] * 10 > canvas.height && Math.random() > 0.975) {
drops[i] = 0;
}
drops[i]++;
}
}
setInterval(draw, 33);
}
// Network Visualization
function createNetwork() {
const canvas = document.getElementById('network-canvas');
const nodes = [];
const connections = [];
// Generate nodes
for (let i = 0; i < 8; i++) {
nodes.push({
x: Math.random() * (canvas.offsetWidth - 50) + 25,
y: Math.random() * (canvas.offsetHeight - 50) + 25,
type: Math.random() > 0.7 ? 'target' : 'normal',
id: i
});
}
// Generate connections
for (let i = 0; i < nodes.length; i++) {
const connectionsCount = Math.floor(Math.random() * 3) + 1;
for (let j = 0; j < connectionsCount; j++) {
const target = Math.floor(Math.random() * nodes.length);
if (target !== i) {
connections.push({ from: i, to: target });
}
}
}
// Render
function render() {
canvas.innerHTML = '';
// Draw connections
connections.forEach(conn => {
const line = document.createElement('div');
const from = nodes[conn.from];
const to = nodes[conn.to];
const length = Math.sqrt(Math.pow(to.x - from.x, 2) + Math.pow(to.y - from.y, 2));
const angle = Math.atan2(to.y - from.y, to.x - from.x) * 180 / Math.PI;
line.style.position = 'absolute';
line.style.left = from.x + 'px';
line.style.top = from.y + 'px';
line.style.width = length + 'px';
line.style.height = '1px';
line.style.backgroundColor = 'rgba(0, 255, 255, 0.3)';
line.style.transformOrigin = '0 50%';
line.style.transform = `rotate(${angle}deg)`;
canvas.appendChild(line);
});
// Draw nodes
nodes.forEach(node => {
const nodeEl = document.createElement('div');
nodeEl.style.position = 'absolute';
nodeEl.style.left = (node.x - 10) + 'px';
nodeEl.style.top = (node.y - 10) + 'px';
nodeEl.style.width = '20px';
nodeEl.style.height = '20px';
nodeEl.style.borderRadius = '50%';
nodeEl.style.backgroundColor = node.type === 'target' ? '#ff0000' : '#00ffff';
nodeEl.style.boxShadow = `0 0 10px ${node.type === 'target' ? '#ff0000' : '#00ffff'}`;
nodeEl.className = 'firewall-pulse cursor-pointer';
nodeEl.addEventListener('click', () => {
showNodeInfo(node);
});
canvas.appendChild(nodeEl);
});
}
render();
}
// Terminal Commands
const commands = {
help: 'Available commands: scan, attack, defend, status, clear',
scan: 'Scanning network for vulnerabilities...',
attack: 'Initiating attack sequence...',
defend: 'Activating defense protocols...',
status: 'System status: OPERATIONAL',
clear: ''
};
// Event Listeners
document.getElementById('terminal-input').addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
const input = e.target.value.toLowerCase();
const output = document.getElementById('terminal-output');
output.innerHTML += `<br>> ${input}`;
if (commands[input]) {
if (input === 'clear') {
output.innerHTML = '> ';
} else {
output.innerHTML += `<br>> ${commands[input]}`;
// Trigger actual actions
if (input === 'scan') {
performScan();
} else if (input === 'attack') {
performAttack();
}
}
} else {
output.innerHTML += '<br>> Command not found';
}
output.innerHTML += '<br>> <span class="terminal-cursor">_</span>';
output.scrollTop = output.scrollHeight;
e.target.value = '';
}
});
// Scan Function
function performScan() {
const notification = document.getElementById('notification');
const notificationText = document.getElementById('notification-text');
notificationText.textContent = 'Network scan completed. 3 vulnerabilities found!';
notification.className = notification.className.replace('hidden', '');
setTimeout(() => {
notification.className += ' hidden';
}, 3000);
// Update network
createNetwork();
}
// Attack Function
function performAttack() {
const firewallBar = document.getElementById('firewall-bar');
const firewallLevel = document.getElementById('firewall-level');
const attackLog = document.getElementById('attack-log');
// Decrease firewall
let currentLevel = parseInt(firewallLevel.textContent);
currentLevel = Math.max(0, currentLevel - 15);
firewallBar.style.width = currentLevel + '%';
firewallLevel.textContent = currentLevel + '%';
// Add to attack log
const timestamp = new Date().toLocaleTimeString();
attackLog.innerHTML = `
<div class="text-red-400">${timestamp} - Attack initiated</div>
<div class="text-yellow-400">${timestamp} - Firewall breach attempt</div>
` + attackLog.innerHTML;
// Visual effect
document.body.classList.add('glitch');
setTimeout(() => {
document.body.classList.remove('glitch');
}, 500);
}
// Button Listeners
document.getElementById('scan-btn').addEventListener('click', () => {
performScan();
});
document.getElementById('attack-btn').addEventListener('click', () => {
performAttack();
});
// Update system resources
function updateResources() {
const cpu = document.getElementById('cpu-usage');
const ram = document.getElementById('ram-usage');
const disk = document.getElementById('disk-usage');
setInterval(() => {
cpu.textContent = Math.floor(Math.random() * 30) + 20 + '%';
ram.textContent = Math.floor(Math.random() * 30) + 50 + '%';
disk.textContent = Math.floor(Math.random() * 30) + 30 + '%';
}, 2000);
}
// Translation data
const translations = {
en: {
title: "CYBER WARFARE SIMULATOR",
status: "STATUS:",
online: "ONLINE",
terminal: "TERMINAL",
networkMap: "NETWORK MAP",
systemInfo: "SYSTEM INFO",
firewall: "FIREWALL",
protectionLevel: "Protection Level:",
attackLog: "ATTACK LOG",
noAttacks: "No attacks detected",
resources: "RESOURCES",
quickActions: "QUICK ACTIONS",
scan: "SCAN",
attack: "ATTACK",
defend: "DEFEND",
monitor: "MONITOR",
exploit: "EXPLOIT",
hide: "HIDE",
placeholder: "Enter command...",
initialTerminal: [
"> Initializing cyber warfare protocols...",
"> Loading attack vectors...",
"> System ready for penetration testing"
]
},
zh: {
title: "网络攻防模拟器",
status: "状态:",
online: "在线",
terminal: "终端",
networkMap: "网络地图",
systemInfo: "系统信息",
firewall: "防火墙",
protectionLevel: "防护等级:",
attackLog: "攻击日志",
noAttacks: "未检测到攻击",
resources: "资源",
quickActions: "快速操作",
scan: "扫描",
attack: "攻击",
defend: "防御",
monitor: "监控",
exploit: "漏洞利用",
hide: "隐藏",
placeholder: "输入命令...",
initialTerminal: [
"> 正在初始化网络战协议...",
"> 正在加载攻击向量...",
"> 系统准备就绪,可进行渗透测试"
]
}
};
let currentLang = 'en';
// Language switching function
function switchLanguage() {
currentLang = currentLang === 'en' ? 'zh' : 'en';
document.getElementById('lang-switch').innerHTML =
`<i class="fas fa-language"></i> ${currentLang === 'en' ? '中文' : 'English'}`;
// Update all text elements with data-trans attribute
const t = translations[currentLang];
document.querySelectorAll('[data-trans]').forEach(el => {
const key = el.getAttribute('data-trans');
if (t[key]) {
el.textContent = t[key];
}
});
// Update input placeholder
document.getElementById('terminal-input').placeholder = t.placeholder;
// Update terminal initial text
const terminal = document.getElementById('terminal-output');
terminal.innerHTML = t.initialTerminal.join('<br>') + '<br>> <span class="terminal-cursor">_</span>';
// Update buttons
document.getElementById('scan-btn').innerHTML = `<i class="fas fa-search"></i> ${t.scan}`;
document.getElementById('attack-btn').innerHTML = `<i class="fas fa-bolt"></i> ${t.attack}`;
document.querySelectorAll('.quick-action-btn').forEach((btn, i) => {
btn.innerHTML = `<i class="fas ${i === 0 ? 'fa-shield-alt' :
i === 1 ? 'fa-eye' :
i === 2 ? 'fa-bug' : 'fa-ghost'}"></i> ${[t.defend, t.monitor, t.exploit, t.hide][i]}`;
});
}
// Initialize
setupMatrixRain();
createNetwork();
updateResources();
// Set initial language
switchLanguage();
// Add data-trans attributes to elements
document.addEventListener('DOMContentLoaded', () => {
document.querySelector('span[data-trans="status"]') ||
document.querySelector('#status').previousElementSibling.setAttribute('data-trans', 'status');
document.querySelector('span[data-trans="online"]') ||
document.getElementById('status').setAttribute('data-trans', 'online');
document.querySelector('h2[data-trans="terminal"]') ||
document.querySelector('#terminal-output').parentElement.querySelector('h2').setAttribute('data-trans', 'terminal');
document.querySelector('h2[data-trans="networkMap"]') ||
document.querySelector('#network-canvas').parentElement.querySelector('h2').setAttribute('data-trans', 'networkMap');
document.querySelector('h2[data-trans="systemInfo"]') ||
document.querySelector('.border-l h2').setAttribute('data-trans', 'systemInfo');
document.querySelector('h3[data-trans="firewall"]') ||
document.querySelector('#firewall-bar').parentElement.querySelector('h3').setAttribute('data-trans', 'firewall');
document.querySelector('span[data-trans="protectionLevel"]') ||
document.querySelector('#firewall-level').previousElementSibling.setAttribute('data-trans', 'protectionLevel');
document.querySelector('h3[data-trans="attackLog"]') ||
document.querySelector('#attack-log').previousElementSibling.setAttribute('data-trans', 'attackLog');
document.querySelector('div[data-trans="noAttacks"]') ||
document.querySelector('#attack-log div').setAttribute('data-trans', 'noAttacks');
document.querySelector('h3[data-trans="resources"]') ||
document.querySelector('#cpu-usage').parentElement.parentElement.querySelector('h3').setAttribute('data-trans', 'resources');
document.querySelector('h3[data-trans="quickActions"]') ||
document.querySelector('.grid.grid-cols-2').previousElementSibling.setAttribute('data-trans', 'quickActions');
// Add quick-action-btn class to action buttons
document.querySelectorAll('.grid.grid-cols-2 button').forEach(btn => {
btn.classList.add('quick-action-btn');
});
// Add language switch event
document.getElementById('lang-switch').addEventListener('click', switchLanguage);
});
// Responsive canvas resize
window.addEventListener('resize', () => {
createNetwork();
});
// Show node info
function showNodeInfo(node) {
const terminal = document.getElementById('terminal-output');
terminal.innerHTML += `<br>> Node ${node.id} - Type: ${node.type === 'target' ? 'HIGH VALUE TARGET' : 'NORMAL NODE'}`;
terminal.scrollTop = terminal.scrollHeight;
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=xiaole0920/hacknet" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |