icoa-cli 2.19.30 → 2.19.31
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 +34 -20
- package/package.json +1 -1
package/dist/commands/ai4ctf.js
CHANGED
|
@@ -31,24 +31,33 @@ function drawTokenBar() {
|
|
|
31
31
|
console.log(chalk.gray(' Tokens: ') + color('█'.repeat(filled)) + chalk.gray('░'.repeat(empty)) + chalk.gray(` ${used}/${cap} (${pct}%)`));
|
|
32
32
|
}
|
|
33
33
|
const DEMO_FLAG = 'icoa{w3lc0me_2_ai4ctf}';
|
|
34
|
-
// Scripted hints for the built-in Base64 demo challenge.
|
|
35
|
-
//
|
|
36
|
-
//
|
|
34
|
+
// Scripted hints for the built-in Base64 demo challenge. The hint philosophy:
|
|
35
|
+
// - a: nudge you toward the fingerprint (padding, charset).
|
|
36
|
+
// - b: tell you the encoding name, nothing more. No shell command.
|
|
37
|
+
// - c: for simple challenges, c deliberately adds no new info — hint b was
|
|
38
|
+
// already enough. Instead c explains the hint principle and reminds the
|
|
39
|
+
// user how to run a shell command inside ai4ctf (the `!` prefix).
|
|
40
|
+
// This mirrors real competition behavior where trivial challenges cap at hint b.
|
|
37
41
|
const DEMO_HINTS = {
|
|
38
42
|
a: [
|
|
39
|
-
'The string ends with
|
|
40
|
-
'That pattern is a fingerprint — you have seen it before.
|
|
43
|
+
'The string ends with "==" and uses only letters, digits, "+", "/", and "=".',
|
|
44
|
+
'That pattern is a fingerprint — you have seen it before.',
|
|
45
|
+
'Where is "=" typically used as padding?',
|
|
41
46
|
],
|
|
42
47
|
b: [
|
|
43
|
-
'
|
|
44
|
-
'You can decode it right in this shell — try:',
|
|
45
|
-
' !echo aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ== | base64 -d',
|
|
46
|
-
'Or just ask the AI: "decode this for me".',
|
|
48
|
+
'This is Base64 encoded. Decode the string to find the flag.',
|
|
47
49
|
],
|
|
48
50
|
c: [
|
|
49
|
-
'
|
|
50
|
-
'
|
|
51
|
-
'
|
|
51
|
+
'Hints never give you the answer directly — they only point you in the right direction.',
|
|
52
|
+
'For simple challenges like this one, hint c adds nothing extra:',
|
|
53
|
+
'hint b already tells you everything you need.',
|
|
54
|
+
'',
|
|
55
|
+
'If you do not remember how to decode Base64, ask your AI teammate —',
|
|
56
|
+
'just type a question like: how do I decode Base64 on the command line?',
|
|
57
|
+
'',
|
|
58
|
+
'To run a shell command inside ai4ctf, prefix it with "!". For example:',
|
|
59
|
+
'',
|
|
60
|
+
' !echo aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ== | base64 -d',
|
|
52
61
|
],
|
|
53
62
|
};
|
|
54
63
|
function showDemoHint(tier) {
|
|
@@ -59,17 +68,21 @@ function showDemoHint(tier) {
|
|
|
59
68
|
console.log(color.bold(` ▸ ${tierLabel} `) + chalk.gray(title));
|
|
60
69
|
console.log();
|
|
61
70
|
for (const line of DEMO_HINTS[tier]) {
|
|
62
|
-
|
|
71
|
+
if (line === '')
|
|
72
|
+
console.log();
|
|
73
|
+
else
|
|
74
|
+
console.log(chalk.white(' ' + line));
|
|
63
75
|
}
|
|
64
76
|
console.log();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
console.log(
|
|
77
|
+
if (tier === 'a') {
|
|
78
|
+
console.log(chalk.gray(' Stuck? Try: ') + chalk.cyan('hint b'));
|
|
79
|
+
console.log();
|
|
68
80
|
}
|
|
69
|
-
else {
|
|
70
|
-
console.log(chalk.gray('
|
|
81
|
+
else if (tier === 'b') {
|
|
82
|
+
console.log(chalk.gray(' Really stuck? Try: ') + chalk.cyan('hint c'));
|
|
83
|
+
console.log();
|
|
71
84
|
}
|
|
72
|
-
|
|
85
|
+
// No trailing CTA after hint c — the content itself explains everything.
|
|
73
86
|
}
|
|
74
87
|
export async function handleChatMessage(input) {
|
|
75
88
|
if (!chatSession)
|
|
@@ -248,7 +261,8 @@ export function registerAi4ctfCommand(program) {
|
|
|
248
261
|
console.log(chalk.bold.white(' 👉 New here? Start with the hints in order:'));
|
|
249
262
|
console.log(' ' + chalk.cyan('hint a') + chalk.gray(' → nudge'));
|
|
250
263
|
console.log(' ' + chalk.cyan('hint b') + chalk.gray(' → technique'));
|
|
251
|
-
console.log(' ' + chalk.cyan('hint c') + chalk.gray(' →
|
|
264
|
+
console.log(' ' + chalk.cyan('hint c') + chalk.gray(' → principle + shell reminder'));
|
|
265
|
+
console.log(chalk.gray(' (hints guide you — they never give the answer directly)'));
|
|
252
266
|
console.log();
|
|
253
267
|
console.log(chalk.white(' Or chat freely with your AI teammate — ask anything'));
|
|
254
268
|
console.log(chalk.gray(' about the challenge. Example: ') + chalk.white('"what encoding is this?"'));
|