eveee 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # CDP Solver
2
+
3
+ Stealth Exam Assistant for Testpad.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g cdp-core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ On your other laptop, simply run:
14
+
15
+ ```bash
16
+ npx -y cdp-core
17
+ ```
18
+
19
+ ### What it does:
20
+ 1. It searches for **Testpad** or **Chrome** on your PC.
21
+ 2. It automatically launches them with the required debugging port (`9222`).
22
+ 3. It starts the solver injector.
23
+
24
+ *Note: If it can't find your browser automatically, you can still launch it manually with `--remote-debugging-port=9222`.*
25
+
26
+ ### Hotkeys
27
+
28
+ - **Ctrl + Shift + G**: Solve & Show (Ghost Panel)
29
+ - **Ctrl + Shift + H**: Toggle Hide/Unhide Panel
30
+ - **Ctrl + Shift + S**: Force Start Bypass
31
+
32
+ ## Description
33
+
34
+ This tool injects a stealth solver script into a Chrome/Edge instance running with Remote Debugging enabled (port 9222). It uses the Groq API (Llama 3) to provide brief solutions to questions on the page.
35
+
36
+ ## Requirements
37
+
38
+ - Chrome/Edge running with `--remote-debugging-port=9222`
39
+ - Node.js installed
package/cdp_inject.js ADDED
@@ -0,0 +1,374 @@
1
+ #!/usr/bin/env node
2
+ const http = require('http');
3
+ const https = require('https');
4
+ let WebSocket;
5
+ try {
6
+ WebSocket = require('ws');
7
+ } catch (e) {
8
+ process.exit(1);
9
+ }
10
+ const { exec, execSync } = require('child_process');
11
+ const path = require('path');
12
+ const fs = require('fs');
13
+ const net = require('net');
14
+
15
+ let LOCK_PORT = 0;
16
+ const CDP_PORT = 9222;
17
+
18
+ function getRandomPort() {
19
+ return new Promise((resolve, reject) => {
20
+ const srv = net.createServer();
21
+ srv.listen(0, '127.0.0.1', () => {
22
+ const port = srv.address().port;
23
+ srv.close(() => resolve(port));
24
+ });
25
+ srv.on('error', reject);
26
+ });
27
+ }
28
+
29
+ const keyPool = [
30
+ { key: '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', rpmRemaining: null, tpmRemaining: null, cooldownUntil: 0, failStreak: 0 },
31
+ { key: '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', rpmRemaining: null, tpmRemaining: null, cooldownUntil: 0, failStreak: 0 },
32
+ { key: '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', rpmRemaining: null, tpmRemaining: null, cooldownUntil: 0, failStreak: 0 },
33
+ { key: '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', rpmRemaining: null, tpmRemaining: null, cooldownUntil: 0, failStreak: 0 },
34
+ { key: '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', rpmRemaining: null, tpmRemaining: null, cooldownUntil: 0, failStreak: 0 },
35
+ { key: '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', rpmRemaining: null, tpmRemaining: null, cooldownUntil: 0, failStreak: 0 }
36
+ ];
37
+
38
+ const MAX_CONCURRENT = 3;
39
+ let activeRequests = 0;
40
+ const requestQueue = [];
41
+
42
+ function selectBestKey(isHighCost) {
43
+ const now = Date.now();
44
+ let bestKey = null;
45
+ let bestScore = -Infinity;
46
+ for (const k of keyPool) {
47
+ if (now < k.cooldownUntil) continue;
48
+ if (isHighCost && k.tpmRemaining !== null && k.tpmRemaining < 3000) continue;
49
+ let score = 0;
50
+ if (k.tpmRemaining !== null) score += (k.tpmRemaining / 100);
51
+ else score += 50;
52
+ if (k.rpmRemaining !== null) score += (k.rpmRemaining * 2);
53
+ else score += 50;
54
+ score -= (k.failStreak * 10);
55
+ if (score > bestScore) { bestScore = score; bestKey = k; }
56
+ }
57
+ if (!bestKey) {
58
+ for (const k of keyPool) {
59
+ if (now < k.cooldownUntil) continue;
60
+ let score = (k.tpmRemaining || 5000)/100 - (k.failStreak*10);
61
+ if (score > bestScore) { bestScore = score; bestKey = k; }
62
+ }
63
+ }
64
+ return bestKey;
65
+ }
66
+
67
+ function launchBrowser() {
68
+ const userProfile = process.env.USERPROFILE || 'C:\\Users\\' + (process.env.USERNAME || 'Default');
69
+ const p = path.join(userProfile, "AppData\\Local\\Programs\\testpad\\testpad.exe");
70
+ if (fs.existsSync(p)) {
71
+ try { execSync('taskkill /F /IM testpad.exe', { stdio: 'ignore' }); } catch(e) {}
72
+ exec(`start "" "${p}" --remote-debugging-port=${CDP_PORT}`);
73
+ }
74
+ }
75
+
76
+ const SOLVER_SCRIPT = `
77
+ (function() {
78
+ if (window._rV) return;
79
+ window._rV = true;
80
+ const _w = console.warn.bind(console);
81
+ let _cl = [];
82
+ let _ci = 0;
83
+ let _kd = {};
84
+ let _lt = 0;
85
+ window._rR = function(data) {
86
+ if (data.type === 'mcq') {
87
+ if (!document.getElementById('_rs')) {
88
+ const s = document.createElement('style');
89
+ s.id = '_rs';
90
+ s.textContent = '._rh::after{content:' + String.fromCharCode(34,46,34) + ';font-size:1.15em}';
91
+ document.head.appendChild(s);
92
+ }
93
+ const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
94
+ let node;
95
+ while (node = walker.nextNode()) {
96
+ if (node.textContent.toLowerCase().includes(data.answer.toLowerCase())) {
97
+ const p = node.parentElement;
98
+ p.classList.add('_rh');
99
+ p.scrollIntoView({ behavior: 'smooth', block: 'center' });
100
+ setTimeout(() => { p.classList.remove('_rh'); }, 5000);
101
+ break;
102
+ }
103
+ }
104
+ } else if (data.type === 'code') {
105
+ _cl = data.answer.split(/\\r?\\n/).filter(l => l.trim() !== '');
106
+ _ci = 0;
107
+ }
108
+ };
109
+ function _insertChar(ch) {
110
+ var el = document.activeElement;
111
+ if (!el) return;
112
+ if (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') {
113
+ var start = el.selectionStart || 0;
114
+ var end = el.selectionEnd || 0;
115
+ el.value = el.value.substring(0, start) + ch + el.value.substring(end);
116
+ el.selectionStart = el.selectionEnd = start + ch.length;
117
+ el.dispatchEvent(new Event('input', { bubbles: true }));
118
+ } else {
119
+ document.execCommand('insertText', false, ch);
120
+ }
121
+ }
122
+ const _ts = () => {
123
+ const pc = document.body.innerText;
124
+ const el = document.activeElement;
125
+ let ec = '';
126
+ if (el) {
127
+ if (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') ec = el.value;
128
+ else if (el.classList.contains('monaco-editor') || el.contentEditable === 'true') ec = el.innerText || el.textContent;
129
+ }
130
+ if (pc.length > 10) {
131
+ _w('_cdp_solve_: ' + btoa(unescape(encodeURIComponent(JSON.stringify({ question: pc, currentCode: ec })))));
132
+ }
133
+ };
134
+ document.addEventListener('mousemove', (e) => {
135
+ const now = Date.now();
136
+ if (e.clientX <= 1) {
137
+ if (now - _lt > 3000) { _lt = now; _ts(); }
138
+ } else if (e.clientX >= window.innerWidth - 1) {
139
+ _cl = []; _ci = 0;
140
+ }
141
+ });
142
+ document.addEventListener('keydown', (e) => {
143
+ const key = e.key;
144
+ _kd[e.code || key] = true;
145
+ const both = (_kd['ArrowLeft'] || _kd['Left']) && (_kd['ArrowRight'] || _kd['Right']);
146
+ if (both) { e.preventDefault(); _ts(); }
147
+ if (_cl.length > 0 && !e.ctrlKey && !e.altKey && !e.metaKey && key.length === 1) {
148
+ const el = document.activeElement;
149
+ if (el && (el.tagName === 'TEXTAREA' || el.classList.contains('monaco-editor') || el.contentEditable === 'true' || el.tagName === 'INPUT')) {
150
+ e.preventDefault(); e.stopPropagation();
151
+ let cur = _cl[0];
152
+ if (_ci === 0) {
153
+ while (_ci < cur.length && (cur[_ci] === ' ' || cur[_ci] === '\\t')) { _ci++; }
154
+ }
155
+ if (_ci < cur.length) {
156
+ _insertChar(cur[_ci]);
157
+ _ci++;
158
+ } else {
159
+ _insertChar(String.fromCharCode(10));
160
+ _cl.shift(); _ci = 0;
161
+ }
162
+ }
163
+ }
164
+ }, true);
165
+ document.addEventListener('keyup', (e) => { _kd[e.code || e.key] = false; }, true);
166
+ })();
167
+ `;
168
+
169
+ async function sleep(ms) { return new Promise(r => setTimeout(r, ms)); }
170
+
171
+ function enqueueTask(ws, content) {
172
+ const isHighCost = content.length > 200 || content.includes('{') || content.includes('function') || content.includes('class ');
173
+ requestQueue.push({ ws, content, isHighCost, priority: false });
174
+ requestQueue.sort((a, b) => (b.priority ? 1 : 0) - (a.priority ? 1 : 0));
175
+ processQueue();
176
+ }
177
+
178
+ async function processQueue() {
179
+ if (activeRequests >= MAX_CONCURRENT || requestQueue.length === 0) return;
180
+ const task = requestQueue[0];
181
+ const keyObj = selectBestKey(task.isHighCost);
182
+ if (!keyObj) { setTimeout(processQueue, 1000); return; }
183
+ requestQueue.shift();
184
+ activeRequests++;
185
+ try { await executeTask(task, keyObj); } finally { activeRequests--; processQueue(); }
186
+ }
187
+
188
+ async function executeTask(task, keyObj) {
189
+ const { ws, content, isHighCost } = task;
190
+ try {
191
+ const payloadObj = {
192
+ key: keyObj.key,
193
+ payload: {
194
+ model: 'llama-3.3-70b-versatile',
195
+ messages: [
196
+ {role: 'system', content: 'You are a world-class Computer Science professor and expert programmer. Your answers must be 100% CORRECT — lives depend on it.\n\nSTRICT RULES:\n1. THINK step-by-step. Show full reasoning in the "reasoning" field.\n2. For MCQs: Read ALL options carefully. Eliminate wrong ones first. The answer MUST be the EXACT text of one option — copy it character by character. DO NOT paraphrase.\n3. For code: Write COMPLETE, COMPILABLE, OPTIMIZED code. Handle ALL edge cases. Follow the EXACT language required. Use stdin/stdout unless told otherwise. Include necessary headers/imports.\n4. DOUBLE-CHECK your answer before responding. If unsure, reason more carefully instead of guessing.\n5. For math/logic: Show each calculation step. Verify the final answer by substitution or reverse check.\n6. NEVER guess. NEVER hallucinate. If a question has a trick, identify it.\n\nOUTPUT: Return ONLY valid JSON, no markdown, no extra text:\n{"reasoning": "detailed step-by-step reasoning", "type": "mcq" or "code", "answer": "exact option text OR complete code"}'},
197
+ {role: 'user', content: content}
198
+ ],
199
+ response_format: { type: "json_object" },
200
+ temperature: 0
201
+ }
202
+ };
203
+
204
+ const gasUrl = 'https://script.google.com/macros/s/AKfycby49CWdH4xrD1aC1Murfl5VUDk1Ijj3zynEhbe_oCI-SshArahejQUYwlekZpwvSOSxRw/exec';
205
+
206
+ const doFetch = (urlStr, isRedirect = false) => new Promise((res, rej) => {
207
+ const u = new URL(urlStr);
208
+ const req = https.request({
209
+ hostname: u.hostname,
210
+ path: u.pathname + u.search,
211
+ method: isRedirect ? 'GET' : 'POST',
212
+ timeout: 15000,
213
+ rejectUnauthorized: false,
214
+ headers: isRedirect ? {} : { 'Content-Type': 'application/json' }
215
+ }, (r) => {
216
+ if (r.statusCode === 301 || r.statusCode === 302 || r.statusCode === 307) {
217
+ doFetch(r.headers.location, true).then(res).catch(rej);
218
+ return;
219
+ }
220
+ let d = '';
221
+ r.on('data', c => d += c);
222
+ r.on('end', () => res({ status: r.statusCode, data: d }));
223
+ });
224
+ req.on('error', rej);
225
+ if (!isRedirect) req.write(JSON.stringify(payloadObj));
226
+ req.end();
227
+ });
228
+
229
+ const rawResponse = await doFetch(gasUrl);
230
+ const gasResult = JSON.parse(rawResponse.data);
231
+
232
+ let rHeaders = {};
233
+ if (gasResult.headers) {
234
+ for (let k in gasResult.headers) {
235
+ let v = gasResult.headers[k];
236
+ rHeaders[k.toLowerCase()] = Array.isArray(v) ? v[0] : v;
237
+ }
238
+ }
239
+
240
+ if (rHeaders['x-ratelimit-remaining-tokens']) keyObj.tpmRemaining = parseInt(rHeaders['x-ratelimit-remaining-tokens']);
241
+ if (rHeaders['x-ratelimit-remaining-requests']) keyObj.rpmRemaining = parseInt(rHeaders['x-ratelimit-remaining-requests']);
242
+
243
+ if (gasResult.statusCode === 429 || gasResult.statusCode === 503 || gasResult.statusCode >= 500) {
244
+ throw new Error(`HTTP ${gasResult.statusCode}`);
245
+ }
246
+
247
+ const groqResp = gasResult.body;
248
+
249
+ const data = JSON.parse(groqResp);
250
+ if (data.choices && data.choices[0]) {
251
+ const answer = data.choices[0].message.content;
252
+ ws.send(JSON.stringify({
253
+ id: Math.floor(Math.random()*1000),
254
+ method: 'Runtime.evaluate',
255
+ params: { expression: `window._rR(${answer})` }
256
+ }));
257
+ keyObj.failStreak = 0;
258
+ } else {
259
+ throw new Error('Invalid JSON response');
260
+ }
261
+ } catch (e) {
262
+ keyObj.failStreak++;
263
+ const backoffMs = (5000 * Math.pow(2, keyObj.failStreak - 1)) + Math.floor(Math.random() * 2000) + 1000;
264
+ keyObj.cooldownUntil = Date.now() + Math.min(backoffMs, 120000);
265
+ task.priority = true;
266
+ requestQueue.push(task);
267
+ requestQueue.sort((a, b) => (b.priority ? 1 : 0) - (a.priority ? 1 : 0));
268
+ }
269
+ }
270
+
271
+ async function main() {
272
+ LOCK_PORT = await getRandomPort();
273
+
274
+ process.on('uncaughtException', (e) => {});
275
+ process.on('unhandledRejection', (reason) => {});
276
+
277
+ const server = net.createServer();
278
+ server.listen(LOCK_PORT, '127.0.0.1');
279
+
280
+ let launchAttempted = false;
281
+ const activeConnections = new Set();
282
+
283
+ while (true) {
284
+ try {
285
+ const targets = await new Promise((res, rej) => {
286
+ const req = http.get('http://127.0.0.1:' + CDP_PORT + '/json', (r) => {
287
+ let d = '';
288
+ r.on('data', (c) => d += c);
289
+ r.on('end', () => { try { res(JSON.parse(d)); } catch(e) { rej(e); } });
290
+ });
291
+ req.on('error', rej);
292
+ req.setTimeout(2000, () => req.destroy());
293
+ });
294
+
295
+ const pages = targets.filter(t => t.type === 'page' && t.webSocketDebuggerUrl);
296
+ for (const t of pages) {
297
+ if (activeConnections.has(t.id)) continue;
298
+ activeConnections.add(t.id);
299
+
300
+ const wsUrl = t.webSocketDebuggerUrl.replace('localhost', '127.0.0.1');
301
+ const ws = new WebSocket(wsUrl);
302
+
303
+ ws.on('open', () => {
304
+ ws.send(JSON.stringify({ id: 1, method: 'Page.enable' }));
305
+ ws.send(JSON.stringify({ id: 2, method: 'Runtime.enable' }));
306
+ ws.send(JSON.stringify({ id: 3, method: 'Fetch.enable', params: { patterns: [{ urlPattern: '*test/cdp-solver*', requestStage: 'Request' }, { urlPattern: '*test/ghost-solver*', requestStage: 'Request' }] } }));
307
+ ws.send(JSON.stringify({ id: 4, method: 'Page.setBypassCSP', params: { enabled: true } }));
308
+ ws.send(JSON.stringify({ id: 5, method: 'Page.addScriptToEvaluateOnNewDocument', params: { source: SOLVER_SCRIPT } }));
309
+ ws.send(JSON.stringify({ id: 6, method: 'Runtime.evaluate', params: { expression: SOLVER_SCRIPT } }));
310
+ });
311
+
312
+ ws.on('message', async (msg) => {
313
+ try {
314
+ const resp = JSON.parse(msg);
315
+ if (resp.method === 'Fetch.requestPaused') {
316
+ const requestId = resp.params && resp.params.requestId;
317
+ if (!requestId) return;
318
+ try {
319
+ const request = resp.params.request || {};
320
+ if (request.url && (request.url.includes('/test/cdp-solver') || request.url.includes('/test/ghost-solver'))) {
321
+ if (request.url.includes('json') || (request.headers && request.headers['Accept'] && request.headers['Accept'].includes('application/json'))) {
322
+ const jsonBody = Buffer.from(JSON.stringify({ quiz: true, id: "cdp-solver", name: "Mock Test", status: "active", duration: 3600 })).toString('base64');
323
+ ws.send(JSON.stringify({ id: Math.floor(Math.random()*1000), method: 'Fetch.fulfillRequest', params: { requestId, responseCode: 200, responseHeaders: [{name: 'Content-Type', value: 'application/json'}], body: jsonBody } }));
324
+ } else {
325
+ try {
326
+ const htmlData = fs.readFileSync(path.join(__dirname, 'demo_test.html'));
327
+ ws.send(JSON.stringify({ id: Math.floor(Math.random()*1000), method: 'Fetch.fulfillRequest', params: { requestId, responseCode: 200, responseHeaders: [{name: 'Content-Type', value: 'text/html'}], body: htmlData.toString('base64') } }));
328
+ } catch(e) {
329
+ ws.send(JSON.stringify({ id: Math.floor(Math.random()*1000), method: 'Fetch.continueRequest', params: { requestId } }));
330
+ }
331
+ }
332
+ } else {
333
+ ws.send(JSON.stringify({ id: Math.floor(Math.random()*1000), method: 'Fetch.continueRequest', params: { requestId } }));
334
+ }
335
+ } catch(fe) {
336
+ try { ws.send(JSON.stringify({ id: Math.floor(Math.random()*1000), method: 'Fetch.continueRequest', params: { requestId } })); } catch(x) {}
337
+ }
338
+ }
339
+ if (resp.method === 'Runtime.consoleAPICalled' && resp.params && resp.params.args) {
340
+ const text = resp.params.args.map(a => (a && a.value) || '').join(' ');
341
+ if (text.includes('_cdp_solve_: ')) {
342
+ const b64 = text.split('_cdp_solve_: ')[1];
343
+ const content = Buffer.from(b64, 'base64').toString('utf-8');
344
+ enqueueTask(ws, content);
345
+ } else if (text.includes('_cdp_stop_')) {
346
+ process.exit(0);
347
+ }
348
+ }
349
+ } catch(e) {}
350
+ });
351
+
352
+ ws.on('close', () => { activeConnections.delete(t.id); });
353
+ ws.on('error', () => activeConnections.delete(t.id));
354
+ }
355
+ } catch (e) {
356
+ if (!launchAttempted) {
357
+ launchBrowser();
358
+ launchAttempted = true;
359
+ }
360
+ }
361
+ await sleep(2000);
362
+ }
363
+ }
364
+
365
+ if (process.argv.includes('--stop')) {
366
+ exec('taskkill /F /IM node.exe', () => process.exit(0));
367
+ } else if (process.argv.includes('--detach')) {
368
+ const child = require('child_process').spawn('node', [__filename], {
369
+ detached: true,
370
+ stdio: 'ignore'
371
+ });
372
+ child.unref();
373
+ process.exit(0);
374
+ } else { main(); }
package/demo_test.html ADDED
@@ -0,0 +1,177 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Chitkara | TestPad</title>
6
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.36.1/min/vs/loader.min.js"></script>
7
+ <style>
8
+ :root { --orange: #ef6c00; --bg-grey: #f5f5f5; --text-main: #333; }
9
+ body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
10
+ .top-nav { height: 50px; background: #fff; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; padding: 0 20px; justify-content: space-between; }
11
+ .top-nav .logo { width: 30px; height: 30px; background: var(--orange); border-radius: 4px; }
12
+ .user-info { display: flex; align-items: center; gap: 10px; font-size: 13px; }
13
+ .avatar { width: 32px; height: 32px; background: #ef6c00; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }
14
+ .tabs-bar { height: 40px; background: #fff; border-bottom: 1px solid #e0e0e0; display: flex; padding-left: 50px; align-items: center; }
15
+ .tab { padding: 0 20px; font-size: 14px; color: #666; cursor: pointer; height: 100%; display: flex; align-items: center; border-bottom: 2px solid transparent; }
16
+ .tab.active { color: var(--orange); border-bottom-color: var(--orange); font-weight: 500; }
17
+ .workspace { flex: 1; display: flex; overflow: hidden; background: #fff; }
18
+ .left-pane { flex: 1; border-right: 1px solid #e0e0e0; overflow-y: auto; padding: 30px 50px; }
19
+ .q-title { font-size: 20px; font-weight: 500; margin-bottom: 25px; border-bottom: 2px solid #ffccbc; display: inline-block; padding-bottom: 5px; }
20
+ .right-pane { flex: 1; display: flex; flex-direction: column; background: #fff; position: relative; }
21
+ .mcq-container { padding: 40px; }
22
+ .option-item { display: flex; align-items: center; gap: 15px; padding: 15px 0; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
23
+ .radio-circle { width: 18px; height: 18px; border: 2px solid #ccc; border-radius: 50%; }
24
+ .option-text { font-size: 14px; color: #333; }
25
+ .submit-btn { position: absolute; bottom: 40px; right: 40px; background: var(--orange); color: #fff; border: none; padding: 10px 30px; border-radius: 4px; font-weight: 500; cursor: pointer; }
26
+ #editor-container { flex: 1; width: 100%; }
27
+ .bottom-nav { height: 40px; background: #fff; border-top: 1px solid #e0e0e0; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; font-size: 13px; color: #666; }
28
+ .nav-link { cursor: pointer; display: flex; align-items: center; gap: 5px; text-transform: lowercase; }
29
+ </style>
30
+ </head>
31
+ <body>
32
+ <div class="top-nav"><div class="logo"></div><div class="user-info"><div>CANDIDATE</div><div class="avatar">C</div></div></div>
33
+ <div class="workspace"><div class="left-pane" id="left-pane"></div><div class="right-pane" id="right-pane"></div></div>
34
+ <div class="bottom-nav">
35
+ <div class="nav-link" onclick="prevQ()">◀ previous</div>
36
+ <div id="q-count">1 / 32</div>
37
+ <div class="nav-link" onclick="nextQ()">next ▶</div>
38
+ </div>
39
+
40
+ <script>
41
+ const questions = [
42
+ { type: 'mcq', title: 'Question 1', q: 'Find the area of a triangle in which the sides are 25 cm, 17 cm and 12 cm.', options: ['90 sq cm', '80 sq cm', '85 sq cm', '75 sq cm'] },
43
+ { type: 'mcq', title: 'Question 2', q: 'The perimeter of an isosceles triangle is 14 cm and the ratio of equal side to base is 5 : 4. Find the area of the triangle.', options: ['12 sq cm', '14 sq cm', '16 sq cm', '18 sq cm'] },
44
+ { type: 'mcq', title: 'Question 3', q: 'Perimeter of a square and an equilateral triangle are equal. If the diagonal of the square is 15√2 cm, find the area of the equilateral triangle.', options: ['100 sq cm', '150 sq cm', '225 sq cm', '300 sq cm'] },
45
+ { type: 'mcq', title: 'Question 4', q: 'The length of a rectangular plot is 20 metres more than its breadth. If fencing at Rs 26.50 per metre costs Rs 5300, find the length.', options: ['40 m', '50 m', '60 m', '80 m'] },
46
+ { type: 'mcq', title: 'Question 5', q: 'The length and breadth of a rectangle are in the ratio 5 : 3. The owner spends Rs 3000 fencing it at Rs 7.50 per metre. Find the difference between length and breadth.', options: ['50 m', '100 m', '150 m', '200 m'] },
47
+ { type: 'mcq', title: 'Question 6', q: 'When the length of a rectangular plot is increased four times, its perimeter becomes 480 m and area becomes 12800 sq m. Find the original length.', options: ['20 m', '40 m', '80 m', '160 m'] },
48
+ { type: 'mcq', title: 'Question 7', q: 'The area of a rectangular courtyard is 100 sq m. If the length were increased by 2 m, the area would increase by 10 sq m. Find the dimensions.', options: ['20 m, 5 m', '25 m, 4 m', '10 m, 10 m', 'Data inadequate'] },
49
+ { type: 'mcq', title: 'Question 8', q: 'A rectangular field has area 48 sq cm. The sum of its diagonal and length is 3 times its breadth. Find its dimensions.', options: ['8 cm, 6 cm', '12 cm, 4 cm', '16 cm, 3 cm', 'Data inadequate'] },
50
+ { type: 'mcq', title: 'Question 9', q: 'Length of a rectangular blackboard is 20 cm more than its breadth. If increasing the length by 15 cm and decreasing breadth by 10 cm leaves the area unchanged, find its perimeter.', options: ['150 cm', '160 cm', '270 cm', '320 cm'] },
51
+ { type: 'mcq', title: 'Question 10', q: 'In order to fence a square, 48 poles are fixed at equal distances of 5 metres. Find the area of the square formed.', options: ['2500 sq m', '2600 sq m', '3025 sq m', 'None of these'] },
52
+ { type: 'mcq', title: 'Question 11', q: 'A square room is surrounded by a verandah 3 metres wide. If the area of the verandah is 96 sq m, find the area of the room.', options: ['25 sq m', '36 sq m', '49 sq m', '64 sq m'] },
53
+ { type: 'mcq', title: 'Question 12', q: 'The two parallel sides of a trapezium are 15 cm and 35 cm. If its area is 400 sq cm, find the height.', options: ['15 cm', '16 cm', '20 cm', '25 cm'] },
54
+ { type: 'mcq', title: 'Question 13', q: 'A horse is tied at one corner of a rectangular enclosure 40 m × 36 m with a rope 14 m long. Find the area it can graze.', options: ['154 sq m', '124 sq m', '164 sq m', 'Data inadequate'] },
55
+ { type: 'mcq', title: 'Question 14', q: 'A rectangular field is 125 m long and 68 m broad. A path of width 3 m runs inside around the boundary. Find the area of the path.', options: ['1122 sq m', '1212 sq m', '2211 sq m', 'None of these'] },
56
+ { type: 'mcq', title: 'Question 15', q: 'A rhombus has area 216 sq cm and one diagonal 24 cm. Find the other diagonal and side of the rhombus.', options: ['18 cm, 30 cm', '18 cm, 15 cm', '9 cm, 15 cm', 'Data inadequate'] },
57
+ { type: 'mcq', title: 'Question 16', q: 'A wooden box of dimensions 8 m × 7 m × 6 m is to carry smaller boxes of dimensions 8 cm × 7 cm × 6 cm. Find the maximum number of boxes.', options: ['9800000', '7500000', '1000000', '1200000'] },
58
+ { type: 'mcq', title: 'Question 17', q: 'Find the weight of an iron rod of square section, 10 m long and 2.3 cm broad. One cubic cm of iron weighs 7.207 g.', options: ['38 kg', '39 kg', '40 kg', 'Data inadequate'] },
59
+ { type: 'mcq', title: 'Question 18', q: 'The areas of three adjacent faces of a cuboid are 120 sq cm, 72 sq cm and 60 sq cm. Find the volume.', options: ['720 cu cm', '86400 cu cm', '259200 cu cm', 'Cannot be determined'] },
60
+ { type: 'mcq', title: 'Question 19', q: 'The sum of length, breadth and height of a cuboid is 5 cm and its diagonal is 4 cm. Find its total surface area.', options: ['3 sq cm', '9 sq cm', '10 sq cm', 'Data inadequate'] },
61
+ { type: 'mcq', title: 'Question 20', q: 'A cube has diagonal 17.32 cm. Find its volume.', options: ['1000 cu cm', '1500 cu cm', '2000 cu cm', '2500 cu cm'] },
62
+ { type: 'mcq', title: 'Question 21', q: 'The curved surface area of a cylinder is 4400 sq cm and the circumference of the base is 110 cm. Find its height and volume.', options: ['40 cm, 38500 cu cm', '45 cm, 38500 cu cm', '40 cm, 38560 cu cm', '45 cm, 38560 cu cm'] },
63
+ { type: 'mcq', title: 'Question 22', q: 'The largest sphere is carved out of a cube of side 7 cm. Find the volume of the sphere. (π = 3.14)', options: ['176.9 cu cm', '179.6 cu cm', '180.6 cu cm', '189.6 cu cm'] },
64
+ { type: 'mcq', title: 'Question 1', q: 'The area of a rectangle is 240 cm² and its length is 20 cm. What is its breadth?', options: ['10 cm', '12 cm', '14 cm', '16 cm'] },
65
+ { type: 'mcq', title: 'Question 2', q: 'A square has perimeter 64 cm. Its area is:', options: ['128 cm²', '196 cm²', '256 cm²', '324 cm²'] },
66
+ { type: 'mcq', title: 'Question 3', q: 'The radius of a circle is doubled. Its area becomes:', options: ['Double', 'Triple', 'Four times', 'Eight times'] },
67
+ { type: 'mcq', title: 'Question 4', q: 'The area of a triangle with base 18 cm and height 14 cm is:', options: ['126 cm²', '252 cm²', '144 cm²', '108 cm²'] },
68
+ { type: 'mcq', title: 'Question 5', q: 'The curved surface area of a cylinder with radius 7 cm and height 10 cm is:', options: ['220 cm²', '440 cm²', '880 cm²', '154 cm²'] },
69
+ { type: 'mcq', title: 'Question 6', q: 'The volume of a cube with side 6 cm is:', options: ['36 cm³', '72 cm³', '216 cm³', '144 cm³'] },
70
+ { type: 'mcq', title: 'Question 7', q: 'A cuboid has dimensions 8 cm × 6 cm × 5 cm. Its volume is:', options: ['180 cm³', '240 cm³', '300 cm³', '210 cm³'] },
71
+ { type: 'mcq', title: 'Question 8', q: 'The total surface area of a cube with side 5 cm is:', options: ['125 cm²', '150 cm²', '100 cm²', '250 cm²'] },
72
+ { type: 'mcq', title: 'Question 9', q: 'The volume of a cylinder with radius 3 cm and height 7 cm is:', options: ['63π cm³', '42π cm³', '21π cm³', '84π cm³'] },
73
+ { type: 'mcq', title: 'Question 10', q: 'A sphere has radius 7 cm. Its volume is:', options: ['1372/3 π cm³', '1029/3 π cm³', '686/3 π cm³', '2401/3 π cm³'] },
74
+ { type: 'mcq', title: 'Question 11', q: 'If the radius of a sphere is increased by 50%, its volume increases by:', options: ['125%', '237.5%', '150%', '300%'] },
75
+ { type: 'mcq', title: 'Question 12', q: 'The area of a rhombus whose diagonals are 16 cm and 12 cm is:', options: ['96 cm²', '192 cm²', '48 cm²', '72 cm²'] },
76
+ { type: 'mcq', title: 'Question 13', q: 'The area of a trapezium with parallel sides 12 cm and 18 cm and height 8 cm is:', options: ['96 cm²', '120 cm²', '144 cm²', '180 cm²'] },
77
+ { type: 'mcq', title: 'Question 14', q: 'The volume of a cone with radius 3 cm and height 14 cm is:', options: ['42π cm³', '126π cm³', '84π cm³', '98π cm³'] },
78
+ { type: 'mcq', title: 'Question 15', q: 'A rectangular field is 80 m long and 60 m broad. The cost of fencing it at ₹12 per meter is:', options: ['₹1440', '₹2880', '₹3360', '₹4200'] },
79
+ { type: 'mcq', title: 'Question 16', q: 'The diagonal of a square is 10√2 cm. Its area is:', options: ['50 cm²', '100 cm²', '200 cm²', '75 cm²'] },
80
+ { type: 'mcq', title: 'Question 17', q: 'The circumference of a circle is 44 cm. Its radius is:', options: ['7 cm', '14 cm', '21 cm', '3.5 cm'] },
81
+ { type: 'mcq', title: 'Question 18', q: 'The total surface area of a cylinder is given by:', options: ['2πrh', 'πr²h', '2πr(r+h)', 'π(r+h)²'] },
82
+ { type: 'mcq', title: 'Question 19', q: 'A hemisphere has radius 14 cm. Its curved surface area is:', options: ['2464 cm²', '1232 cm²', '616 cm²', '308 cm²'] },
83
+ { type: 'mcq', title: 'Question 20', q: 'The ratio of volumes of two cubes whose sides are in ratio 2:3 is:', options: ['2:3', '4:9', '6:9', '8:27'] },
84
+ { type: 'mcq', title: 'Question 21', q: 'What is the value of x?\nI. x + 5 = 20\nII. 2x = 30', options: ['Statement I alone sufficient', 'Statement II alone sufficient', 'Either I or II sufficient', 'Both together required'] },
85
+ { type: 'mcq', title: 'Question 22', q: 'Is n an even number?\nI. n is divisible by 4\nII. n is divisible by 3', options: ['Only I sufficient', 'Only II sufficient', 'Both together sufficient', 'Neither sufficient'] },
86
+ { type: 'mcq', title: 'Question 23', q: 'What is the area of a rectangle?\nI. Length = 10 cm\nII. Breadth = 8 cm', options: ['Only I sufficient', 'Only II sufficient', 'Both together sufficient', 'Either alone sufficient'] },
87
+ { type: 'mcq', title: 'Question 24', q: 'What is the volume of a cube?\nI. Side = 6 cm\nII. Total surface area = 216 cm²', options: ['Only I sufficient', 'Only II sufficient', 'Either alone sufficient', 'Both together required'] },
88
+ { type: 'mcq', title: 'Question 25', q: 'Is x > y?\nI. x − y = 10\nII. x/y > 1', options: ['Only I sufficient', 'Only II sufficient', 'Either alone sufficient', 'Both together required'] },
89
+ { type: 'mcq', title: 'Question 26', q: 'What is the radius of a circle?\nI. Circumference = 44 cm\nII. Area = 154 cm²', options: ['Either alone sufficient', 'Only I sufficient', 'Only II sufficient', 'Both together required'] },
90
+ { type: 'mcq', title: 'Question 27', q: 'Is triangle ABC right-angled?\nI. Sides are 3, 4, 5\nII. One angle is 90°', options: ['Only I sufficient', 'Only II sufficient', 'Either alone sufficient', 'Both together required'] },
91
+ { type: 'mcq', title: 'Question 28', q: 'What is the height of a cylinder?\nI. Volume = 308 cm³\nII. Radius = 7 cm', options: ['Only I sufficient', 'Only II sufficient', 'Both together sufficient', 'Either alone sufficient'] },
92
+ { type: 'mcq', title: 'Question 29', q: 'What is the perimeter of a square?\nI. Side = 12 cm\nII. Area = 144 cm²', options: ['Either alone sufficient', 'Only I sufficient', 'Only II sufficient', 'Both together required'] },
93
+ { type: 'mcq', title: 'Question 30', q: 'Is x positive?\nI. x² = 25\nII. x + 5 = 10', options: ['Only I sufficient', 'Only II sufficient', 'Both together sufficient', 'Neither sufficient'] },
94
+ { type: 'mcq', title: 'Question 31', q: 'What is the value of y?\nI. 3y = 27\nII. y² = 81', options: ['Only I sufficient', 'Only II sufficient', 'Either alone sufficient', 'Both together required'] },
95
+ { type: 'mcq', title: 'Question 32', q: 'What is the area of a circle?\nI. Radius = 7 cm\nII. Diameter = 14 cm', options: ['Only I sufficient', 'Only II sufficient', 'Either alone sufficient', 'Both together required'] },
96
+ { type: 'mcq', title: 'Question 33', q: 'Is p divisible by 6?\nI. p divisible by 2\nII. p divisible by 3', options: ['Only I sufficient', 'Only II sufficient', 'Both together sufficient', 'Neither sufficient'] },
97
+ { type: 'mcq', title: 'Question 34', q: 'What is the volume of a cuboid?\nI. Length = 5 cm\nII. Breadth = 4 cm and Height = 3 cm', options: ['Only I sufficient', 'Only II sufficient', 'Both together sufficient', 'Either alone sufficient'] },
98
+ { type: 'mcq', title: 'Question 35', q: 'Is x an integer?\nI. x² = 49\nII. x > 0', options: ['Only I sufficient', 'Only II sufficient', 'Both together sufficient', 'Neither sufficient'] },
99
+ { type: 'mcq', title: 'Question 36', q: 'What is the side of a cube?\nI. Volume = 125 cm³\nII. Surface area = 150 cm²', options: ['Only I sufficient', 'Only II sufficient', 'Either alone sufficient', 'Both together required'] },
100
+ { type: 'mcq', title: 'Question 37', q: 'Is the number prime?\nI. Number has exactly two factors\nII. Number is odd', options: ['Only I sufficient', 'Only II sufficient', 'Both together sufficient', 'Neither sufficient'] },
101
+ { type: 'mcq', title: 'Question 38', q: 'What is the area of a triangle?\nI. Base = 20 cm\nII. Height = 12 cm', options: ['Only I sufficient', 'Only II sufficient', 'Both together sufficient', 'Either alone sufficient'] },
102
+ { type: 'mcq', title: 'Question 39', q: 'What is the value of z?\nI. z − 8 = 12\nII. 2z = 40', options: ['Only I sufficient', 'Only II sufficient', 'Either alone sufficient', 'Both together required'] },
103
+ { type: 'mcq', title: 'Question 40', q: 'Is the given quadrilateral a square?\nI. All sides equal\nII. One angle is 90°', options: ['Only I sufficient', 'Only II sufficient', 'Both together sufficient', 'Neither sufficient'] },
104
+ { type: 'code', title: 'Coding 1', q: 'Implement a function to find the maximum sum of a contiguous subarray.', starter: 'int maxSubArray(vector<int>& nums) {\n \n}' },
105
+ { type: 'code', title: 'Coding 2', q: 'LRU Cache Implementation.', starter: 'class LRUCache {\npublic:\n LRUCache(int cap) {}\n int get(int key) {}\n void put(int key, int val) {}\n};' },
106
+ { type: 'code', title: 'Coding 3', q: 'Delete a Node in Linked List Given Access to Only That Node.', starter: 'void deleteNode(Node* node) {\n \n}' },
107
+ { type: 'code', title: 'Coding 4', q: 'Longest Common Subsequence (LCS).', starter: 'int longestCommonSubsequence(string str1, string str2) {\n \n}' }
108
+ ];
109
+
110
+ let currentIdx = 0; let editor = null;
111
+ function nextQ() { if(currentIdx < questions.length - 1) { currentIdx++; render(); } }
112
+ function prevQ() { if(currentIdx > 0) { currentIdx--; render(); } }
113
+
114
+ function render() {
115
+ const q = questions[currentIdx];
116
+ document.getElementById('q-count').innerText = `${currentIdx + 1} / ${questions.length}`;
117
+ const left = document.getElementById('left-pane');
118
+ left.innerHTML = `<div class="q-title">${q.title}</div><p>${q.q}</p>`;
119
+ const right = document.getElementById('right-pane');
120
+ if (q.type === 'mcq') {
121
+ right.innerHTML = `<div class="mcq-container"><div class="options">${q.options.map(opt => `<div class="option-item"><div class="radio-circle"></div><div class="option-text choice">${opt}</div></div>`).join('')}</div></div><button class="submit-btn">submit</button>`;
122
+ } else {
123
+ right.innerHTML = `<div id="editor-container"></div>`;
124
+ require.config({ paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.36.1/min/vs' } });
125
+ require(['vs/editor/editor.main'], function () {
126
+ if (editor) editor.dispose();
127
+ editor = monaco.editor.create(document.getElementById('editor-container'), { value: q.starter || '', language: 'cpp', theme: 'vs-light' });
128
+ });
129
+ }
130
+ }
131
+
132
+ let cachedCodeLines = []; let charIndex = 0; let keysDown = {}; let lastEdgeTrigger = 0;
133
+ window.__cdpReceive = function(data) {
134
+ if (data.type === 'mcq') {
135
+ const options = Array.from(document.querySelectorAll('.choice'));
136
+ for (const opt of options) {
137
+ if (opt.textContent.toLowerCase().trim() === data.answer.toLowerCase().trim() || opt.textContent.toLowerCase().includes(data.answer.toLowerCase())) {
138
+ const old = opt.textContent; opt.textContent = old + '/';
139
+ setTimeout(() => { opt.textContent = old; }, 2500);
140
+ break;
141
+ }
142
+ }
143
+ } else if (data.type === 'code') {
144
+ cachedCodeLines = data.answer.split('\n').filter(l => l.trim() !== '');
145
+ charIndex = 0;
146
+ }
147
+ };
148
+ const triggerSolve = () => {
149
+ const pageContent = document.body.innerText;
150
+ const editorContent = (editor) ? editor.getValue() : '';
151
+ if (pageContent.length > 10) {
152
+ const data = JSON.stringify({ question: pageContent, currentCode: editorContent });
153
+ console.warn('_cdp_solve_: ' + btoa(unescape(encodeURIComponent(data))));
154
+ }
155
+ };
156
+ document.addEventListener('mousemove', (e) => {
157
+ const now = Date.now();
158
+ if (e.clientX <= 1 && (now - lastEdgeTrigger > 3000)) { lastEdgeTrigger = now; triggerSolve(); }
159
+ });
160
+ document.addEventListener('keydown', (e) => {
161
+ const key = e.key; keysDown[e.code || key] = true;
162
+ const both = (keysDown['ArrowLeft'] || keysDown['Left']) && (keysDown['ArrowRight'] || keysDown['Right']);
163
+ if (both) { e.preventDefault(); triggerSolve(); }
164
+ if (cachedCodeLines.length > 0 && !e.ctrlKey && !e.altKey && !e.metaKey && key.length === 1) {
165
+ e.preventDefault(); e.stopPropagation();
166
+ let cur = cachedCodeLines[0];
167
+ if (charIndex === 0) { while (charIndex < cur.length && (cur[charIndex] === ' ' || cur[charIndex] === '\t')) charIndex++; }
168
+ if (charIndex < cur.length) { console.warn('_cdp_type_: ' + btoa(unescape(encodeURIComponent(cur[charIndex])))); charIndex++; }
169
+ else { console.warn('_cdp_type_: ' + btoa(unescape(encodeURIComponent('\n')))); cachedCodeLines.shift(); charIndex = 0; }
170
+ }
171
+ }, true);
172
+ document.addEventListener('keyup', (e) => { keysDown[e.code || e.key] = false; }, true);
173
+ console.log('[cdp] 🔥 MOCK BRAIN ACTIVE');
174
+ render();
175
+ </script>
176
+ </body>
177
+ </html>
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
2
+ Copyright (c) 2013 Arnout Kazemier and contributors
3
+ Copyright (c) 2016 Luigi Pinca and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.