-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgridlocker.html
More file actions
677 lines (632 loc) · 24.7 KB
/
gridlocker.html
File metadata and controls
677 lines (632 loc) · 24.7 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
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
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gridlocker</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
background: #000000;
font-family: 'Courier New', monospace;
color: #00ff00;
min-height: 100vh;
}
.app-container {
width: 100%;
max-width: 300px;
display: flex;
flex-direction: column;
align-items: center;
padding: 10px 0;
position: relative;
}
.hologram-container {
width: 300px;
height: 240px;
position: relative;
overflow: hidden;
z-index: 1;
}
.hologram {
width: 300px;
height: 240px;
position: absolute;
top: 0;
left: 0;
transform-style: preserve-3d;
animation: rotateHologram 30s infinite linear;
}
.grid-base {
position: absolute;
width: 100%;
height: 100%;
background: linear-gradient(135deg, #00ff00, #00cc00);
opacity: 0.5;
}
.grid-layer {
position: absolute;
width: 100%;
height: 100%;
background: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(0, 255, 0, 0.5) 8px, rgba(0, 255, 0, 0.5) 10px);
animation: shiftGrid 10s infinite linear;
}
.grid-wireframe {
position: absolute;
width: 100%;
height: 100%;
border: 1px solid #00ff00;
}
.grid-plane {
position: absolute;
background: rgba(0, 255, 0, 0.2);
border: 1px solid #00ff00;
animation: pulsePlane 5s infinite;
}
.neural-dot {
position: absolute;
border-radius: 50%;
box-shadow: 0 0 5px currentColor;
animation: pulseDot 2s infinite;
}
.neural-line {
position: absolute;
height: 1px;
transform-origin: 0 0;
opacity: 0.5;
}
.button-container {
display: flex;
gap: 8px;
margin: 10px 0;
z-index: 1;
}
.btn {
padding: 8px 14px;
font-size: 12px;
color: #000000;
background: #00ff00;
border: none;
cursor: pointer;
font-family: 'Courier New', monospace;
}
.console-section {
width: 100%;
max-width: 300px;
margin: 10px 0;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
z-index: 0;
}
.console-section #consoleOutput {
margin-top: 5px;
font-size: 12px;
color: #00ff00;
word-wrap: break-word;
max-width: 300px;
width: 100%;
box-sizing: border-box;
}
.file-upload {
margin: 10px 0;
display: flex;
align-items: center;
gap: 8px;
}
.file-upload input[type="file"] {
display: none;
}
.file-upload label {
padding: 12px 24px;
background: #00ff00;
color: #000000;
border: none;
cursor: pointer;
font-size: 14px;
display: inline-block;
box-shadow: 0 0 15px #00ff00;
transition: all 0.3s ease;
font-family: 'Courier New', monospace;
}
.file-upload label:hover {
background: #00cc00;
box-shadow: 0 0 25px #00ff00;
}
.file-upload span {
font-size: 12px;
color: #00ff00;
}
.wallet-popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 180px;
padding: 12px;
background: #000000;
border: 1px solid #00ff00;
color: #00ff00;
font-family: 'Courier New', monospace;
font-size: 12px;
z-index: 1000;
}
.wallet-popup h3 {
margin: 0 0 10px;
font-size: 14px;
}
.wallet-popup textarea {
width: 100%;
height: 60px;
padding: 6px;
background: #000000;
border: 1px solid #00ff00;
color: #00ff00;
font-family: 'Courier New', monospace;
font-size: 12px;
margin-bottom: 8px;
}
.wallet-popup .btn {
width: 100%;
margin: 5px 0 0;
padding: 8px 14px;
}
.popup-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
z-index: 999;
}
footer {
width: 100%;
max-width: 300px;
text-align: center;
font-size: 10px;
color: #00ff00;
margin-top: 10px;
}
#data-store {
display: none;
}
@media (max-width: 320px) {
.app-container, .console-section, footer {
max-width: 100%;
padding: 5px;
}
.hologram-container {
width: 100%;
height: auto;
aspect-ratio: 5 / 4;
}
.hologram {
width: 100%;
height: 100%;
left: 0;
}
.console-section #consoleOutput {
max-width: 100%;
}
.file-upload label {
padding: 10px 20px;
font-size: 12px;
}
}
@keyframes rotateHologram {
0% { transform: rotateY(0deg) rotateX(15deg); }
100% { transform: rotateY(360deg) rotateX(15deg); }
}
@keyframes shiftGrid {
0% { background-position: 0 0; }
100% { background-position: 80px 80px; }
}
@keyframes pulsePlane {
0%, 100% { transform: scale(1) translateZ(0); }
50% { transform: scale(1.1) translateZ(12px); }
}
@keyframes pulseDot {
0%, 100% { transform: scale(1); opacity: 0.7; }
50% { transform: scale(1.2); opacity: 1; }
}
</style>
</head>
<body>
<div class="app-container">
<div class="hologram-container">
<div class="hologram" id="hologram"></div>
</div>
<div class="console-section">
<div class="file-upload">
<label for="fileInput" class="btn">Upload File</label>
<input type="file" id="fileInput">
<span id="fileName"></span>
</div>
<div id="consoleOutput"></div>
</div>
<div class="button-container">
<button class="btn" onclick="showWalletPopup()">Wallet</button>
<button class="btn" onclick="clearConsole()">Clear</button>
</div>
</div>
<div class="popup-overlay" id="walletOverlay"></div>
<div class="wallet-popup" id="walletPopup">
<h3>Wallet</h3>
<button class="btn" onclick="generateSerial()">Generate</button>
<textarea id="walletInput" placeholder="Enter serial (e.g., GRID-XXXXXXXXXXXXX)"></textarea>
<button class="btn" onclick="executeGrid()">Load</button>
<button class="btn" onclick="closeWalletPopup()">Cancel</button>
</div>
<div id="data-store"></div>
<footer>
© WebXOS 2025<br>
Usage: Upload a small file (up to 1.0 MB) to create a Gridlocker. Wallet generates or loads the serial for Gridlocker. Clear resets Gridlocker. Use at your own risk.
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
<script>
const hologram = document.getElementById('hologram');
const consoleOutput = document.getElementById('consoleOutput');
const fileInput = document.getElementById('fileInput');
const fileNameDisplay = document.getElementById('fileName');
const walletPopup = document.getElementById('walletPopup');
const walletOverlay = document.getElementById('walletOverlay');
const walletInput = document.getElementById('walletInput');
const dataStore = document.getElementById('data-store');
let currentSerial = '';
let currentFile = null;
let currentData = '';
// Static AES key (emulating Sacred)
const AES_KEY = 'grid-locker-secure-key-2025';
const COLORS = ['#00FF00', '#FF00FF', '#00FFFF', '#FF0000']; // Neon green, purple, blue, red
function hashCode(str) {
let hash = 2166136261;
for (let i = 0; i < str.length; i++) {
hash ^= str.charCodeAt(i);
hash *= 16777619;
}
return Math.abs(hash);
}
function compressData(data) {
try {
const binary = new TextEncoder().encode(data);
const compressed = pako.deflate(binary);
return btoa(String.fromCharCode.apply(null, compressed));
} catch (e) {
console.error('Compression failed:', e);
throw new Error('Compression failed: ' + e.message);
}
}
function decompressData(compressed) {
try {
const binary = atob(compressed).split('').map(c => c.charCodeAt(0));
const decompressed = pako.inflate(binary, { to: 'string' });
return decompressed;
} catch (e) {
console.error('Decompression failed:', e);
throw new Error('Decompression failed: ' + e.message);
}
}
function encryptData(data) {
try {
return CryptoJS.AES.encrypt(data, AES_KEY).toString();
} catch (e) {
console.error('Encryption failed:', e);
throw new Error('Encryption failed: ' + e.message);
}
}
function decryptData(encrypted) {
try {
const bytes = CryptoJS.AES.decrypt(encrypted, AES_KEY);
const decrypted = bytes.toString(CryptoJS.enc.Utf8);
if (!decrypted) throw new Error('Decrypted data is empty');
return decrypted;
} catch (e) {
console.error('Decryption failed:', e);
throw new Error('Decryption failed: ' + e.message);
}
}
function generateSerialNumber() {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
let result = '';
for (let i = 0; i < 13; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
return `GRID-${result}`;
}
function formatFileSize(bytes) {
if (bytes < 1024) return bytes + ' B';
else if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
else return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
}
function generateNeuralNetwork(seed, dataLength) {
const nodes = [];
const edges = [];
const hash = hashCode(seed);
const width = 300, height = 240; // Full container size
const clusterCount = Math.min(4, 1 + Math.floor(dataLength / (2 * 1024 * 1024))); // 1-4 clusters
const nodeCount = Math.min(30, 10 + Math.floor(dataLength / (512 * 1024))); // Up to 30 nodes
const centroids = [];
// Generate cluster centroids
for (let i = 0; i < clusterCount; i++) {
centroids.push({
x: Math.random() * width,
y: Math.random() * height
});
}
// Generate nodes around centroids
for (let i = 0; i < nodeCount; i++) {
const centroid = centroids[i % clusterCount];
const angle = (hash + i * 12345) % 360;
const radius = Math.random() * 30; // Cluster spread
const x = Math.max(0, Math.min(width, centroid.x + radius * Math.cos(angle * Math.PI / 180)));
const y = Math.max(0, Math.min(height, centroid.y + radius * Math.sin(angle * Math.PI / 180)));
const size = 3 + ((hash + i * 45678) % 4);
const z = ((hash + i * 78901) % 80) - 40; // 3D depth: -40 to 40px
const color = COLORS[(Math.floor(dataLength / (2 * 1024 * 1024)) + i) % COLORS.length];
nodes.push({ x, y, size, z, color });
}
// Generate edges within clusters
for (let i = 0; i < nodes.length; i++) {
for (let j = i + 1; j < nodes.length; j++) {
const dist = Math.sqrt((nodes[i].x - nodes[j].x) ** 2 + (nodes[i].y - nodes[j].y) ** 2);
if (dist < 60 && Math.random() < 0.5) {
edges.push({ from: nodes[i], to: nodes[j] });
}
}
}
return { nodes, edges };
}
function renderGrid(seed, serial, fileData = null, dataLength = 0, showSerial = true) {
hologram.innerHTML = '';
hologram.classList.remove('revealed');
const hash = hashCode(seed);
const rand = (min, max) => min + (hash % (max - min + 1));
const randFloat = (min, max) => min + ((hash % 10000) / 10000) * (max - min);
const gridBase = document.createElement('div');
gridBase.className = 'grid-base';
gridBase.style.opacity = randFloat(0.4, 0.6);
hologram.appendChild(gridBase);
const layerCount = rand(2, 4);
for (let i = 0; i < layerCount; i++) {
const layer = document.createElement('div');
layer.className = 'grid-layer';
const z = randFloat(-60, 60) * (i + 1) / layerCount;
layer.style.cssText = `
transform: translateZ(${z}px) rotateY(${randFloat(-12, 12)}deg) rotateX(${randFloat(-12, 12)}deg);
opacity: ${randFloat(0.3, 0.7)};
`;
hologram.appendChild(layer);
}
const wireframeCount = rand(1, 2);
for (let i = 0; i < wireframeCount; i++) {
const wireframe = document.createElement('div');
wireframe.className = 'grid-wireframe';
const z = randFloat(-50, 50);
const scale = randFloat(0.8, 1.1);
wireframe.style.cssText = `
transform: translateZ(${z}px) scale(${scale}) rotateX(${randFloat(-20, 20)}deg) rotateY(${randFloat(-20, 20)}deg);
opacity: ${randFloat(0.5, 0.9)};
`;
hologram.appendChild(wireframe);
}
const planeCount = rand(2, 3);
for (let i = 0; i < planeCount; i++) {
const plane = document.createElement('div');
plane.className = 'grid-plane';
const width = randFloat(40, 120);
const height = randFloat(40, 120);
const left = randFloat(0, 100 - (width / 1.8));
const top = randFloat(0, 100 - (height / 1.8));
const z = randFloat(-80, 80);
plane.style.cssText = `
width: ${width}px;
height: ${height}px;
left: ${left}%;
top: ${top}%;
transform: translateZ(${z}px) rotateX(${randFloat(-35, 35)}deg) rotateY(${randFloat(-35, 35)}deg);
`;
hologram.appendChild(plane);
}
const { nodes, edges } = generateNeuralNetwork(seed, dataLength);
nodes.forEach(node => {
const dot = document.createElement('div');
dot.className = 'neural-dot';
dot.style.cssText = `
left: ${node.x}px;
top: ${node.y}px;
width: ${node.size}px;
height: ${node.size}px;
transform: translateZ(${node.z}px);
background: ${node.color};
color: ${node.color};
z-index: ${Math.round(node.z + 40)};
`;
hologram.appendChild(dot);
});
edges.forEach(edge => {
const dx = edge.to.x - edge.from.x;
const dy = edge.to.y - edge.from.y;
const length = Math.sqrt(dx * dx + dy * dy);
const angle = Math.atan2(dy, dx) * 180 / Math.PI;
const lineColor = edge.from.color;
const line = document.createElement('div');
line.className = 'neural-line';
line.style.cssText = `
left: ${edge.from.x}px;
top: ${edge.from.y}px;
width: ${length}px;
transform: rotate(${angle}deg) translateZ(${randFloat(-20, 20)}px);
background: ${lineColor};
z-index: ${Math.round((edge.from.z + edge.to.z) / 2 + 40)};
`;
hologram.appendChild(line);
});
let outputText = '';
if (fileData) {
const timestamp = new Date(fileData.timestamp).toLocaleString();
outputText = `File: <a href="${fileData.data}" download="${fileData.name}" style="color: #00ff00;">${fileData.name}</a> (${fileData.type}, ${formatFileSize(fileData.size)}, ${timestamp})`;
}
if (showSerial && serial) {
outputText = `${serial}${fileData ? '\n' + outputText : ''}`;
}
consoleOutput.innerHTML = outputText;
setTimeout(() => {
hologram.classList.add('revealed');
}, 100);
}
async function generateGrid(file) {
try {
if (!file) {
throw new Error('No file selected');
}
if (file.size > 10 * 1024 * 1024) {
alert('File size exceeds 10 MB limit!');
return;
}
const fileData = await new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
if (!reader.result) {
reject(new Error('File read resulted in empty data'));
} else {
resolve({
name: file.name,
type: file.type,
size: file.size,
data: reader.result,
timestamp: Date.now()
});
}
};
reader.onerror = () => reject(new Error('Failed to read file'));
reader.readAsDataURL(file);
});
const serial = generateSerialNumber();
const data = JSON.stringify({ fileData });
const compressed = compressData(data);
const compressedLength = compressed.length;
const encrypted = encryptData(compressed);
const serialKey = `${serial}-${btoa(encrypted)}`;
if (serialKey.length > 1000000) {
alert('Generated serial key is too large. Try a smaller file.');
return;
}
// Store encrypted data in CSS
const escapedData = btoa(encrypted).replace(/[^a-zA-Z0-9]/g, '_');
const styleSheet = document.styleSheets[0];
try {
styleSheet.insertRule(`#data-store::before { content: "${escapedData}"; }`, styleSheet.cssRules.length);
} catch (e) {
console.error('Failed to insert CSS rule:', e);
}
currentSerial = serialKey;
currentFile = file;
currentData = encrypted;
renderGrid(serial, serialKey, fileData, compressedLength, false);
fileNameDisplay.textContent = `${fileData.name} (${formatFileSize(fileData.size)})`;
} catch (e) {
alert('Error generating grid: ' + e.message);
console.error('Generate error:', e);
consoleOutput.textContent = '';
}
}
function showWalletPopup() {
walletInput.value = '';
walletPopup.style.display = 'block';
walletOverlay.style.display = 'block';
}
function closeWalletPopup() {
walletPopup.style.display = 'none';
walletOverlay.style.display = 'none';
}
function generateSerial() {
if (!currentData) {
alert('Upload a file first!');
return;
}
const serialKey = currentSerial;
navigator.clipboard.writeText(serialKey).then(() => {
alert('Serial key copied!');
}).catch(err => {
alert('Failed to copy: ' + err);
});
closeWalletPopup();
}
function executeGrid() {
const userInput = walletInput.value.trim();
if (!userInput) {
alert('Please enter a serial key!');
consoleOutput.textContent = '';
return;
}
if (!userInput.match(/GRID-[A-Z0-9]{13}-/)) {
alert('Invalid serial format! Use e.g., GRID-XXXXXXXXXXXXX-<data>');
consoleOutput.textContent = '';
return;
}
try {
const parts = userInput.split('-');
const encodedData = parts.slice(2).join('-');
const encrypted = atob(encodedData);
const compressed = decryptData(encrypted);
const data = JSON.parse(decompressData(compressed));
const { fileData } = data;
// Store encrypted data in CSS
const escapedData = btoa(encrypted).replace(/[^a-zA-Z0-9]/g, '_');
const styleSheet = document.styleSheets[0];
try {
styleSheet.insertRule(`#data-store::before { content: "${escapedData}"; }`, styleSheet.cssRules.length);
} catch (e) {
console.error('Failed to insert CSS rule:', e);
}
currentSerial = userInput;
currentFile = fileData;
currentData = encrypted;
renderGrid(userInput, userInput, fileData, compressed.length, false);
fileNameDisplay.textContent = `${fileData.name} (${formatFileSize(fileData.size)})`;
closeWalletPopup();
} catch (e) {
alert('Error processing serial key: ' + e.message);
console.error('Execute error:', e);
consoleOutput.textContent = '';
}
}
function clearConsole() {
fileInput.value = '';
fileNameDisplay.textContent = '';
consoleOutput.textContent = '';
currentFile = null;
currentSerial = '';
currentData = '';
dataStore.innerHTML = '';
const initSerial = `GRID-0000000000000`;
renderGrid(initSerial, initSerial, null, 0, true);
consoleOutput.textContent = initSerial;
}
fileInput.addEventListener('change', async (e) => {
if (e.target.files.length > 0) {
const file = e.target.files[0];
await generateGrid(file);
} else {
fileNameDisplay.textContent = '';
consoleOutput.textContent = '';
}
});
window.addEventListener('load', () => {
const initSerial = `GRID-0000000000000`;
renderGrid(initSerial, initSerial, null, 0, true);
consoleOutput.textContent = initSerial;
currentSerial = initSerial;
});
</script>
</body>
</html>