-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
195 lines (167 loc) · 6.01 KB
/
Copy pathscript.js
File metadata and controls
195 lines (167 loc) · 6.01 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
(function () {
// Terminal typing effect for tagline
var taglineEl = document.querySelector(".tagline");
if (taglineEl) {
var text = taglineEl.textContent;
taglineEl.textContent = "";
var index = 0;
var typingSpeed = 60;
var type = function () {
if (index < text.length) {
taglineEl.textContent += text.charAt(index);
index += 1;
setTimeout(type, typingSpeed);
}
};
type();
}
// Logo detection
var logoWrap = document.getElementById("logo-wrap");
var logoEl = document.getElementById("event-logo");
var faviconEl = document.getElementById("site-favicon");
if (logoWrap && logoEl) {
var candidates = [
"assets/kryptix-logo.png",
"assets/logo.png",
"assets/logo.jpg",
"assets/logo.jpeg",
"assets/logo.webp",
"kryptix-logo.png",
"logo.png"
];
var useLogo = function (src) {
logoEl.src = src;
logoWrap.classList.add("has-image");
logoWrap.classList.remove("missing-image");
if (faviconEl) {
faviconEl.href = src;
}
};
var testImage = function (src) {
return new Promise(function (resolve, reject) {
var probe = new Image();
probe.onload = function () {
resolve(src);
};
probe.onerror = function () {
reject(new Error("missing"));
};
probe.src = src;
});
};
var findFirstAvailable = async function () {
for (var i = 0; i < candidates.length; i += 1) {
try {
var found = await testImage(candidates[i]);
useLogo(found);
return;
} catch (err) {
continue;
}
}
logoWrap.classList.remove("has-image");
// Smooth scroll for top-nav links
var navLinks = document.querySelectorAll('.top-nav a');
if (navLinks && navLinks.length) {
navLinks.forEach(function (a) {
a.addEventListener('click', function (e) {
e.preventDefault();
var target = document.querySelector(this.getAttribute('href'));
if (target) {
window.scrollTo({ top: target.getBoundingClientRect().top + window.scrollY - 60, behavior: 'smooth' });
}
});
});
}
// Lightweight periodic heartbeat to nudge scroll-based animations (keeps page lively)
var heartbeat = function () {
var evt = new CustomEvent('kryptix-heartbeat', { detail: { time: Date.now() } });
window.dispatchEvent(evt);
};
setInterval(heartbeat, 12000);
logoWrap.classList.add("missing-image");
};
findFirstAvailable();
logoEl.addEventListener("error", function () {
logoWrap.classList.remove("has-image");
logoWrap.classList.add("missing-image");
});
}
// Real countdown timer
var timerEl = document.getElementById("fake-timer");
if (!timerEl) {
return;
}
var eventStartUtcMs = Date.UTC(2026, 4, 1, 13, 30, 0);
var renderTimeLeft = function () {
var now = Date.now();
var diffMs = eventStartUtcMs - now;
if (diffMs <= 0) {
timerEl.textContent = "Live or Starting Window Open";
return;
}
var totalSeconds = Math.floor(diffMs / 1000);
var days = Math.floor(totalSeconds / 86400);
var hours = Math.floor((totalSeconds % 86400) / 3600);
var minutes = Math.floor((totalSeconds % 3600) / 60);
var seconds = totalSeconds % 60;
var pad = function (value) {
return String(value).padStart(2, "0");
};
timerEl.textContent =
pad(days) + "d : " + pad(hours) + "h : " + pad(minutes) + "m : " + pad(seconds) + "s";
};
renderTimeLeft();
setInterval(renderTimeLeft, 1000);
// Hidden Challenge 5: The Ghost in the Protocol
// Obfuscated click counter with modulo-based trigger
var titleClicks = 0;
var ch5Clicked = false;
var titleEl = document.getElementById("kryptix-title");
if (titleEl) {
titleEl.addEventListener("click", function (e) {
titleClicks += 1;
// Obfuscated trigger: divisible by 7, but must have actual clicks
if ((titleClicks % 7 === 0 && titleClicks > 0) && !ch5Clicked) {
ch5Clicked = true;
// Subtle visual feedback
titleEl.style.textShadow = "0 0 20px rgba(212, 165, 116, 0.6)";
setTimeout(function() {
titleEl.style.textShadow = "";
}, 300);
// Show admin login prompt
var adminPass = prompt("⚠ ADMIN ACCESS PROTOCOL ⚠\n\nCredentials required:", "");
if (adminPass === "admin_axon") {
// Correct password: trigger hidden fetch to debug endpoint
// The flag is sent in custom response header
fetch("/api/v1/internal/debug-login", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Admin-Session": "verified_" + titleClicks
},
body: JSON.stringify({ auth: "admin_axon", timestamp: Date.now() })
}).then(function(response) {
// Extract custom header from response
var flagFromHeader = response.headers.get("X-Kryptix-Debug-Flag");
if (flagFromHeader) {
// Log to console for DevTools inspection
console.log("🐉 Ghost Protocol Intercepted:");
console.log("Flag Header: " + flagFromHeader);
// Also show in alert so user knows they got it
alert("🐉 PROTOCOL BREACH DETECTED 🐉\n\nInspect Network Tab Response Headers for: X-Kryptix-Debug-Flag\n\nCheck your DevTools to see the flag transmitted in HTTP headers.");
}
}).catch(function(err) {
// Expected to fail on static site, but we still got the console log
console.log("Debug request sent (expected 404 on static deployment)");
});
// Reset for next trigger
setTimeout(function() {
ch5Clicked = false;
}, 3000);
}
}
});
}
console.log("KRYPTIX hint: Decode what is hidden in plain markup, then follow the seventh arc.");
})();