xiaole0920 commited on
Commit
0e13845
·
verified ·
1 Parent(s): 205c050

点击中文按钮后并没有切换页面语言的效果 - Initial Deployment

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