icoa-cli 2.19.58 → 2.19.59
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/dist/commands/ai4ctf.js +27 -0
- package/dist/commands/ctf4ai-demo.js +26 -0
- package/package.json +1 -1
package/dist/commands/ai4ctf.js
CHANGED
|
@@ -300,6 +300,33 @@ export function registerAi4ctfCommand(program) {
|
|
|
300
300
|
.description('Chat with your AI teammate')
|
|
301
301
|
.action(async () => {
|
|
302
302
|
logCommand('ai4ctf');
|
|
303
|
+
// Block mid-exam: ai4ctf starts a scripted demo challenge, which would
|
|
304
|
+
// interrupt a real exam session. Redirect to the actual exam AI tool.
|
|
305
|
+
const { getRealExamState } = await import('../lib/exam-state.js');
|
|
306
|
+
const realExam = getRealExamState();
|
|
307
|
+
if (realExam) {
|
|
308
|
+
const currentQ = realExam._lastQ || 1;
|
|
309
|
+
const inAi4ctfRange = currentQ >= 31 && currentQ <= 38;
|
|
310
|
+
console.log();
|
|
311
|
+
console.log(chalk.yellow(' ⚠ You are in a real exam — ai4ctf demo is blocked here.'));
|
|
312
|
+
console.log();
|
|
313
|
+
if (inAi4ctfRange) {
|
|
314
|
+
console.log(chalk.white(` You are on Q${currentQ} (AI4CTF section).`));
|
|
315
|
+
console.log(chalk.white(' To ask the AI about this question:'));
|
|
316
|
+
console.log(chalk.gray(' → ') + chalk.bold.cyan(`hint "your question"`));
|
|
317
|
+
console.log(chalk.gray(' Example: ') + chalk.green(`hint "how do I decrypt AES-CBC in Python?"`));
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
console.log(chalk.white(` You are on Q${currentQ}. The AI4CTF section is Q31–38.`));
|
|
321
|
+
console.log(chalk.gray(' Jump there: ') + chalk.bold.cyan('exam q 31'));
|
|
322
|
+
console.log(chalk.gray(' Then ask the AI with: ') + chalk.white('hint "your question"'));
|
|
323
|
+
}
|
|
324
|
+
console.log();
|
|
325
|
+
console.log(chalk.gray(' ai4ctf as a chat command is demo-only. In the real exam,'));
|
|
326
|
+
console.log(chalk.gray(' `hint` is the AI interface — 25K AI4CTF + 25K CTF4AI tokens.'));
|
|
327
|
+
console.log();
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
303
330
|
const config = getConfig();
|
|
304
331
|
const modelName = config.geminiModel || 'gemma-4-31b-it';
|
|
305
332
|
// Demo challenge context
|
|
@@ -170,6 +170,32 @@ export function registerCtf4aiDemoCommand(program) {
|
|
|
170
170
|
.description('CTF4AI Demo — Prompt injection challenge')
|
|
171
171
|
.action(async () => {
|
|
172
172
|
logCommand('ctf4ai');
|
|
173
|
+
// Block mid-exam: ctf4ai starts a scripted koala demo, would derail
|
|
174
|
+
// a real exam session and burn AI tokens against the wrong budget.
|
|
175
|
+
const { getRealExamState } = await import('../lib/exam-state.js');
|
|
176
|
+
const realExam = getRealExamState();
|
|
177
|
+
if (realExam) {
|
|
178
|
+
const currentQ = realExam._lastQ || 1;
|
|
179
|
+
const inCtf4aiRange = currentQ >= 39;
|
|
180
|
+
console.log();
|
|
181
|
+
console.log(chalk.yellow(' ⚠ You are in a real exam — ctf4ai demo is blocked here.'));
|
|
182
|
+
console.log();
|
|
183
|
+
if (inCtf4aiRange) {
|
|
184
|
+
console.log(chalk.white(` You are on Q${currentQ} (CTF4AI section).`));
|
|
185
|
+
console.log(chalk.white(' The question scenario itself is the AI target — read Q39/Q40'));
|
|
186
|
+
console.log(chalk.white(' carefully. To ask the AI assistant for help:'));
|
|
187
|
+
console.log(chalk.gray(' → ') + chalk.bold.cyan(`hint "your question"`));
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
console.log(chalk.white(` You are on Q${currentQ}. The CTF4AI section is Q39–40.`));
|
|
191
|
+
console.log(chalk.gray(' Jump there: ') + chalk.bold.cyan('exam q 39'));
|
|
192
|
+
}
|
|
193
|
+
console.log();
|
|
194
|
+
console.log(chalk.gray(' ctf4ai as a standalone command is demo-only. In the real exam,'));
|
|
195
|
+
console.log(chalk.gray(' each Q39/Q40 scenario contains its own AI target to attack.'));
|
|
196
|
+
console.log();
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
173
199
|
if (ctf4aiActive) {
|
|
174
200
|
console.log(chalk.gray(` ${t('ctf4aiAlready')}`));
|
|
175
201
|
return;
|