Update index.html
Browse files- index.html +474 -368
index.html
CHANGED
@@ -1,369 +1,475 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
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 |
</html>
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Adware Defense Game</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.js"></script>
|
9 |
+
<style>
|
10 |
+
body {
|
11 |
+
font-family: 'Inter', sans-serif;
|
12 |
+
overscroll-behavior: none; /* Prevents pull-to-refresh on mobile */
|
13 |
+
}
|
14 |
+
.chat-bubble {
|
15 |
+
max-width: 70%;
|
16 |
+
padding: 10px 15px;
|
17 |
+
border-radius: 20px;
|
18 |
+
margin-bottom: 10px;
|
19 |
+
word-wrap: break-word;
|
20 |
+
}
|
21 |
+
.user-bubble {
|
22 |
+
background-color: #DCF8C6; /* Light green */
|
23 |
+
align-self: flex-end;
|
24 |
+
margin-left: auto;
|
25 |
+
}
|
26 |
+
.friend-bubble {
|
27 |
+
background-color: #E5E7EB; /* Light gray */
|
28 |
+
align-self: flex-start;
|
29 |
+
}
|
30 |
+
.ad-bubble {
|
31 |
+
background-color: #FECACA; /* Light red */
|
32 |
+
border: 2px dashed #F87171; /* Red border */
|
33 |
+
align-self: center;
|
34 |
+
width: 80%;
|
35 |
+
text-align: center;
|
36 |
+
animation: fadeIn 0.5s ease-out;
|
37 |
+
}
|
38 |
+
@keyframes fadeIn {
|
39 |
+
from { opacity: 0; transform: translateY(10px); }
|
40 |
+
to { opacity: 1; transform: translateY(0); }
|
41 |
+
}
|
42 |
+
.device-icon {
|
43 |
+
font-size: 3rem; /* Increased size */
|
44 |
+
margin-bottom: 0.5rem;
|
45 |
+
}
|
46 |
+
.control-button {
|
47 |
+
padding: 0.75rem 1.5rem;
|
48 |
+
border-radius: 0.5rem;
|
49 |
+
font-weight: 600;
|
50 |
+
transition: all 0.2s ease-in-out;
|
51 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
52 |
+
}
|
53 |
+
.control-button:hover {
|
54 |
+
transform: translateY(-2px);
|
55 |
+
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
56 |
+
}
|
57 |
+
.control-button:active {
|
58 |
+
transform: translateY(0px);
|
59 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
60 |
+
}
|
61 |
+
.info-panel {
|
62 |
+
background-color: rgba(0,0,0,0.75);
|
63 |
+
color: white;
|
64 |
+
padding: 2rem;
|
65 |
+
border-radius: 1rem;
|
66 |
+
position: fixed;
|
67 |
+
top: 50%;
|
68 |
+
left: 50%;
|
69 |
+
transform: translate(-50%, -50%);
|
70 |
+
z-index: 100;
|
71 |
+
width: 90%;
|
72 |
+
max-width: 600px;
|
73 |
+
text-align: center;
|
74 |
+
box-shadow: 0 10px 25px rgba(0,0,0,0.3);
|
75 |
+
}
|
76 |
+
.info-panel h2 {
|
77 |
+
font-size: 2rem; /* Larger font for heading */
|
78 |
+
margin-bottom: 1rem;
|
79 |
+
}
|
80 |
+
.info-panel p, .info-panel li {
|
81 |
+
font-size: 1.1rem; /* Larger font for text */
|
82 |
+
line-height: 1.6;
|
83 |
+
}
|
84 |
+
.game-title {
|
85 |
+
font-size: 2.5rem; /* Increased title font size */
|
86 |
+
font-weight: bold;
|
87 |
+
margin-bottom: 1rem;
|
88 |
+
color: #1E40AF; /* Dark blue */
|
89 |
+
}
|
90 |
+
.step-title {
|
91 |
+
font-size: 1.5rem; /* Increased step title font size */
|
92 |
+
font-weight: 600;
|
93 |
+
margin-bottom: 1rem;
|
94 |
+
color: #1D4ED8; /* Medium blue */
|
95 |
+
}
|
96 |
+
.highlight-box {
|
97 |
+
border: 3px dashed #F59E0B; /* Amber color */
|
98 |
+
padding: 1rem;
|
99 |
+
border-radius: 0.5rem;
|
100 |
+
margin-top: 1rem;
|
101 |
+
background-color: #FFFBEB; /* Light yellow */
|
102 |
+
}
|
103 |
+
.mermaid-diagram-container {
|
104 |
+
background-color: white;
|
105 |
+
padding: 1rem;
|
106 |
+
border-radius: 0.5rem;
|
107 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
108 |
+
margin: 1rem 0;
|
109 |
+
overflow-x: auto; /* For wider diagrams on small screens */
|
110 |
+
}
|
111 |
+
/* Ensure mermaid diagram text is visible */
|
112 |
+
.mermaid svg text {
|
113 |
+
fill: #111827 !important; /* Dark gray for text */
|
114 |
+
stroke: none !important;
|
115 |
+
font-size: 16px !important; /* Larger font for mermaid diagram */
|
116 |
+
}
|
117 |
+
.mermaid svg .label {
|
118 |
+
font-size: 16px !important;
|
119 |
+
}
|
120 |
+
.mermaid svg .actor {
|
121 |
+
fill: #BFDBFE !important; /* Light blue for actors */
|
122 |
+
stroke: #3B82F6 !important; /* Blue border */
|
123 |
+
}
|
124 |
+
.mermaid svg .messageText, .mermaid svg .noteText {
|
125 |
+
font-size: 14px !important; /* Slightly smaller for message/note text for balance */
|
126 |
+
}
|
127 |
+
|
128 |
+
</style>
|
129 |
+
</head>
|
130 |
+
<body class="bg-gradient-to-br from-blue-100 via-indigo-50 to-purple-100 min-h-screen flex flex-col items-center justify-center p-4 overflow-hidden">
|
131 |
+
|
132 |
+
<div id="gameContainer" class="w-full max-w-4xl bg-white p-6 rounded-xl shadow-2xl">
|
133 |
+
<h1 class="game-title text-center">🛡️ Adware Defense Sim 🛡️</h1>
|
134 |
+
<p class="text-center text-gray-600 mb-6 text-lg">Experience how adware can inject ads and how to stay vigilant!</p>
|
135 |
+
|
136 |
+
<div id="stepIndicator" class="text-center mb-4">
|
137 |
+
<span id="currentStep" class="text-xl font-bold text-indigo-600">Step 1</span> / 10
|
138 |
+
</div>
|
139 |
+
|
140 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
|
141 |
+
<!-- PC View -->
|
142 |
+
<div class="border p-4 rounded-lg bg-gray-50 shadow-md">
|
143 |
+
<h2 class="step-title text-center">💻 Your PC (Chrome Browser)</h2>
|
144 |
+
<div class="device-icon text-center">🖥️</div>
|
145 |
+
<div id="pcChatArea" class="h-64 overflow-y-auto p-2 border rounded bg-white flex flex-col space-y-2">
|
146 |
+
<!-- Chat messages will appear here -->
|
147 |
+
</div>
|
148 |
+
<input type="text" id="pcMessageInput" placeholder="Type a message..." class="w-full mt-2 p-2 border rounded focus:ring-2 focus:ring-blue-500 focus:border-transparent">
|
149 |
+
<div id="pcInfo" class="text-sm text-gray-500 mt-2"></div>
|
150 |
+
</div>
|
151 |
+
|
152 |
+
<!-- Android Phone View -->
|
153 |
+
<div class="border p-4 rounded-lg bg-gray-50 shadow-md">
|
154 |
+
<h2 class="step-title text-center">📱 Your Android Phone (Fold2)</h2>
|
155 |
+
<div class="device-icon text-center">📱</div>
|
156 |
+
<div id="phoneChatArea" class="h-64 overflow-y-auto p-2 border rounded bg-white flex flex-col space-y-2">
|
157 |
+
<!-- Chat messages will appear here -->
|
158 |
+
</div>
|
159 |
+
<div id="phoneInfo" class="text-sm text-gray-500 mt-2"></div>
|
160 |
+
</div>
|
161 |
+
</div>
|
162 |
+
|
163 |
+
<div id="gameMessage" class="text-center text-lg font-semibold my-4 p-3 bg-yellow-100 border border-yellow-300 rounded-lg text-yellow-800">
|
164 |
+
Welcome! Click "Next Step" to begin the simulation.
|
165 |
+
</div>
|
166 |
+
|
167 |
+
<div class="text-center mt-6">
|
168 |
+
<button id="nextStepButton" class="control-button bg-blue-600 hover:bg-blue-700 text-white">
|
169 |
+
Next Step 🚀
|
170 |
+
</button>
|
171 |
+
</div>
|
172 |
+
|
173 |
+
<div id="mermaidContainer" class="mermaid-diagram-container hidden mt-8">
|
174 |
+
<h3 class="text-xl font-semibold text-center mb-2">Attack Flow Visualization</h3>
|
175 |
+
<pre class="mermaid" id="mermaidDiagram">
|
176 |
+
// Diagram will be populated by JS
|
177 |
+
</pre>
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
|
181 |
+
<!-- Info Panel / Modal -->
|
182 |
+
<div id="infoPanel" class="info-panel hidden">
|
183 |
+
<h2 id="infoPanelTitle">Information</h2>
|
184 |
+
<div id="infoPanelContent" class="text-left"></div>
|
185 |
+
<button id="infoPanelCloseButton" class="control-button bg-green-500 hover:bg-green-600 text-white mt-6">Got it!</button>
|
186 |
+
</div>
|
187 |
+
|
188 |
+
|
189 |
+
<script>
|
190 |
+
// Initialize Mermaid
|
191 |
+
mermaid.initialize({ startOnLoad: false, theme: 'base', securityLevel: 'loose',
|
192 |
+
fontFamily: 'Inter, sans-serif',
|
193 |
+
themeVariables: {
|
194 |
+
primaryColor: '#EFF6FF', // Lightest blue
|
195 |
+
primaryTextColor: '#111827', // Dark Gray
|
196 |
+
primaryBorderColor: '#60A5FA', // Medium Blue
|
197 |
+
lineColor: '#3B82F6', // Blue
|
198 |
+
secondaryColor: '#DBEAFE', // Lighter blue
|
199 |
+
tertiaryColor: '#BFDBFE' // Even lighter blue
|
200 |
+
}
|
201 |
+
});
|
202 |
+
|
203 |
+
const pcChatArea = document.getElementById('pcChatArea');
|
204 |
+
const phoneChatArea = document.getElementById('phoneChatArea');
|
205 |
+
const pcMessageInput = document.getElementById('pcMessageInput');
|
206 |
+
const nextStepButton = document.getElementById('nextStepButton');
|
207 |
+
const gameMessage = document.getElementById('gameMessage');
|
208 |
+
const currentStepEl = document.getElementById('currentStep');
|
209 |
+
const pcInfo = document.getElementById('pcInfo');
|
210 |
+
const phoneInfo = document.getElementById('phoneInfo');
|
211 |
+
|
212 |
+
const mermaidContainer = document.getElementById('mermaidContainer');
|
213 |
+
const mermaidDiagramEl = document.getElementById('mermaidDiagram');
|
214 |
+
|
215 |
+
const infoPanel = document.getElementById('infoPanel');
|
216 |
+
const infoPanelTitle = document.getElementById('infoPanelTitle');
|
217 |
+
const infoPanelContent = document.getElementById('infoPanelContent');
|
218 |
+
const infoPanelCloseButton = document.getElementById('infoPanelCloseButton');
|
219 |
+
|
220 |
+
let step = 0;
|
221 |
+
const totalSteps = 10;
|
222 |
+
|
223 |
+
const steps = [
|
224 |
+
// Step 1: User on PC types a message
|
225 |
+
() => {
|
226 |
+
gameMessage.textContent = "STEP 1: You're on your PC using Google Messages for web. Type a friendly message to your contact (e.g., 'Hello!') and imagine pressing Enter.";
|
227 |
+
pcMessageInput.value = "Hello from my PC! 👋";
|
228 |
+
pcMessageInput.focus();
|
229 |
+
pcInfo.innerHTML = "💡 Google Messages for web syncs with your phone.";
|
230 |
+
},
|
231 |
+
// Step 2: Message "sent" to Android device
|
232 |
+
() => {
|
233 |
+
const msgText = pcMessageInput.value || "Hello from my PC! 👋";
|
234 |
+
addChatMessage(pcChatArea, msgText, 'user');
|
235 |
+
gameMessage.textContent = "STEP 2: Message 'sent'! It appears on your PC and syncs to your Android phone via Google's servers (simulated Wi-Fi sync).";
|
236 |
+
setTimeout(() => {
|
237 |
+
addChatMessage(phoneChatArea, msgText, 'user');
|
238 |
+
phoneInfo.innerHTML = "📱 Message received from PC via sync!";
|
239 |
+
}, 500);
|
240 |
+
pcMessageInput.value = "";
|
241 |
+
},
|
242 |
+
// Step 3: User on PC pastes a link
|
243 |
+
() => {
|
244 |
+
gameMessage.textContent = "STEP 3: Now, you paste a link into the chat on your PC. Let's say it's a link to a cool Hugging Face Space that shows an HTML component (e.g., from a YAML config).";
|
245 |
+
pcMessageInput.value = "https://huggingface.co/spaces/cool-project/app";
|
246 |
+
pcInfo.innerHTML = "🔗 Pasting a link often generates a preview.";
|
247 |
+
},
|
248 |
+
// Step 4: Link preview appears normally
|
249 |
+
() => {
|
250 |
+
const linkText = pcMessageInput.value || "https://huggingface.co/spaces/cool-project/app";
|
251 |
+
addChatMessage(pcChatArea, `Pasted Link: ${linkText}`, 'user');
|
252 |
+
// Simulate link preview
|
253 |
+
const previewBubble = document.createElement('div');
|
254 |
+
previewBubble.className = 'chat-bubble user-bubble';
|
255 |
+
previewBubble.innerHTML = `
|
256 |
+
<p class="font-semibold">Preview: Cool Project App</p>
|
257 |
+
<p class="text-xs text-gray-600">${linkText}</p>
|
258 |
+
<div class="mt-1 p-2 border border-gray-300 rounded bg-gray-100">✨ Interactive HTML Component ✨</div>
|
259 |
+
`;
|
260 |
+
pcChatArea.appendChild(previewBubble);
|
261 |
+
pcChatArea.scrollTop = pcChatArea.scrollHeight;
|
262 |
+
|
263 |
+
gameMessage.textContent = "STEP 4: The link preview for the Hugging Face Space appears normally in your PC chat. So far, so good...";
|
264 |
+
setTimeout(() => {
|
265 |
+
addChatMessage(phoneChatArea, `Link: ${linkText}`, 'user'); // Simplified on phone
|
266 |
+
const phonePreviewBubble = document.createElement('div');
|
267 |
+
phonePreviewBubble.className = 'chat-bubble user-bubble';
|
268 |
+
phonePreviewBubble.innerHTML = `
|
269 |
+
<p class="font-semibold">Preview: Cool Project App</p>
|
270 |
+
<p class="text-xs text-gray-600">${linkText}</p>
|
271 |
+
`;
|
272 |
+
phoneChatArea.appendChild(phonePreviewBubble);
|
273 |
+
phoneChatArea.scrollTop = phoneChatArea.scrollHeight;
|
274 |
+
|
275 |
+
}, 500);
|
276 |
+
pcMessageInput.value = "";
|
277 |
+
},
|
278 |
+
// Step 5: ATTACK! Adware detects web activity
|
279 |
+
() => {
|
280 |
+
gameMessage.innerHTML = `
|
281 |
+
<span class="text-red-600 font-bold text-xl">🚨 STEP 5: ATTACK! 🚨</span><br>
|
282 |
+
Unknown to you, adware on your PC (e.g., a malicious browser extension) has been monitoring your web activity.
|
283 |
+
Pasting the link and the page updating to show a preview triggered it!
|
284 |
+
`;
|
285 |
+
pcInfo.innerHTML = "<strong class='text-red-500'>🔴 Adware Activated!</strong> It's preparing to inject an ad by manipulating the webpage's code (DOM).";
|
286 |
+
pcChatArea.classList.add('border-red-500', 'border-2');
|
287 |
+
phoneChatArea.classList.remove('border-red-500', 'border-2');
|
288 |
+
},
|
289 |
+
// Step 6: Mermaid diagram displayed
|
290 |
+
async () => {
|
291 |
+
gameMessage.textContent = "STEP 6: Let's visualize how this ad injection happens with a diagram.";
|
292 |
+
mermaidContainer.classList.remove('hidden');
|
293 |
+
const diagramDefinition = `
|
294 |
+
sequenceDiagram
|
295 |
+
actor UserPC as 💻 User on PC
|
296 |
+
participant Browser as🌐 Chrome Browser (PC)
|
297 |
+
participant AdwareExt as 😈 Adware Extension (PC)
|
298 |
+
participant GoogleMessagesWeb as 💬 Google Messages Web UI
|
299 |
+
participant AdServer as 💰 Ad Server (e.g., AdFox)
|
300 |
+
|
301 |
+
UserPC->>Browser: Pastes link (e.g., HF Space)
|
302 |
+
Browser->>GoogleMessagesWeb: Updates UI with link/preview
|
303 |
+
Note over AdwareExt,GoogleMessagesWeb: Adware monitors DOM changes or network activity
|
304 |
+
AdwareExt-->>GoogleMessagesWeb: 🔍 Detects UI update (trigger!)
|
305 |
+
AdwareExt->>Browser: 💉 Injects malicious script into page
|
306 |
+
Browser->>AdServer: Script requests ad content
|
307 |
+
AdServer-->>Browser: Delivers ad 🖼️ (e.g., dealsbe.com)
|
308 |
+
Browser->>GoogleMessagesWeb: Script manipulates DOM to display ad
|
309 |
+
Note over GoogleMessagesWeb: Ad appears in chat flow, looking like part of it!
|
310 |
+
UserPC-->>GoogleMessagesWeb: Sees unexpected ad 😡
|
311 |
+
`;
|
312 |
+
mermaidDiagramEl.textContent = diagramDefinition;
|
313 |
+
try {
|
314 |
+
const { svg } = await mermaid.render('mermaid-graph', diagramDefinition);
|
315 |
+
mermaidDiagramEl.innerHTML = svg;
|
316 |
+
// Adjust viewBox to ensure diagram fits and text is not cut
|
317 |
+
const svgElement = mermaidDiagramEl.querySelector('svg');
|
318 |
+
if (svgElement) {
|
319 |
+
svgElement.setAttribute('height', '100%'); // Make height responsive
|
320 |
+
svgElement.setAttribute('width', '100%'); // Make width responsive
|
321 |
+
// Optionally, adjust viewBox if needed, though automatic sizing is often good
|
322 |
+
// const bbox = svgElement.getBBox();
|
323 |
+
// svgElement.setAttribute('viewBox', `${bbox.x-10} ${bbox.y-10} ${bbox.width+20} ${bbox.height+20}`);
|
324 |
+
}
|
325 |
+
} catch (error) {
|
326 |
+
console.error("Mermaid rendering error:", error);
|
327 |
+
mermaidDiagramEl.textContent = "Error rendering diagram. Please see console.";
|
328 |
+
}
|
329 |
+
pcInfo.innerHTML = "📜 Diagram shows the ad injection process.";
|
330 |
+
},
|
331 |
+
// Step 7: Injected ad appears
|
332 |
+
() => {
|
333 |
+
mermaidContainer.classList.add('hidden'); // Hide diagram for next step
|
334 |
+
gameMessage.textContent = "STEP 7: The adware successfully injects an ad directly into your Google Messages chat flow on your PC!";
|
335 |
+
const adBubble = document.createElement('div');
|
336 |
+
adBubble.className = 'chat-bubble ad-bubble';
|
337 |
+
adBubble.innerHTML = `
|
338 |
+
<p class="font-bold text-lg">🎉 Special Offer from DealsBe.com! 🎉</p>
|
339 |
+
<img src="https://placehold.co/300x150/FFDDDD/CC0000?text=Fake+AdFox+Ad!" alt="Fake Ad" class="mx-auto my-2 rounded shadow-sm">
|
340 |
+
<p class="text-sm">Click here for UNBEATABLE DEALS! (Don't actually click! 😉)</p>
|
341 |
+
<p class="text-xs text-gray-700 mt-1">Powered by 🦊 AdFox (Simulated)</p>
|
342 |
+
`;
|
343 |
+
pcChatArea.appendChild(adBubble);
|
344 |
+
pcChatArea.scrollTop = pcChatArea.scrollHeight;
|
345 |
+
pcInfo.innerHTML = "<strong class='text-red-500'>⚠️ Injected Ad Displayed!</strong> This is NOT from Google Messages.";
|
346 |
+
phoneInfo.innerHTML = "📱 Your phone chat remains clean... for now. The attack is on your PC's browser.";
|
347 |
+
},
|
348 |
+
// Step 8: "AI Sandbox" on PC attempts to detect
|
349 |
+
() => {
|
350 |
+
gameMessage.textContent = "STEP 8: Your PC has a conceptual 'AI-Powered Security Sandbox' that monitors browser behavior for anomalies.";
|
351 |
+
pcInfo.innerHTML = `
|
352 |
+
<div class="highlight-box">
|
353 |
+
<p class="text-lg font-semibold">🤖 AI Sandbox Activated! 🤖</p>
|
354 |
+
<p>Scanning browser activity for unauthorized DOM manipulations and suspicious network requests...</p>
|
355 |
+
<div class="w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700 mt-2">
|
356 |
+
<div id="aiScanProgress" class="bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div>
|
357 |
+
</div>
|
358 |
+
</div>
|
359 |
+
`;
|
360 |
+
let progress = 0;
|
361 |
+
const interval = setInterval(() => {
|
362 |
+
progress += 10;
|
363 |
+
document.getElementById('aiScanProgress').style.width = progress + '%';
|
364 |
+
if (progress >= 100) clearInterval(interval);
|
365 |
+
}, 100);
|
366 |
+
},
|
367 |
+
// Step 9: Detection/Alert
|
368 |
+
() => {
|
369 |
+
gameMessage.innerHTML = `
|
370 |
+
<span class="text-green-600 font-bold text-xl">🛡️ STEP 9: THREAT DETECTED! 🛡️</span><br>
|
371 |
+
The AI Sandbox identifies the unauthorized ad injection!
|
372 |
+
`;
|
373 |
+
pcInfo.innerHTML = `
|
374 |
+
<div class="highlight-box border-green-500 bg-green-50">
|
375 |
+
<p class="text-lg font-semibold text-green-700">✅ Anomaly Found!</p>
|
376 |
+
<p>Detected: Unauthorized script modified chat interface.</p>
|
377 |
+
<p>Source: Suspected adware browser extension.</p>
|
378 |
+
<p>Action: Flagged suspicious activity.</p>
|
379 |
+
</div>
|
380 |
+
`;
|
381 |
+
pcChatArea.classList.remove('border-red-500');
|
382 |
+
pcChatArea.classList.add('border-green-500');
|
383 |
+
},
|
384 |
+
// Step 10: Explanation & "Ad Removal Agent" pitch
|
385 |
+
() => {
|
386 |
+
gameMessage.textContent = "STEP 10: Understanding the Threat & Solution.";
|
387 |
+
showInfoPanel(
|
388 |
+
"💡 Understanding & Defense 💡",
|
389 |
+
`
|
390 |
+
<p class="mb-3">You've seen how adware can sneakily inject ads. This wasn't Google's fault, but a malicious program on <em>your PC</em>.</p>
|
391 |
+
<p class="mb-3"><strong>Key Takeaways:</strong></p>
|
392 |
+
<ul class="list-disc list-inside mb-3 text-left space-y-1">
|
393 |
+
<li>Adware often comes from unsafe downloads or deceptive browser extensions.</li>
|
394 |
+
<li>It manipulates website code (DOM) locally in <em>your browser</em>.</li>
|
395 |
+
<li>Your actual message content is usually not the primary target for simple ad-injectors, but your browsing data might be.</li>
|
396 |
+
<li>Google Messages' Privacy Policy covers their service, not third-party malware on your device. Always check extension permissions!</li>
|
397 |
+
</ul>
|
398 |
+
<div class="p-4 bg-blue-800 rounded-lg mt-4">
|
399 |
+
<h3 class="text-xl font-semibold mb-2">✨ Introducing 'Guardian AI Shield' (Conceptual) ✨</h3>
|
400 |
+
<p>Imagine an advanced AI agent, like the one that detected this, constantly protecting you!</p>
|
401 |
+
<p class="mt-2"><strong>Guardian AI Shield could:</strong></p>
|
402 |
+
<ul class="list-disc list-inside text-left space-y-1">
|
403 |
+
<li>Proactively block known adware sources.</li>
|
404 |
+
<li>Detect and neutralize new ad injection techniques in real-time.</li>
|
405 |
+
<li>Analyze browser extension behavior for risks.</li>
|
406 |
+
<li>Offer one-click cleanup of detected threats.</li>
|
407 |
+
</ul>
|
408 |
+
<p class="mt-3 font-semibold">Stay safe by being vigilant and using robust security tools!</p>
|
409 |
+
</div>
|
410 |
+
`
|
411 |
+
);
|
412 |
+
nextStepButton.textContent = "Restart Simulation 🔄";
|
413 |
+
nextStepButton.classList.remove('bg-blue-600', 'hover:bg-blue-700');
|
414 |
+
nextStepButton.classList.add('bg-green-600', 'hover:bg-green-700');
|
415 |
+
}
|
416 |
+
];
|
417 |
+
|
418 |
+
function addChatMessage(area, message, type) {
|
419 |
+
const bubble = document.createElement('div');
|
420 |
+
bubble.className = `chat-bubble ${type === 'user' ? 'user-bubble' : (type === 'friend' ? 'friend-bubble' : 'ad-bubble')}`;
|
421 |
+
bubble.textContent = message;
|
422 |
+
area.appendChild(bubble);
|
423 |
+
area.scrollTop = area.scrollHeight;
|
424 |
+
}
|
425 |
+
|
426 |
+
function showInfoPanel(title, content) {
|
427 |
+
infoPanelTitle.textContent = title;
|
428 |
+
infoPanelContent.innerHTML = content;
|
429 |
+
infoPanel.classList.remove('hidden');
|
430 |
+
}
|
431 |
+
|
432 |
+
infoPanelCloseButton.addEventListener('click', () => {
|
433 |
+
infoPanel.classList.add('hidden');
|
434 |
+
});
|
435 |
+
|
436 |
+
function resetSimulation() {
|
437 |
+
step = 0;
|
438 |
+
pcChatArea.innerHTML = '';
|
439 |
+
phoneChatArea.innerHTML = '';
|
440 |
+
pcMessageInput.value = '';
|
441 |
+
pcInfo.innerHTML = '';
|
442 |
+
phoneInfo.innerHTML = '';
|
443 |
+
mermaidContainer.classList.add('hidden');
|
444 |
+
mermaidDiagramEl.innerHTML = '';
|
445 |
+
pcChatArea.classList.remove('border-red-500', 'border-green-500', 'border-2');
|
446 |
+
nextStepButton.textContent = "Next Step 🚀";
|
447 |
+
nextStepButton.classList.remove('bg-green-600', 'hover:bg-green-700');
|
448 |
+
nextStepButton.classList.add('bg-blue-600', 'hover:bg-blue-700');
|
449 |
+
updateStepIndicator();
|
450 |
+
steps[step]();
|
451 |
+
}
|
452 |
+
|
453 |
+
function updateStepIndicator() {
|
454 |
+
currentStepEl.textContent = `Step ${step + 1}`;
|
455 |
+
}
|
456 |
+
|
457 |
+
nextStepButton.addEventListener('click', () => {
|
458 |
+
if (step < totalSteps -1) {
|
459 |
+
step++;
|
460 |
+
updateStepIndicator();
|
461 |
+
steps[step]();
|
462 |
+
} else if (step === totalSteps -1 && nextStepButton.textContent.includes("Restart")) {
|
463 |
+
resetSimulation();
|
464 |
+
} else { // Last step action before restart
|
465 |
+
steps[step](); // Execute the last step's function (which shows the info panel)
|
466 |
+
}
|
467 |
+
});
|
468 |
+
|
469 |
+
// Initialize first step
|
470 |
+
updateStepIndicator();
|
471 |
+
steps[step]();
|
472 |
+
|
473 |
+
</script>
|
474 |
+
</body>
|
475 |
</html>
|