-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsecurity.html
More file actions
403 lines (354 loc) · 13 KB
/
Copy pathsecurity.html
File metadata and controls
403 lines (354 loc) · 13 KB
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
<!doctype html>
<html>
<head>
<title>🔐🐜 - Ant Colony Security Dashboard</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="public/css/main.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.0/css/bulma.min.css">
<style>
.security-dashboard {
background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
min-height: 100vh;
color: #fff;
}
.hash-display {
font-family: 'Courier New', monospace;
background: rgba(0, 0, 0, 0.3);
border: 2px solid #00ff88;
border-radius: 8px;
padding: 20px;
margin: 20px 0;
box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}
.hash-value {
font-size: 1.2em;
word-break: break-all;
color: #00ff88;
text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}
.sensor-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin: 20px 0;
}
.sensor-card {
background: rgba(255, 255, 255, 0.1);
border-radius: 12px;
padding: 20px;
border: 1px solid rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
}
.activity-meter {
height: 20px;
background: linear-gradient(90deg, #ff4757, #ffa502, #2ed573);
border-radius: 10px;
margin: 10px 0;
position: relative;
overflow: hidden;
}
.activity-level {
height: 100%;
background: rgba(255, 255, 255, 0.8);
border-radius: 10px;
transition: width 0.3s ease;
}
.cv-feed {
background: rgba(0, 0, 0, 0.5);
border-radius: 8px;
padding: 15px;
margin: 20px 0;
max-height: 200px;
overflow-y: auto;
}
.cv-note {
padding: 5px 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
font-family: monospace;
}
.hash-history {
max-height: 300px;
overflow-y: auto;
background: rgba(0, 0, 0, 0.3);
border-radius: 8px;
padding: 15px;
}
.hash-entry {
padding: 8px;
margin: 5px 0;
background: rgba(255, 255, 255, 0.05);
border-radius: 4px;
font-family: monospace;
font-size: 0.9em;
}
.timestamp {
color: #74b9ff;
font-size: 0.8em;
}
.security-stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin: 20px 0;
}
.stat-card {
background: rgba(255, 255, 255, 0.1);
padding: 15px;
border-radius: 8px;
text-align: center;
}
.stat-value {
font-size: 2em;
font-weight: bold;
color: #00ff88;
}
.pulse {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.5; }
100% { opacity: 1; }
}
.matrix-bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
opacity: 0.1;
}
</style>
</head>
<body class="security-dashboard">
<canvas class="matrix-bg" id="matrixCanvas"></canvas>
<div id="securityApp">
<section class="section">
<div class="container">
<h1 class="title has-text-white">
🔐 Ant Colony Security Dashboard 🐜
</h1>
<div class="field is-grouped" style="margin-bottom: 20px;">
<p class="control">
<a class="button is-small is-light" href="/">
← Back to Main Dashboard
</a>
</p>
</div>
<div class="columns">
<div class="column is-8">
<div class="hash-display">
<h2 class="subtitle has-text-white">Current Security Hash</h2>
<div class="hash-value pulse" id="currentHash">
{{ currentSecurityHash }}
</div>
<p class="timestamp">
Generated: {{ new Date(lastHashUpdate).toLocaleString() }}
</p>
<p class="has-text-info">
Next update in: {{ Math.ceil((1000 - (Date.now() - lastHashUpdate) % 1000) / 1000) }}s
</p>
</div>
<div class="security-stats">
<div class="stat-card">
<div class="stat-value">{{ totalHashesGenerated }}</div>
<p>Total Hashes</p>
</div>
<div class="stat-card">
<div class="stat-value">{{ activeSensors }}</div>
<p>Active Sensors</p>
</div>
<div class="stat-card">
<div class="stat-value">{{ cvNotesCount }}</div>
<p>CV Notes</p>
</div>
<div class="stat-card">
<div class="stat-value">{{ securityLevel }}</div>
<p>Security Level</p>
</div>
</div>
<div class="sensor-grid">
<div class="sensor-card" v-for="sensor in sensorData" :key="sensor.id">
<h3 class="subtitle has-text-white">{{ sensor.name }}</h3>
<div class="activity-meter">
<div class="activity-level" :style="{ width: sensor.activity + '%' }"></div>
</div>
<p>Activity: {{ sensor.activity.toFixed(1) }}%</p>
<p>Last Reading: {{ sensor.lastValue }}</p>
<p class="timestamp">{{ new Date(sensor.timestamp).toLocaleTimeString() }}</p>
</div>
</div>
</div>
<div class="column is-4">
<div class="box" style="background: rgba(255, 255, 255, 0.1); border: none;">
<h3 class="subtitle has-text-white">CV Feed Notes</h3>
<div class="cv-feed">
<div class="cv-note" v-for="note in cvNotes.slice(0, 10)" :key="note.id">
<span class="timestamp">{{ new Date(note.timestamp).toLocaleTimeString() }}</span>
<br>{{ note.content }}
</div>
</div>
</div>
<div class="box" style="background: rgba(255, 255, 255, 0.1); border: none;">
<h3 class="subtitle has-text-white">Hash History</h3>
<div class="hash-history">
<div class="hash-entry" v-for="hash in hashHistory.slice(0, 20)" :key="hash.timestamp">
<div class="timestamp">{{ new Date(hash.timestamp).toLocaleString() }}</div>
<div style="font-size: 0.8em; color: #ddd;">{{ hash.value.substring(0, 32) }}...</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<div class="encryption-section" style="clear:both; padding: 20px;">
<section class="section">
<div class="container">
<h2 class="title">🔒 Ant Colony Encryption</h2>
<div class="columns">
<div class="column">
<div class="box">
<h3 class="subtitle">Encrypt File</h3>
<div class="field">
<div class="file has-name">
<label class="file-label">
<input class="file-input" type="file" id="fileToEncrypt">
<span class="file-cta">
<span class="file-label">Choose file...</span>
</span>
<span class="file-name" id="encryptFileName">
No file selected
</span>
</label>
</div>
</div>
<button class="button is-primary" id="encryptButton" disabled>
Encrypt with Current Hash
</button>
</div>
</div>
<div class="column">
<div class="box">
<h3 class="subtitle">Decrypt File</h3>
<div class="field">
<div class="file has-name">
<label class="file-label">
<input class="file-input" type="file" id="fileToDecrypt">
<span class="file-cta">
<span class="file-label">Choose encrypted file...</span>
</span>
<span class="file-name" id="decryptFileName">
No file selected
</span>
</label>
</div>
</div>
<div class="field">
<label class="label">Decryption Hash (optional)</label>
<div class="control">
<input class="input" type="text" id="decryptHashInput" placeholder="Paste hash here or leave empty to auto-detect">
</div>
<p class="help">If provided, this hash will be used instead of timestamp-based lookup</p>
</div>
<button class="button is-info" id="decryptButton" disabled>
Decrypt File
</button>
</div>
</div>
</div>
<div class="content">
<div class="notification is-info is-light">
<h4>How it works:</h4>
<ol>
<li>Every second, a new encryption hash is generated based on the ant colony's activity</li>
<li>Files are encrypted using the current hash when you click "Encrypt"</li>
<li>To decrypt, you can either:
<ul>
<li><strong>Auto-detect:</strong> Use files with timestamps in the filename</li>
<li><strong>Manual hash:</strong> Paste the exact hash used for encryption</li>
<li><strong>Timestamp lookup:</strong> Enter the encryption timestamp manually</li>
</ul>
</li>
<li>Hashes are stored for approximately 16 hours for automatic lookup</li>
<li>Share both the encrypted file AND either the hash or timestamp for others to decrypt</li>
</ol>
</div>
</div>
<div class="current-hash">
<p>Current Hash: <code id="currentHashDisplay">Loading...</code></p>
<p>Updated: <span id="currentHashTimestamp">Loading...</span></p>
</div>
<!-- Encryption Records Section -->
<div class="box" style="margin-top: 20px;">
<h3 class="subtitle">🗂️ Encryption Records</h3>
<div id="encryptionRecords" style="max-height: 300px; overflow-y: auto;">
<p class="has-text-grey">No encryption records yet...</p>
</div>
<button class="button is-small is-warning" id="clearRecordsButton">
Clear Records
</button>
</div>
</div>
</section>
</div>
<script src="/socket.io/socket.io.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="public/js/encryption.js"></script>
<script src="public/js/security-dashboard.js"></script>
<script src="public/js/encryption-ui.js"></script>
<script>
// Matrix rain effect
const canvas = document.getElementById('matrixCanvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const matrix = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789@#$%^&*()*&^%+-/~{[|`]}";
const matrixArray = matrix.split("");
const fontSize = 10;
const columns = canvas.width / fontSize;
const drops = [];
for(let x = 0; x < columns; x++) {
drops[x] = 1;
}
function drawMatrix() {
ctx.fillStyle = 'rgba(0, 0, 0, 0.04)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = '#00ff88';
ctx.font = fontSize + 'px arial';
for(let i = 0; i < drops.length; i++) {
const text = matrixArray[Math.floor(Math.random() * matrixArray.length)];
ctx.fillText(text, i * fontSize, drops[i] * fontSize);
if(drops[i] * fontSize > canvas.height && Math.random() > 0.975) {
drops[i] = 0;
}
drops[i]++;
}
}
setInterval(drawMatrix, 35);
window.addEventListener('resize', () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
});
// Update hash display elements
function updateHashDisplay() {
if (window.securityApp && window.securityApp.currentSecurityHash) {
const hashDisplay = document.getElementById('currentHashDisplay');
const timestampDisplay = document.getElementById('currentHashTimestamp');
if (hashDisplay) {
hashDisplay.textContent = window.securityApp.currentSecurityHash;
}
if (timestampDisplay) {
timestampDisplay.textContent = new Date(window.securityApp.lastHashUpdate).toLocaleString();
}
}
}
// Update hash display every second
setInterval(updateHashDisplay, 1000);
// Initial update after a short delay to ensure Vue app is loaded
setTimeout(updateHashDisplay, 2000);
</script>
</body>
</html>