icoa-cli 2.19.103 → 2.19.105

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/repl.js CHANGED
@@ -1 +1 @@
1
- import{createInterface as o}from"node:readline";import{spawn as e,execSync as t}from"node:child_process";import chalk from"chalk";import{isConnected as n,getConfig as l,saveConfig as s}from"./lib/config.js";import{isActivated as a,activateToken as r,isFreeCommand as i,isDeviceMatch as c,recordExit as g,recordResume as y,isFirstRunOrUpgrade as m,markVersionSeen as p}from"./lib/access.js";import{setReplMode as d}from"./lib/ui.js";import{isChatActive as h,handleChatMessage as u}from"./commands/ai4ctf.js";import{isCtf4aiActive as w,handleCtf4aiMessage as f}from"./commands/ctf4ai-demo.js";import{getExamState as b,getRealExamState as x,getDemoState as v}from"./lib/exam-state.js";import{getDemoStats as C}from"./lib/demo-stats.js";import{isExamSetupComplete as k}from"./lib/exam-setup.js";import{DEMO_PICK_SIZE as I,DEMO_POOL_SIZE as A}from"./lib/demo-exam.js";import{isNativeWindowsCmd as T}from"./lib/platform.js";import{resetTerminalTheme as S}from"./lib/theme.js";import{ensureSandbox as $,runInSandbox as O,isDockerAvailable as q}from"./lib/sandbox.js";import{logCommand as L}from"./lib/logger.js";import{startLogSync as j,stopLogSync as E}from"./lib/log-sync.js";import{existsSync as P,mkdirSync as R}from"node:fs";import{join as N}from"node:path";import{homedir as D}from"node:os";function F(){return x()?chalk.cyan("exam> "):v()?chalk.yellow("demo> "):chalk.green("icoa> ")}const M=N(D(),"icoa-workspace");function U(){return P(M)||R(M,{recursive:!0}),M}const z=new Set(["sudo","su","doas","pkexec","brew","apt","apt-get","yum","choco","npm","npx","pip","pip3","shutdown","reboot","halt","mkfs","fdisk","dd","iptables","ufw"]),B="__REPL_NO_EXIT__",W="2.5.1";function Q(){const o=C(),e=k(),n=`Free practice — ${I} questions (from pool of ${A})`,l=T();if(console.log(),console.log(" "+chalk.cyan.bold("[Selection Mode]")),console.log(),l)console.log(chalk.gray(" Platform: ")+chalk.white("Windows cmd.exe")+chalk.gray(" — routed to Paper C (MCQ-only, 45 min, 70 pts, zero extra tools)")),console.log();else if(o.attempts>0){const o=function(){const o=["python3.12 --version","/opt/homebrew/opt/python@3.12/bin/python3.12 --version","/usr/local/opt/python@3.12/bin/python3.12 --version","python3 --version","python --version","py -3.12 --version","py -3 --version"];let e="",n="missing";for(const l of o)try{const o=t(l,{encoding:"utf-8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).trim().replace("Python ",""),[s,a]=o.split(".").map(Number);if(3===s&&12===a)return{ok:!0,version:o,status:"ok"};e=o,n=3===s&&a>=10&&a<12?"old":3===s&&a>12?"new":"missing"}catch{}return{ok:"missing"!==n,version:e,status:n}}();"missing"===o.status?(console.log(chalk.yellow(" ⚠ Python not detected. For exam practical questions:")),console.log(chalk.gray(" → ")+chalk.bold.cyan("env python")+chalk.gray(" (platform install guide)")),console.log()):"new"===o.status&&(console.log(chalk.yellow(` ⚠ Python ${o.version} may lack CTF wheels. Python 3.12 recommended:`)),console.log(chalk.gray(" → ")+chalk.bold.cyan("env python")+chalk.gray(" (install guide)")),console.log())}if(0===o.attempts)console.log(chalk.white(" New here? Start with ")+chalk.bold.cyan("demo")+chalk.white(" — it takes a few minutes.")),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.bold.cyan(" demo")+chalk.gray(` ${n}`)),console.log(chalk.white(" lang")+chalk.gray(" List all supported languages")),console.log(chalk.white(" lang es")+chalk.gray(" Switch language (e.g. lang es, lang zh, lang fr)")),console.log(chalk.gray(" ─────────────────────────────────────────────"));else if(e||l){const e=1===o.attempts?"attempt":"attempts";o.attempts>0&&console.log(chalk.green(" ✓ Demo completed ")+chalk.gray(`(${o.attempts} ${e})`)),l||console.log(chalk.green(" ✓ Environment ready")),console.log(chalk.yellow(" → Enter your exam token to begin.")),console.log(chalk.gray(" (10-char code from your organizer, starts with your country code like ")+chalk.cyan("UA")+chalk.gray(" — case-insensitive)")),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.bold.yellow(" exam <token>")+chalk.gray(" Enter exam (primary action — use your organizer-issued token)")),console.log(chalk.gray(" format: ")+chalk.white("exam UAxxxxxxxx")+chalk.gray(" (2-letter country prefix + 8 chars)")),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.gray(" Other commands:")),console.log(chalk.white(" demo")+chalk.gray(` ${n}`)),l||console.log(chalk.white(" exam setup")+chalk.gray(" Re-verify tool environment")),console.log(chalk.white(" lang")+chalk.gray(" List all supported languages")),console.log(chalk.white(" lang es")+chalk.gray(" Switch language (e.g. lang es, lang zh, lang fr)")),console.log(chalk.gray(" ─────────────────────────────────────────────"))}else{const e=1===o.attempts?"attempt":"attempts";console.log(chalk.green(" ✓ Demo completed ")+chalk.gray(`(${o.attempts} ${e}${o.bestPercentage>0?` · best ${o.bestPercentage}%`:""})`)),console.log(chalk.yellow(" → Next: prepare your environment for the real exam.")),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.white(" demo")+chalk.gray(` ${n}`)),console.log(chalk.bold.yellow(" exam setup")+chalk.gray(" Install tools for national selection (~150MB)")),console.log(chalk.white(" lang")+chalk.gray(" List all supported languages")),console.log(chalk.white(" lang es")+chalk.gray(" Switch language (e.g. lang es, lang zh, lang fr)")),console.log(chalk.gray(" ─────────────────────────────────────────────"))}console.log(chalk.gray(" ")+chalk.gray("Tip: ")+chalk.cyan("help")+chalk.gray(" for commands · ")+chalk.cyan("Ctrl+C")+chalk.gray(" pauses · ")+chalk.cyan("quit")+chalk.gray(" closes")),console.log()}export async function startRepl(e,x){const v=l(),C=n(),k=process.exit.bind(process),I=a();if(v.demoCleanedForVersion!==W){try{const{existsSync:o,unlinkSync:e}=await import("node:fs"),{join:t}=await import("node:path"),{getIcoaDir:n}=await import("./lib/config.js"),l=t(n(),"demo-state.json");o(l)&&e(l)}catch{}s({demoCleanedForVersion:W})}const{select:A,confirm:T}=await import("@inquirer/prompts"),_=v.mode||"",V=[{name:` ${chalk.bold("National Selection")} ${chalk.gray("—")} ${chalk.gray("demo, exam (lightweight)")}`,value:"selection"},{name:` ${chalk.bold("International Olympiad")} ${chalk.gray("—")} ${chalk.gray("CTF × AI (~500MB, advanced)")}`,value:"olympiad"},{name:` ${chalk.bold("National/Regional Partner")} ${chalk.gray("—")} ${chalk.gray("organizer tools (tokens, competitions)")}`,value:"organizer"},{name:` ${chalk.gray("About ICOA")} ${chalk.gray("·")} ${chalk.gray("Info & contact")}`,value:"about"}];console.log(chalk.gray(" Use ")+chalk.yellow("↑")+chalk.gray(" or ")+chalk.yellow("↓")+chalk.gray(" to select, ")+chalk.yellow("Enter")+chalk.gray(" to confirm.")),console.log();let G="";for(;!G;){const o=await A({message:"Mode",choices:V,default:_||"selection"});"about"!==o?G=o:(console.clear(),console.log(),console.log(chalk.cyan(" ═══════════════════════════════════════════════════")),console.log(chalk.bold.yellow(" ICOA")+chalk.white(" — AI-Native CLI OS for Cyber & AI Security")),console.log(chalk.gray(" Olympiad & Competition · K-12 to University")),console.log(chalk.cyan(" ───────────────────────────────────────────────────")),console.log(),console.log(chalk.bold.white(" What Makes ICOA Different")),console.log(chalk.gray(" · AI-native AI teammate, AI adversary, AI translation")),console.log(chalk.gray(" · CLI OS Complete competition environment in terminal")),console.log(chalk.gray(" · 110 tools pwntools, z3, gdb, nmap, sleuthkit... pre-configured")),console.log(chalk.gray(" · Global scale 15,000+ concurrent exams · 15 languages")),console.log(),console.log(chalk.bold.white(" Competition Format")),console.log(" "+chalk.green.bold("AI4CTF")+chalk.gray(" [Day 1] AI as teammate — 5hr jeopardy CTF")),console.log(" "+chalk.red.bold("CTF4AI")+chalk.gray(" [Day 2] Challenge AI — adversarial ML, red-team")),console.log(),console.log(chalk.white(" Sydney, Australia")+chalk.gray(" · Jun 27 - Jul 2, 2026 · 40+ countries")),console.log(),console.log(chalk.bold.white(" Organized by")+chalk.gray(" ASRA (Australia) · ICO Foundation Inc")),console.log(chalk.bold.white(" Contact ")+chalk.cyan(" australia@icoa2026.au · accreditation@icoa2026.au")),console.log(chalk.bold.white(" Website ")+chalk.cyan.underline(" https://icoa2026.au")),console.log(chalk.cyan(" ═══════════════════════════════════════════════════")),console.log(),console.log(chalk.gray(" Press ")+chalk.yellow("Enter")+chalk.gray(" to return...")),await new Promise(o=>{const e=t=>{process.stdin.removeListener("data",e),process.stdin.isTTY&&process.stdin.setRawMode&&process.stdin.setRawMode(!1),process.stdin.pause(),o()};process.stdin.isTTY&&process.stdin.setRawMode&&process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.once("data",e)}),console.clear())}if("olympiad"===G&&"olympiad"!==_&&(console.log(),console.log(chalk.yellow(" This mode will download ~500MB of CTF tools and AI models.")),await T({message:"Continue?",default:!0})||(G="selection",console.log(chalk.gray(" Switched to National Selection mode.")))),G!==_&&s({mode:G}),console.log(),"olympiad"===G&&m(W)){p(W),console.log(chalk.gray(" Checking competition environment..."));const{execSync:o}=await import("node:child_process"),e=[{name:"pwntools",cmd:'python3 -c "import pwn"'},{name:"z3-solver",cmd:'python3 -c "import z3"'},{name:"numpy",cmd:'python3 -c "import numpy"'},{name:"requests",cmd:'python3 -c "import requests"'}];let t=0;for(const n of e)try{o(n.cmd,{stdio:"ignore"})}catch{t++}if(t>0){console.log(chalk.yellow(` ${t} core libraries missing.`));try{const{confirm:o}=await import("@inquirer/prompts");if(await o({message:" Install competition Python libraries now?",default:!0,theme:{prefix:"",style:{message:o=>chalk.green(o),defaultAnswer:o=>chalk.green(o)}}})){console.log();const{execSync:o}=await import("node:child_process");o("icoa env setup",{stdio:"inherit"})}}catch{console.log(chalk.gray(" Run ")+chalk.white("env setup")+chalk.gray(" later to install."))}console.log()}else console.log(chalk.green(" All core libraries ready.")),console.log()}if(x){const o=y();if(o){const e=Math.floor(o.awaySeconds/60),t=o.awaySeconds%60;console.log(chalk.yellow(` Session resumed. Away: ${e}m ${t}s | Total exits: ${o.exitCount}`)),console.log()}}"selection"===G?Q():"organizer"===G?(console.log(chalk.yellow.bold(" [National/Regional Partner]")),console.log(),console.log(chalk.bold.white(" ██╗ ██████╗ ██████╗ █████╗")),console.log(chalk.bold.white(" ██║██╔════╝██╔═══██╗██╔══██╗")),console.log(chalk.bold.white(" ██║██║ ██║ ██║███████║")),console.log(chalk.bold.white(" ██║██║ ██║ ██║██╔══██║")),console.log(chalk.bold.white(" ██║╚██████╗╚██████╔╝██║ ██║")),console.log(chalk.bold.white(" ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝")),console.log(),console.log(chalk.yellow(" International Cyber Olympiad in AI 2026")),console.log(chalk.bold.magenta(" The World's First AI-Native CLI Operating System")),console.log(chalk.bold.magenta(" for Cybersecurity & AI Security Competition")),console.log(chalk.bold.magenta(" and Olympiad for K-12")),console.log(chalk.gray(" Sydney, Australia · Jun 27 - Jul 2, 2026")),console.log(),console.log(chalk.white(" Vision")),console.log(chalk.gray(" Building a global pipeline for youth cyber & AI")),console.log(chalk.gray(" security talent through education and competition.")),console.log(),console.log(chalk.white(" Capacity")),console.log(chalk.gray(" 15,000+ concurrent online examinations")),console.log(chalk.gray(" National selection, training, and education support")),console.log(),console.log(chalk.white(" Olympic Spirit")),console.log(chalk.gray(" Excellence · Friendship · Respect")),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.white(" New country accreditation & support:")),console.log(chalk.cyan(" australia@icoa2026.au")),console.log(chalk.cyan(" accreditation@icoa2026.au")),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(),C?(console.log(chalk.green(` Logged in as ${v.userName}`)),console.log(chalk.white(" exam list")+chalk.gray(" Manage exams")),console.log(chalk.white(" logout")+chalk.gray(" Disconnect"))):console.log(chalk.white(" join <url>")+chalk.gray(" Connect to manage exams")),console.log()):I&&!c()?(console.log(chalk.red(" Token was activated on a different device.")),console.log(chalk.gray(" Contact organizer for assistance.")),console.log()):C?(console.log(chalk.green.bold(` Welcome back, ${v.userName}!`)),console.log(chalk.gray(` Connected to ${v.ctfdUrl}`)),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.white(" Ready to compete? Start here:")),console.log(),console.log(chalk.bold.cyan(" challenges")+chalk.gray(" Browse challenges by category")),console.log(chalk.white(" status")+chalk.gray(" Your score & hint budget")),console.log(chalk.white(" scoreboard")+chalk.gray(" Live rankings")),console.log(chalk.white(" help")+chalk.gray(" Full command list")),console.log(),console.log(chalk.gray(" Tool environment:")),console.log(chalk.white(" env")+chalk.gray(" See which of the 110 CTF tools are installed")),console.log(chalk.white(" env setup")+chalk.gray(" Install anything missing (~5 min, one-time)")),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.gray(" Tip: ")+chalk.cyan("help")+chalk.gray(" · ")+chalk.cyan("Ctrl+C")+chalk.gray(" pauses · ")+chalk.cyan("quit")+chalk.gray(" closes")),console.log()):I?(U(),console.log(chalk.green.bold(" Welcome, competitor!")),console.log(chalk.gray(` Workspace: ${M}`)),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.white(" Get started:")),console.log(),console.log(chalk.white(" Step 1 ")+chalk.bold.cyan("join <url>")+chalk.gray(" Connect to competition server")),console.log(chalk.white(" Step 2 ")+chalk.bold.cyan("challenges")+chalk.gray(" Browse & solve challenges")),console.log(chalk.white(" Step 3 ")+chalk.bold.cyan("hint")+chalk.gray(" Ask AI when stuck")),console.log(),console.log(chalk.gray(" Before Step 1 — make sure your tools are ready:")),console.log(chalk.white(" env")+chalk.gray(" See which of the 110 CTF tools are installed")),console.log(chalk.white(" env setup")+chalk.gray(" Install anything missing (~5 min, one-time)")),console.log(),console.log(chalk.gray(" Also: ")+chalk.white("help")+chalk.gray(" all commands")),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.gray(" Tip: ")+chalk.cyan("Ctrl+C")+chalk.gray(" pauses · ")+chalk.cyan("exit")+chalk.gray(" → menu · ")+chalk.cyan("quit")+chalk.gray(" closes CLI")),console.log()):(console.log(chalk.bold.white(" Welcome to ICOA CLI — International Olympiad")),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.white(" To begin, activate your competition token:")),console.log(),console.log(chalk.bold.cyan(" activate <token>")),console.log(),console.log(chalk.gray(" While waiting, explore:")),console.log(chalk.white(" ref linux")+chalk.gray(" Quick reference for Linux")),console.log(chalk.white(" ref web")+chalk.gray(" Quick reference for Web")),console.log(chalk.white(" env")+chalk.gray(" See which of the 110 CTF tools are installed")),console.log(chalk.white(" env setup")+chalk.gray(" Install anything missing (~5 min, one-time)")),console.log(chalk.white(" help")+chalk.gray(" All available commands")),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.gray(" Tip: ")+chalk.cyan("Ctrl+C")+chalk.gray(" pauses · ")+chalk.cyan("exit")+chalk.gray(" → menu · ")+chalk.cyan("quit")+chalk.gray(" closes CLI")),console.log()),e.exitOverride(),e.configureOutput({writeErr:()=>{},writeOut:o=>{console.log(o)}});const J=o({input:process.stdin,output:process.stdout,prompt:F(),terminal:!0});let K=!1;d(!0),j();const Z=J.prompt.bind(J);J.prompt=o=>{h()||w()||J.setPrompt(F()),Z(o)},J.prompt(),J.on("line",async o=>{if(K)return;const n=o.trim();if(!n)return J.setPrompt(h()?chalk.magenta("ai4ctf> "):F()),void J.prompt();if(h()){K=!0;const o=await u(n);return K=!1,"exit"===o&&J.setPrompt(F()),void J.prompt()}if(w()){K=!0;const o=await f(n);return K=!1,"exit"!==o&&"solved"!==o||J.setPrompt(F()),void J.prompt()}if(L(n),"exit"===n)return b()?(console.log(),console.log(chalk.yellow(" ⚠ An exam is in progress.")),console.log(chalk.white(" To return to menu without losing progress, type: ")+chalk.bold.cyan("back")),console.log(chalk.white(" To fully close ICOA CLI, type: ")+chalk.bold.cyan("quit")),console.log(chalk.gray(" Your progress is auto-saved either way.")),console.log(),void J.prompt()):(console.log(),console.log(chalk.gray(" ")+chalk.white("exit")+chalk.gray(" returns to the main menu. To fully close ICOA CLI, type ")+chalk.bold.cyan("quit")+chalk.gray(".")),"selection"===G&&Q(),void J.prompt());if("quit"===n||"q"===n||"quit confirm"===n){const o=b();return o&&"demo-free"!==o.session.examId&&"quit confirm"!==n?(console.log(),console.log(chalk.yellow(" ⚠ A real exam is in progress.")),console.log(chalk.gray(" Your answers are auto-saved on the server, but the exam timer keeps ticking")),console.log(chalk.gray(" on the server side even if you close the CLI.")),console.log(),console.log(chalk.white(" To leave the CLI but keep the exam alive, type: ")+chalk.bold.cyan("back")),console.log(chalk.gray(" (recommended — you can resume with ")+chalk.cyan("exam q 1")+chalk.gray(" after relaunching icoa)")),console.log(),console.log(chalk.white(" To really close ICOA CLI, type: ")+chalk.bold.cyan("quit confirm")),console.log(),void J.prompt()):(o&&"demo-free"===o.session.examId&&(console.log(),console.log(chalk.gray(" Demo paused. Resume with: ")+chalk.white("demo")+chalk.gray(" (fresh) or ")+chalk.white("exam q 1")+chalk.gray(" (continue)."))),E(),g(),console.log(chalk.gray(" Session saved. Use ")+chalk.white("icoa --resume")+chalk.gray(" to continue.")),S(),void k(0))}if("back"===n||"menu"===n){const o=b(),e=o&&"demo-free"!==o.session.examId,t=o&&"demo-free"===o.session.examId&&(()=>{const e=new Date(o.session.startedAt||0).getTime();return Date.now()-e<18e5})();if(e)console.log(),console.log(chalk.gray(" Exam paused. Your progress is saved.")),console.log(chalk.white(" Resume: exam q 1")+chalk.gray(" · ")+chalk.white("exam review")+chalk.gray(" · ")+chalk.white("exam submit")),console.log();else if(t){const e=Object.keys(o.answers).length,t=o.session.questionCount;console.log(),console.log(chalk.gray(` Demo paused (${e}/${t} answered). Resume with: `)+chalk.white("exam q 1")),console.log(chalk.gray(" Or type ")+chalk.white("demo")+chalk.gray(" to restart.")),console.log()}else{if(o&&"demo-free"===o.session.examId){const{clearExamState:o}=await import("./lib/exam-state.js");o("demo-free")}const e=l();fetch("https://practice.icoa2026.au/api/icoa/demo-stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"post-report-back",lang:e.language||"en",timestamp:(new Date).toISOString()}),signal:AbortSignal.timeout(5e3)}).catch(()=>{}),"selection"===G?Q():console.log(chalk.gray(" Already at main menu."))}return void J.prompt()}if("help"===n||"?"===n){if(b()){K=!0;try{await e.parseAsync(["node","icoa","exam","help"])}catch{}return K=!1,void J.prompt()}return function(o,e="olympiad"){console.log(),"selection"===e||"organizer"===e?(console.log(chalk.bold.white(" Exam")),console.log(chalk.white(" join <url> ")+chalk.gray("Connect to exam server")),console.log(chalk.white(" exam list ")+chalk.gray("Available exams")),console.log(chalk.white(" exam start <id> ")+chalk.gray("Begin an exam")),console.log(chalk.white(" exam q [n] ")+chalk.gray("View questions")),console.log(chalk.white(" exam answer <n> <X> ")+chalk.gray("Answer question")),console.log(chalk.white(" exam review ")+chalk.gray("Review all answers")),console.log(chalk.white(" exam submit ")+chalk.gray("Submit for grading")),console.log(chalk.white(" exam result ")+chalk.gray("View your score")),console.log(),console.log(chalk.bold.white(" System")),console.log(chalk.white(" ref [topic] ")+chalk.gray("Quick reference")),console.log(chalk.white(" setup ")+chalk.gray("Settings / switch mode")),console.log(chalk.white(" lang [code] ")+chalk.gray("Switch language")),console.log(chalk.white(" clear ")+chalk.gray("Clear screen")),console.log(chalk.white(" exit ")+chalk.gray("Quit")),console.log()):o?(console.log(chalk.cyan(" ═══════════════════════════════════════════════")),console.log(chalk.bold.white(" How it works")),console.log(),console.log(chalk.gray(" 1. Browse ")+chalk.white("challenges")+chalk.gray(" and pick one")),console.log(chalk.gray(" 2. ")+chalk.white("open <id>")+chalk.gray(" to read the challenge")),console.log(chalk.gray(" 3. Use ")+chalk.white("hint")+chalk.gray(" / ")+chalk.white("hint-b")+chalk.gray(" / ")+chalk.white("hint-c")+chalk.gray(" when stuck")),console.log(chalk.gray(" 4. ")+chalk.white("submit <id> icoa{flag}")+chalk.gray(" to score points")),console.log(chalk.gray(" 5. Check ")+chalk.white("scoreboard")+chalk.gray(" to track your rank")),console.log(chalk.cyan(" ═══════════════════════════════════════════════")),console.log(),console.log(chalk.bold.white(" Competition")),console.log(chalk.white(" join <url> ")+chalk.gray("Connect to CTFd")),console.log(chalk.white(" challenges (ch) ")+chalk.gray("List challenges by category")),console.log(chalk.white(" open <id> ")+chalk.gray("Read challenge + get next steps")),console.log(chalk.white(" submit <id> <flag> ")+chalk.gray("Submit a flag")),console.log(chalk.white(" scoreboard (sb) ")+chalk.gray("Live rankings")),console.log(chalk.white(" status ")+chalk.gray("Your score, budget & timer")),console.log(chalk.white(" time ")+chalk.gray("Countdown timer")),console.log(),console.log(chalk.bold.white(" AI Teammate")+chalk.gray(" — 3 levels, use wisely")),console.log(chalk.white(' hint "question" ')+chalk.gray("Level A — General guidance (50 uses)")),console.log(chalk.white(' hint-b "question" ')+chalk.gray("Level B — Deep analysis (10 uses)")),console.log(chalk.white(' hint-c "question" ')+chalk.gray("Level C — Critical assist (2 uses)")),console.log(chalk.white(" hint budget ")+chalk.gray("Check remaining uses")),console.log(chalk.white(" ai4ctf ")+chalk.gray("Free-chat with AI (no limit)")),console.log(),console.log(chalk.bold.white(" Tools")),console.log(chalk.white(" ref [topic] ")+chalk.gray("Quick reference (linux, web, crypto...)")),console.log(chalk.white(" shell ")+chalk.gray("Docker sandbox")),console.log(chalk.white(" files <id> ")+chalk.gray("Download challenge files")),console.log(chalk.white(" connect <id> ")+chalk.gray("Connect to remote target")),console.log(chalk.white(" note [text] ")+chalk.gray("Personal notepad")),console.log(chalk.white(" log ")+chalk.gray("Session history")),console.log(),console.log(chalk.bold.white(" System")),console.log(chalk.white(" setup ")+chalk.gray("Configure settings")),console.log(chalk.white(" lang [code] ")+chalk.gray("Switch language (15 supported)")),console.log(chalk.white(" logout ")+chalk.gray("Disconnect")),console.log(chalk.white(" clear ")+chalk.gray("Clear screen")),console.log(chalk.white(" exit ")+chalk.gray("Quit (session saved)")),console.log()):(console.log(chalk.bold.yellow(" Restricted Mode — activate with a token to unlock all commands")),console.log(),console.log(chalk.white(" activate <token> ")+chalk.gray("Unlock full access")),console.log(chalk.white(" ref [topic] ")+chalk.gray("Quick reference")),console.log(chalk.white(" exit ")+chalk.gray("Quit")),console.log())}(a(),G),void J.prompt()}if("more help"===n.toLowerCase()&&b()){K=!0;try{await e.parseAsync(["node","icoa","exam","more-help"])}catch{}return K=!1,void J.prompt()}if("continue"===n.toLowerCase())return console.log(),console.log(chalk.green.bold(" ═══ AI4CTF — AI as Your Teammate ═══")),console.log(),console.log(chalk.white(" In AI4CTF, you solve cybersecurity challenges")),console.log(chalk.white(" with AI by your side.")),console.log(),console.log(chalk.white(" In competition, you get AI help at 3 levels:")),console.log(chalk.yellow(" hint a")+chalk.gray(" General guidance (50 uses)")),console.log(chalk.yellow(" hint b")+chalk.gray(" Deep analysis (10 uses)")),console.log(chalk.yellow(" hint c")+chalk.gray(" Critical assist (2 uses)")),console.log(),console.log(chalk.white(" Try it now! Type: ")+chalk.bold.green("ai4ctf")),console.log(chalk.gray(' Chat freely with your AI teammate. Type "exit" when done.')),console.log(),console.log(chalk.gray(" After ai4ctf, try: ")+chalk.bold.red("ctf4ai")+chalk.gray(' — trick the AI into saying "koala"')),console.log(),void J.prompt();if(/^ICOA-[A-Z]{2,3}-\d{1,6}$/i.test(n.trim())){K=!0;try{await e.parseAsync(["node","icoa","exam","token",n.trim()])}catch{}return K=!1,void J.prompt()}if(/^[A-Z]{2}[0-9A-HJKMNP-TV-Z]{8}$/i.test(n.trim())){K=!0;try{await e.parseAsync(["node","icoa","exam","token",n.trim().toUpperCase()])}catch{}return K=!1,void J.prompt()}const s=n.match(/^exam\s+([A-Z]{2}[0-9A-HJKMNP-TV-Z]{8})$/i);if(s){K=!0;try{await e.parseAsync(["node","icoa","exam","token",s[1].toUpperCase()])}catch{}return K=!1,void J.prompt()}const y=n.match(/^exam\s+([A-Z]{2,3})$/i);if(y){K=!0;try{await e.parseAsync(["node","icoa","exam","list",y[1]])}catch{}return K=!1,void J.prompt()}if("clear"===n||"cls"===n)return console.clear(),void J.prompt();if(n.startsWith("activate ")){const o=n.slice(9).trim(),e=r(o);return"ok"===e?console.log(chalk.green(" Access granted! Token bound to this device.")):"already_bound"===e?(console.log(),console.log(chalk.red(" Token already activated on a different device.")),console.log(chalk.gray(" Each token binds to the first device that uses it. If you lost the device,")),console.log(chalk.gray(" contact your proctor to have the token re-issued for a new device."))):(console.log(),console.log(chalk.red(" Token not recognized.")),console.log(chalk.gray(" Possible reasons:")),console.log(chalk.white(" • ")+chalk.gray("Typo — tokens are case-insensitive, 10 chars, start with a 2-letter country code (e.g. ")+chalk.cyan("UAK7M2R9Q4")+chalk.gray(")")),console.log(chalk.white(" • ")+chalk.gray("Expired — ask your proctor or organizer for a fresh token")),console.log(chalk.white(" • ")+chalk.gray("Network — verify connection to ")+chalk.cyan("practice.icoa2026.au")),console.log(chalk.gray(" Still stuck? type ")+chalk.cyan("help")+chalk.gray(" or try ")+chalk.cyan("exam demo")+chalk.gray(" for a free practice round."))),console.log(),void J.prompt()}if("activate"===n)return console.log(chalk.gray(" Usage: ")+chalk.white("activate <token>")),console.log(),void J.prompt();const m=b();if(m){const o=n.toUpperCase().trim(),t=o=>{const e=m.questions.find(e=>e.number===o);return!!e&&("ai4ctf"===e.type||"ctf4ai"===e.type||e.options&&!e.options.A&&!e.options.B)},l=o=>{const e="demo-free"!==m.session.examId,t=e&&o>=39?"ctf4ai":e&&o>=31?"ai4ctf":null;console.log(),console.log(chalk.yellow(` Q${o} is a practical question — letters (A/B/C/D) don't apply here.`)),t?(console.log(chalk.white(" Enter the AI chat for this question: ")+chalk.bold.cyan(t)),console.log(chalk.gray(" Or submit a flag directly: ")+chalk.green(`exam answer ${o} ICOA{your_flag}`))):console.log(chalk.gray(" Submit a flag: ")+chalk.green(`exam answer ${o} ICOA{your_flag}`)),console.log()};if(/^[ABCD]$/.test(o)){const n=m._lastQ||1;if(t(n))return l(n),void J.prompt();K=!0;try{await e.parseAsync(["node","icoa","exam","answer",String(n),o])}catch{}return K=!1,void J.prompt()}const s=o.match(/^(\d+)\s+([ABCD])$/);if(s){const o=parseInt(s[1],10);if(t(o))return l(o),void J.prompt();K=!0;try{await e.parseAsync(["node","icoa","exam","answer",s[1],s[2]])}catch{}return K=!1,void J.prompt()}}const p=n.split(/\s+/)[0].toLowerCase(),d=/^python3?(\.\d+)?$/.test(p),x=n.startsWith("!")||p.startsWith("!")||d;if("selection"===G&&!x&&!["exam","demo","retry","nations","next","prev","continue","setup","lang","ref","ai4ctf","ctf4ai","mark","unmark","review","submit","env"].includes(p)){if(console.log(chalk.gray(" Not available in Selection mode.")),m){const o=m._lastQ||1;console.log(chalk.white(` Resume exam: exam q ${o}`)+chalk.gray(" · ")+chalk.white("A/B/C/D")+chalk.gray(" to answer"))}else console.log(chalk.gray(" Try: demo · setup to switch mode"));return console.log(),void J.prompt()}if("organizer"===G&&!["join","exam","demo","retry","next","prev","logout","setup","lang","ref","ctf","mark","unmark","review","submit"].includes(p))return console.log(chalk.gray(" Not available in Organizer mode. Switch via: setup")),console.log(),void J.prompt();if(!("olympiad"!==G||a()&&c()||i(p)))return console.log(chalk.yellow(" Restricted mode. ")+chalk.gray("Enter your access token:")),console.log(chalk.white(" activate <token>")),console.log(),console.log(chalk.gray(" Free commands: ")+chalk.white("ref [topic]")+chalk.gray(", ")+chalk.white("help")+chalk.gray(", ")+chalk.white("exit")),console.log(),void J.prompt();if(!["join","activate","challenges","ch","open","submit","flag","scoreboard","sb","status","time","hint","hint-b","hint-c","hint-budget","ref","shell","files","connect","note","log","lang","setup","env","ai4ctf","model","ctf","exam","demo","retry","nations","next","prev","continue","logout","ctf4ai","mark","unmark","review","submit"].includes(p)){if(z.has(p))return console.log(chalk.red(` Blocked: ${p} is not allowed during competition.`)),console.log(),void J.prompt();if(/(?:^|\s)(?:\/(?!home\/|Users\/|tmp\/)|\.\.\/|~\/)/.test(n)&&!n.startsWith("cd ")){const o=/(?:^|\s)\/(?!home\/\w+\/icoa-workspace|Users\/\w+\/icoa-workspace|tmp\/)/.test(n),e=/\.\./.test(n);if(o||e)return console.log(chalk.red(" Blocked: access outside workspace is not allowed.")),console.log(chalk.gray(` Workspace: ${M}`)),console.log(),void J.prompt()}let o=n.startsWith("!")?n.slice(1).trim():n;if("darwin"===process.platform){const e="/opt/homebrew/opt/python@3.12/bin/python3.12";o=o.replace(/^python3?\s/,`${e} `).replace(/^(python3|python)$/,e)}else if("win32"===process.platform){const e=(()=>{try{return t("py -3 --version",{stdio:["ignore","ignore","ignore"],timeout:1500}),"py -3"}catch{}return"python"})();o=o.replace(/^python3?(\.\d+)?\s/,`${e} `).replace(/^python3?(\.\d+)?$/,e)}else{const e=(()=>{try{return t("which python3.12",{stdio:"ignore"}),"python3.12"}catch{return"python3"}})();o=o.replace(/^python\s/,`${e} `).replace(/^python$/,e)}const e=U();/^(\S*python3?(\.\d+)?)\s*$/.test(o)&&(o=`PYTHONSTARTUP="${function(){const o=N(D(),".icoa");P(o)||R(o,{recursive:!0});const e=N(o,"python-startup.py");if(!P(e)){const{writeFileSync:o}=require("node:fs");o(e,"# ICOA exam interactive startup — auto-loaded by PYTHONSTARTUP\nimport base64, struct, hashlib, re, json, os, sys, binascii\ntry: import requests\nexcept ImportError: pass\ntry: from Crypto.Cipher import AES\nexcept ImportError: pass\ntry: from Crypto.Util.Padding import pad, unpad\nexcept ImportError: pass\ntry: from pwn import xor, p32, u32, p64, u64\nexcept ImportError: pass\ntry: import bs4\nexcept ImportError: pass\ntry: import numpy as np\nexcept ImportError: pass\n")}return e}()}" ${o}`,console.log(),console.log(chalk.cyan(" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")),console.log(chalk.bold.white(" Python ready — ICOA exam toolkit pre-loaded")),console.log(chalk.cyan(" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")),console.log(),console.log(chalk.white(" Already imported: ")+chalk.gray("base64, struct, hashlib, re, json, binascii")),console.log(chalk.white(" Also available: ")+chalk.gray("requests, bs4, numpy, AES, pad/unpad, xor, p32/u32/p64/u64")),console.log(),console.log(chalk.yellow(" Quick examples:")),console.log(chalk.gray(' base64.b64decode("aGVsbG8=") ')+chalk.gray("# decode base64")),console.log(chalk.gray(' bytes.fromhex("48656c6c6f") ')+chalk.gray("# hex → bytes")),console.log(chalk.gray(' "ICOA{x}".encode() ')+chalk.gray("# str → bytes")),console.log(chalk.gray(" [chr(c) for c in [73,67,79,65]] ")+chalk.gray("# ASCII codes")),console.log(chalk.gray(' xor(bytes.fromhex("0a2b"), b"IC") ')+chalk.gray("# pwntools XOR")),console.log(),console.log(chalk.gray(" Exit: ")+chalk.white("exit()")+chalk.gray(" or Ctrl-D")),console.log(chalk.cyan(" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")),console.log()),K=!0;try{q()&&await $()?await O(o,J):await Y(o,J,e)}catch{console.log(chalk.yellow(` Command failed: ${p}`))}return K=!1,console.log(),void J.prompt()}K=!0;const v=m&&"submit"===n.toLowerCase()?["exam","submit"]:function(o){const e=o.split(/\s+/),t=e[0].toLowerCase(),n=e.slice(1),l={demo:["exam","demo"],retry:["exam","demo-retry"],nations:["exam","nations"],next:["exam","next"],prev:["exam","prev"],mark:["exam","mark",...n],unmark:["exam","unmark",...n],review:["exam","review"],logout:["ctf","logout"],join:["ctf","join",...n],activate:["ctf","activate",...n],challenges:["ctf","challenges"],ch:["ctf","challenges"],open:["ctf","open",...n],submit:["ctf","submit",...n],flag:["ctf","submit",...n],scoreboard:["ctf","scoreboard",...n],sb:["ctf","scoreboard",...n],status:["ctf","status"],time:["ctf","time"]};return l[t]?l[t]:["hint","hint-b","hint-c","hint-budget","ref","shell","files","connect","note","log","lang","setup","env","ai4ctf","model","ctf","exam","ctf4ai"].includes(t)?[t,...n]:e}(n),C="ctf"===v[0]&&"join"===v[1];C&&J.pause(),process.exit=()=>{throw new Error(B)};try{await e.parseAsync(["node","icoa",...v])}catch(o){const e=o instanceof Error?o.message:String(o);if(e===B);else if(e.includes("commander.unknownCommand")){const{distance:o}=await import("fastest-levenshtein"),e=["ctf","hint","hint-b","hint-c","hint-budget","ref","shell","files","connect","note","log","lang","setup","env","ai4ctf","exam","ctf4ai","theme","clear","cls","quit","exit","back","menu","help","continue","activate","demo","challenges","status","scoreboard","join","logout"],t=p.split(/\s+/)[0]||p;let n={word:"",dist:1/0};for(const l of e){const e=o(t.toLowerCase(),l);e<n.dist&&(n={word:l,dist:e})}console.log(chalk.yellow(` Unknown command: ${p}.`)),n.dist>0&&n.dist<=2&&console.log(chalk.gray(" Did you mean: ")+chalk.bold.cyan(n.word)+chalk.gray("?")),console.log(chalk.gray(" Type ")+chalk.cyan("help")+chalk.gray(" for the full command list."))}else e.includes("commander.")||(e.includes("fetch failed")||e.includes("ECONNREFUSED")||e.includes("ETIMEDOUT"))&&console.log(chalk.yellow(" Network error. Check your connection."))}finally{process.exit=k,K=!1,C&&J.resume()}h()?J.setPrompt(chalk.magenta("ai4ctf> ")):w()&&J.setPrompt(chalk.red("ctf4ai> ")),console.log(),J.prompt()}),J.on("SIGINT",()=>{if(console.log(),h()||w())console.log(chalk.yellow(" Ctrl+C did not close ICOA CLI — you are still in the AI chat.")),console.log(chalk.white(" Type ")+chalk.bold.cyan("exit")+chalk.white(" to leave the chat and return to the menu."));else if(b()){const o="demo-free"!==b().session.examId;console.log(chalk.yellow(" Ctrl+C did NOT close ICOA CLI.")),console.log(chalk.gray(` Your ${o?"exam":"demo"} is paused and every answer is auto-saved.`)),console.log(),console.log(chalk.white(" Resume: ")+chalk.cyan("exam q 1")+chalk.gray(" · Back to menu: ")+chalk.cyan("back")+chalk.gray(" · Close CLI: ")+chalk.cyan(o?"quit confirm":"quit"))}else console.log(chalk.yellow(" Ctrl+C did not close ICOA CLI — you are still at the ")+chalk.cyan("icoa>")+chalk.yellow(" prompt.")),console.log(chalk.gray(" Keep typing — ")+chalk.cyan("help")+chalk.gray(" lists commands. (Only ")+chalk.cyan("quit")+chalk.gray(" or Ctrl+D actually close the CLI.)"));console.log(),J.prompt()}),J.on("close",()=>{E(),g(),S(),k(0)})}function Y(o,t,n){return new Promise(l=>{const s=process.stdin,a=!!s.isTTY&&!!s.isRaw;if(t.pause(),s.isTTY&&"function"==typeof s.setRawMode)try{s.setRawMode(!1)}catch{}const r=e(o,{shell:!0,stdio:"inherit",cwd:n||process.cwd()}),i=()=>{if(s.isTTY&&"function"==typeof s.setRawMode&&a)try{s.setRawMode(!0)}catch{}t.resume(),l()};r.on("close",i),r.on("error",i)})}
1
+ import{createInterface as o}from"node:readline";import{spawn as e,execSync as t}from"node:child_process";import chalk from"chalk";import{isConnected as l,getConfig as n,saveConfig as s}from"./lib/config.js";import{isActivated as a,activateToken as r,isFreeCommand as i,isDeviceMatch as c,recordExit as g,recordResume as y,isFirstRunOrUpgrade as m,markVersionSeen as p}from"./lib/access.js";import{setReplMode as d}from"./lib/ui.js";import{isChatActive as u,handleChatMessage as h}from"./commands/ai4ctf.js";import{isCtf4aiActive as w,handleCtf4aiMessage as f}from"./commands/ctf4ai-demo.js";import{getExamState as b,getRealExamState as x,getDemoState as v}from"./lib/exam-state.js";import{getDemoStats as C}from"./lib/demo-stats.js";import{isExamSetupComplete as k}from"./lib/exam-setup.js";import{DEMO_PICK_SIZE as I,DEMO_POOL_SIZE as A}from"./lib/demo-exam.js";import{isNativeWindowsCmd as T}from"./lib/platform.js";import{resetTerminalTheme as S}from"./lib/theme.js";import{ensureSandbox as $,runInSandbox as O,isDockerAvailable as q}from"./lib/sandbox.js";import{logCommand as L}from"./lib/logger.js";import{startLogSync as j,stopLogSync as E}from"./lib/log-sync.js";import{existsSync as P,mkdirSync as R,writeFileSync as N}from"node:fs";import{join as D}from"node:path";import{homedir as F}from"node:os";function M(){return x()?chalk.cyan("exam> "):v()?chalk.yellow("demo> "):chalk.green("icoa> ")}const U=D(F(),"icoa-workspace");function z(){return P(U)||R(U,{recursive:!0}),U}const B=new Set(["sudo","su","doas","pkexec","brew","apt","apt-get","yum","choco","npm","npx","pip","pip3","shutdown","reboot","halt","mkfs","fdisk","dd","iptables","ufw"]),W="__REPL_NO_EXIT__",Q="2.5.1";function Y(){const o=C(),e=k(),l=`Free practice — ${I} questions (from pool of ${A})`,n=T();if(console.log(),console.log(" "+chalk.cyan.bold("[Selection Mode]")),console.log(),n)console.log(chalk.gray(" Platform: ")+chalk.white("Windows cmd.exe")+chalk.gray(" — routed to Paper C (MCQ-only, 45 min, 70 pts, zero extra tools)")),console.log();else if(o.attempts>0){const o=function(){const o=["python3.12 --version","/opt/homebrew/opt/python@3.12/bin/python3.12 --version","/usr/local/opt/python@3.12/bin/python3.12 --version","python3 --version","python --version","py -3.12 --version","py -3 --version"];let e="",l="missing";for(const n of o)try{const o=t(n,{encoding:"utf-8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).trim().replace("Python ",""),[s,a]=o.split(".").map(Number);if(3===s&&12===a)return{ok:!0,version:o,status:"ok"};e=o,l=3===s&&a>=10&&a<12?"old":3===s&&a>12?"new":"missing"}catch{}return{ok:"missing"!==l,version:e,status:l}}();"missing"===o.status?(console.log(chalk.yellow(" ⚠ Python not detected. For exam practical questions:")),console.log(chalk.gray(" → ")+chalk.bold.cyan("env python")+chalk.gray(" (platform install guide)")),console.log()):"new"===o.status&&(console.log(chalk.yellow(` ⚠ Python ${o.version} may lack CTF wheels. Python 3.12 recommended:`)),console.log(chalk.gray(" → ")+chalk.bold.cyan("env python")+chalk.gray(" (install guide)")),console.log())}if(0===o.attempts)console.log(chalk.white(" New here? Start with ")+chalk.bold.cyan("demo")+chalk.white(" — it takes a few minutes.")),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.bold.cyan(" demo")+chalk.gray(` ${l}`)),console.log(chalk.white(" lang")+chalk.gray(" List all supported languages")),console.log(chalk.white(" lang es")+chalk.gray(" Switch language (e.g. lang es, lang zh, lang fr)")),console.log(chalk.gray(" ─────────────────────────────────────────────"));else if(e||n){const e=1===o.attempts?"attempt":"attempts";o.attempts>0&&console.log(chalk.green(" ✓ Demo completed ")+chalk.gray(`(${o.attempts} ${e})`)),n||console.log(chalk.green(" ✓ Environment ready")),console.log(chalk.yellow(" → Enter your exam token to begin.")),console.log(chalk.gray(" (10-char code from your organizer, starts with your country code like ")+chalk.cyan("UA")+chalk.gray(" — case-insensitive)")),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.bold.yellow(" exam <token>")+chalk.gray(" Enter exam (primary action — use your organizer-issued token)")),console.log(chalk.gray(" format: ")+chalk.white("exam UAxxxxxxxx")+chalk.gray(" (2-letter country prefix + 8 chars)")),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.gray(" Other commands:")),console.log(chalk.white(" demo")+chalk.gray(` ${l}`)),n||console.log(chalk.white(" exam setup")+chalk.gray(" Re-verify tool environment")),console.log(chalk.white(" lang")+chalk.gray(" List all supported languages")),console.log(chalk.white(" lang es")+chalk.gray(" Switch language (e.g. lang es, lang zh, lang fr)")),console.log(chalk.gray(" ─────────────────────────────────────────────"))}else{const e=1===o.attempts?"attempt":"attempts";console.log(chalk.green(" ✓ Demo completed ")+chalk.gray(`(${o.attempts} ${e}${o.bestPercentage>0?` · best ${o.bestPercentage}%`:""})`)),console.log(chalk.yellow(" → Next: prepare your environment for the real exam.")),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.white(" demo")+chalk.gray(` ${l}`)),console.log(chalk.bold.yellow(" exam setup")+chalk.gray(" Install tools for national selection (~150MB)")),console.log(chalk.white(" lang")+chalk.gray(" List all supported languages")),console.log(chalk.white(" lang es")+chalk.gray(" Switch language (e.g. lang es, lang zh, lang fr)")),console.log(chalk.gray(" ─────────────────────────────────────────────"))}console.log(chalk.gray(" ")+chalk.gray("Tip: ")+chalk.cyan("help")+chalk.gray(" for commands · ")+chalk.cyan("Ctrl+C")+chalk.gray(" pauses · ")+chalk.cyan("quit")+chalk.gray(" closes")),console.log()}export async function startRepl(e,x){const v=n(),C=l(),k=process.exit.bind(process),I=a();if(v.demoCleanedForVersion!==Q){try{const{existsSync:o,unlinkSync:e}=await import("node:fs"),{join:t}=await import("node:path"),{getIcoaDir:l}=await import("./lib/config.js"),n=t(l(),"demo-state.json");o(n)&&e(n)}catch{}s({demoCleanedForVersion:Q})}const{select:A,confirm:T}=await import("@inquirer/prompts"),V=v.mode||"",G=[{name:` ${chalk.bold("National Selection")} ${chalk.gray("—")} ${chalk.gray("demo, exam (lightweight)")}`,value:"selection"},{name:` ${chalk.bold("International Olympiad")} ${chalk.gray("—")} ${chalk.gray("CTF × AI (~500MB, advanced)")}`,value:"olympiad"},{name:` ${chalk.bold("National/Regional Partner")} ${chalk.gray("—")} ${chalk.gray("organizer tools (tokens, competitions)")}`,value:"organizer"},{name:` ${chalk.gray("About ICOA")} ${chalk.gray("·")} ${chalk.gray("Info & contact")}`,value:"about"}];console.log(chalk.gray(" Use ")+chalk.yellow("↑")+chalk.gray(" or ")+chalk.yellow("↓")+chalk.gray(" to select, ")+chalk.yellow("Enter")+chalk.gray(" to confirm.")),console.log();let J="";for(;!J;){const o=await A({message:"Mode",choices:G,default:V||"selection"});"about"!==o?J=o:(console.clear(),console.log(),console.log(chalk.cyan(" ═══════════════════════════════════════════════════")),console.log(chalk.bold.yellow(" ICOA")+chalk.white(" — AI-Native CLI OS for Cyber & AI Security")),console.log(chalk.gray(" Olympiad & Competition · K-12 to University")),console.log(chalk.cyan(" ───────────────────────────────────────────────────")),console.log(),console.log(chalk.bold.white(" What Makes ICOA Different")),console.log(chalk.gray(" · AI-native AI teammate, AI adversary, AI translation")),console.log(chalk.gray(" · CLI OS Complete competition environment in terminal")),console.log(chalk.gray(" · 110 tools pwntools, z3, gdb, nmap, sleuthkit... pre-configured")),console.log(chalk.gray(" · Global scale 15,000+ concurrent exams · 15 languages")),console.log(),console.log(chalk.bold.white(" Competition Format")),console.log(" "+chalk.green.bold("AI4CTF")+chalk.gray(" [Day 1] AI as teammate — 5hr jeopardy CTF")),console.log(" "+chalk.red.bold("CTF4AI")+chalk.gray(" [Day 2] Challenge AI — adversarial ML, red-team")),console.log(),console.log(chalk.white(" Sydney, Australia")+chalk.gray(" · Jun 27 - Jul 2, 2026 · 40+ countries")),console.log(),console.log(chalk.bold.white(" Organized by")+chalk.gray(" ASRA (Australia) · ICO Foundation Inc")),console.log(chalk.bold.white(" Contact ")+chalk.cyan(" australia@icoa2026.au · accreditation@icoa2026.au")),console.log(chalk.bold.white(" Website ")+chalk.cyan.underline(" https://icoa2026.au")),console.log(chalk.cyan(" ═══════════════════════════════════════════════════")),console.log(),console.log(chalk.gray(" Press ")+chalk.yellow("Enter")+chalk.gray(" to return...")),await new Promise(o=>{const e=t=>{process.stdin.removeListener("data",e),process.stdin.isTTY&&process.stdin.setRawMode&&process.stdin.setRawMode(!1),process.stdin.pause(),o()};process.stdin.isTTY&&process.stdin.setRawMode&&process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.once("data",e)}),console.clear())}if("olympiad"===J&&"olympiad"!==V&&(console.log(),console.log(chalk.yellow(" This mode will download ~500MB of CTF tools and AI models.")),await T({message:"Continue?",default:!0})||(J="selection",console.log(chalk.gray(" Switched to National Selection mode.")))),J!==V&&s({mode:J}),console.log(),"olympiad"===J&&m(Q)){p(Q),console.log(chalk.gray(" Checking competition environment..."));const{execSync:o}=await import("node:child_process"),e=[{name:"pwntools",cmd:'python3 -c "import pwn"'},{name:"z3-solver",cmd:'python3 -c "import z3"'},{name:"numpy",cmd:'python3 -c "import numpy"'},{name:"requests",cmd:'python3 -c "import requests"'}];let t=0;for(const l of e)try{o(l.cmd,{stdio:"ignore"})}catch{t++}if(t>0){console.log(chalk.yellow(` ${t} core libraries missing.`));try{const{confirm:o}=await import("@inquirer/prompts");if(await o({message:" Install competition Python libraries now?",default:!0,theme:{prefix:"",style:{message:o=>chalk.green(o),defaultAnswer:o=>chalk.green(o)}}})){console.log();const{execSync:o}=await import("node:child_process");o("icoa env setup",{stdio:"inherit"})}}catch{console.log(chalk.gray(" Run ")+chalk.white("env setup")+chalk.gray(" later to install."))}console.log()}else console.log(chalk.green(" All core libraries ready.")),console.log()}if(x){const o=y();if(o){const e=Math.floor(o.awaySeconds/60),t=o.awaySeconds%60;console.log(chalk.yellow(` Session resumed. Away: ${e}m ${t}s | Total exits: ${o.exitCount}`)),console.log()}}"selection"===J?Y():"organizer"===J?(console.log(chalk.yellow.bold(" [National/Regional Partner]")),console.log(),console.log(chalk.bold.white(" ██╗ ██████╗ ██████╗ █████╗")),console.log(chalk.bold.white(" ██║██╔════╝██╔═══██╗██╔══██╗")),console.log(chalk.bold.white(" ██║██║ ██║ ██║███████║")),console.log(chalk.bold.white(" ██║██║ ██║ ██║██╔══██║")),console.log(chalk.bold.white(" ██║╚██████╗╚██████╔╝██║ ██║")),console.log(chalk.bold.white(" ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝")),console.log(),console.log(chalk.yellow(" International Cyber Olympiad in AI 2026")),console.log(chalk.bold.magenta(" The World's First AI-Native CLI Operating System")),console.log(chalk.bold.magenta(" for Cybersecurity & AI Security Competition")),console.log(chalk.bold.magenta(" and Olympiad for K-12")),console.log(chalk.gray(" Sydney, Australia · Jun 27 - Jul 2, 2026")),console.log(),console.log(chalk.white(" Vision")),console.log(chalk.gray(" Building a global pipeline for youth cyber & AI")),console.log(chalk.gray(" security talent through education and competition.")),console.log(),console.log(chalk.white(" Capacity")),console.log(chalk.gray(" 15,000+ concurrent online examinations")),console.log(chalk.gray(" National selection, training, and education support")),console.log(),console.log(chalk.white(" Olympic Spirit")),console.log(chalk.gray(" Excellence · Friendship · Respect")),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.white(" New country accreditation & support:")),console.log(chalk.cyan(" australia@icoa2026.au")),console.log(chalk.cyan(" accreditation@icoa2026.au")),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(),C?(console.log(chalk.green(` Logged in as ${v.userName}`)),console.log(chalk.white(" exam list")+chalk.gray(" Manage exams")),console.log(chalk.white(" logout")+chalk.gray(" Disconnect"))):console.log(chalk.white(" join <url>")+chalk.gray(" Connect to manage exams")),console.log()):I&&!c()?(console.log(chalk.red(" Token was activated on a different device.")),console.log(chalk.gray(" Contact organizer for assistance.")),console.log()):C?(console.log(chalk.green.bold(` Welcome back, ${v.userName}!`)),console.log(chalk.gray(` Connected to ${v.ctfdUrl}`)),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.white(" Ready to compete? Start here:")),console.log(),console.log(chalk.bold.cyan(" challenges")+chalk.gray(" Browse challenges by category")),console.log(chalk.white(" status")+chalk.gray(" Your score & hint budget")),console.log(chalk.white(" scoreboard")+chalk.gray(" Live rankings")),console.log(chalk.white(" help")+chalk.gray(" Full command list")),console.log(),console.log(chalk.gray(" Tool environment:")),console.log(chalk.white(" env")+chalk.gray(" See which of the 110 CTF tools are installed")),console.log(chalk.white(" env setup")+chalk.gray(" Install anything missing (~5 min, one-time)")),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.gray(" Tip: ")+chalk.cyan("help")+chalk.gray(" · ")+chalk.cyan("Ctrl+C")+chalk.gray(" pauses · ")+chalk.cyan("quit")+chalk.gray(" closes")),console.log()):I?(z(),console.log(chalk.green.bold(" Welcome, competitor!")),console.log(chalk.gray(` Workspace: ${U}`)),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.white(" Get started:")),console.log(),console.log(chalk.white(" Step 1 ")+chalk.bold.cyan("join <url>")+chalk.gray(" Connect to competition server")),console.log(chalk.white(" Step 2 ")+chalk.bold.cyan("challenges")+chalk.gray(" Browse & solve challenges")),console.log(chalk.white(" Step 3 ")+chalk.bold.cyan("ai4ctf")+chalk.gray(" Ask AI when stuck")),console.log(),console.log(chalk.gray(" Before Step 1 — make sure your tools are ready:")),console.log(chalk.white(" env")+chalk.gray(" See which of the 110 CTF tools are installed")),console.log(chalk.white(" env setup")+chalk.gray(" Install anything missing (~5 min, one-time)")),console.log(),console.log(chalk.gray(" Also: ")+chalk.white("help")+chalk.gray(" all commands")),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.gray(" Tip: ")+chalk.cyan("Ctrl+C")+chalk.gray(" pauses · ")+chalk.cyan("exit")+chalk.gray(" → menu · ")+chalk.cyan("quit")+chalk.gray(" closes CLI")),console.log()):(console.log(chalk.bold.white(" Welcome to ICOA CLI — International Olympiad")),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.white(" To begin, activate your competition token:")),console.log(),console.log(chalk.bold.cyan(" activate <token>")),console.log(),console.log(chalk.gray(" While waiting, explore:")),console.log(chalk.white(" ref linux")+chalk.gray(" Quick reference for Linux")),console.log(chalk.white(" ref web")+chalk.gray(" Quick reference for Web")),console.log(chalk.white(" env")+chalk.gray(" See which of the 110 CTF tools are installed")),console.log(chalk.white(" env setup")+chalk.gray(" Install anything missing (~5 min, one-time)")),console.log(chalk.white(" help")+chalk.gray(" All available commands")),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.gray(" Tip: ")+chalk.cyan("Ctrl+C")+chalk.gray(" pauses · ")+chalk.cyan("exit")+chalk.gray(" → menu · ")+chalk.cyan("quit")+chalk.gray(" closes CLI")),console.log()),e.exitOverride(),e.configureOutput({writeErr:()=>{},writeOut:o=>{console.log(o)}});const K=o({input:process.stdin,output:process.stdout,prompt:M(),terminal:!0});let Z=!1;d(!0),j();const H=K.prompt.bind(K);K.prompt=o=>{u()||w()||K.setPrompt(M()),H(o)},K.prompt(),K.on("line",async o=>{if(Z)return;const l=o.trim();if(!l)return K.setPrompt(u()?chalk.magenta("ai4ctf> "):M()),void K.prompt();if(u()){Z=!0;const o=await h(l);return Z=!1,"exit"===o&&K.setPrompt(M()),void K.prompt()}if(w()){Z=!0;const o=await f(l);return Z=!1,"exit"!==o&&"solved"!==o||K.setPrompt(M()),void K.prompt()}if(L(l),"exit"===l)return b()?(console.log(),console.log(chalk.yellow(" ⚠ An exam is in progress.")),console.log(chalk.white(" To return to menu without losing progress, type: ")+chalk.bold.cyan("back")),console.log(chalk.white(" To fully close ICOA CLI, type: ")+chalk.bold.cyan("quit")),console.log(chalk.gray(" Your progress is auto-saved either way.")),console.log(),void K.prompt()):(console.log(),console.log(chalk.gray(" ")+chalk.white("exit")+chalk.gray(" returns to the main menu. To fully close ICOA CLI, type ")+chalk.bold.cyan("quit")+chalk.gray(".")),"selection"===J&&Y(),void K.prompt());if("quit"===l||"q"===l||"quit confirm"===l){const o=b();return o&&"demo-free"!==o.session.examId&&"quit confirm"!==l?(console.log(),console.log(chalk.yellow(" ⚠ A real exam is in progress.")),console.log(chalk.gray(" Your answers are auto-saved on the server, but the exam timer keeps ticking")),console.log(chalk.gray(" on the server side even if you close the CLI.")),console.log(),console.log(chalk.white(" To leave the CLI but keep the exam alive, type: ")+chalk.bold.cyan("back")),console.log(chalk.gray(" (recommended — you can resume with ")+chalk.cyan("exam q 1")+chalk.gray(" after relaunching icoa)")),console.log(),console.log(chalk.white(" To really close ICOA CLI, type: ")+chalk.bold.cyan("quit confirm")),console.log(),void K.prompt()):(o&&"demo-free"===o.session.examId&&(console.log(),console.log(chalk.gray(" Demo paused. Resume with: ")+chalk.white("demo")+chalk.gray(" (fresh) or ")+chalk.white("exam q 1")+chalk.gray(" (continue)."))),E(),g(),console.log(chalk.gray(" Session saved. Use ")+chalk.white("icoa --resume")+chalk.gray(" to continue.")),S(),void k(0))}if("back"===l||"menu"===l){const o=b(),e=o&&"demo-free"!==o.session.examId,t=o&&"demo-free"===o.session.examId&&(()=>{const e=new Date(o.session.startedAt||0).getTime();return Date.now()-e<18e5})();if(e)console.log(),console.log(chalk.gray(" Exam paused. Your progress is saved.")),console.log(chalk.white(" Resume: exam q 1")+chalk.gray(" · ")+chalk.white("exam review")+chalk.gray(" · ")+chalk.white("exam submit")),console.log();else if(t){const e=Object.keys(o.answers).length,t=o.session.questionCount;console.log(),console.log(chalk.gray(` Demo paused (${e}/${t} answered). Resume with: `)+chalk.white("exam q 1")),console.log(chalk.gray(" Or type ")+chalk.white("demo")+chalk.gray(" to restart.")),console.log()}else{if(o&&"demo-free"===o.session.examId){const{clearExamState:o}=await import("./lib/exam-state.js");o("demo-free")}const e=n();fetch("https://practice.icoa2026.au/api/icoa/demo-stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"post-report-back",lang:e.language||"en",timestamp:(new Date).toISOString()}),signal:AbortSignal.timeout(5e3)}).catch(()=>{}),"selection"===J?Y():console.log(chalk.gray(" Already at main menu."))}return void K.prompt()}if("help"===l||"?"===l){if(b()){Z=!0;try{await e.parseAsync(["node","icoa","exam","help"])}catch{}return Z=!1,void K.prompt()}return function(o,e="olympiad"){console.log(),"selection"===e||"organizer"===e?(console.log(chalk.bold.white(" Exam")),console.log(chalk.white(" join <url> ")+chalk.gray("Connect to exam server")),console.log(chalk.white(" exam list ")+chalk.gray("Available exams")),console.log(chalk.white(" exam start <id> ")+chalk.gray("Begin an exam")),console.log(chalk.white(" exam q [n] ")+chalk.gray("View questions")),console.log(chalk.white(" exam answer <n> <X> ")+chalk.gray("Answer question")),console.log(chalk.white(" exam review ")+chalk.gray("Review all answers")),console.log(chalk.white(" exam submit ")+chalk.gray("Submit for grading")),console.log(chalk.white(" exam result ")+chalk.gray("View your score")),console.log(),console.log(chalk.bold.white(" System")),console.log(chalk.white(" ref [topic] ")+chalk.gray("Quick reference")),console.log(chalk.white(" setup ")+chalk.gray("Settings / switch mode")),console.log(chalk.white(" lang [code] ")+chalk.gray("Switch language")),console.log(chalk.white(" clear ")+chalk.gray("Clear screen")),console.log(chalk.white(" exit ")+chalk.gray("Quit")),console.log()):o?(console.log(chalk.cyan(" ═══════════════════════════════════════════════")),console.log(chalk.bold.white(" How it works")),console.log(),console.log(chalk.gray(" 1. Browse ")+chalk.white("challenges")+chalk.gray(" and pick one")),console.log(chalk.gray(" 2. ")+chalk.white("open <id>")+chalk.gray(" to read the challenge")),console.log(chalk.gray(" 3. Use ")+chalk.white("ai4ctf")+chalk.gray(" to chat with AI when stuck")),console.log(chalk.gray(" 4. ")+chalk.white("submit <id> icoa{flag}")+chalk.gray(" to score points")),console.log(chalk.gray(" 5. Check ")+chalk.white("scoreboard")+chalk.gray(" to track your rank")),console.log(chalk.cyan(" ═══════════════════════════════════════════════")),console.log(),console.log(chalk.bold.white(" Competition")),console.log(chalk.white(" join <url> ")+chalk.gray("Connect to CTFd")),console.log(chalk.white(" challenges (ch) ")+chalk.gray("List challenges by category")),console.log(chalk.white(" open <id> ")+chalk.gray("Read challenge + get next steps")),console.log(chalk.white(" submit <id> <flag> ")+chalk.gray("Submit a flag")),console.log(chalk.white(" scoreboard (sb) ")+chalk.gray("Live rankings")),console.log(chalk.white(" status ")+chalk.gray("Your score, budget & timer")),console.log(chalk.white(" time ")+chalk.gray("Countdown timer")),console.log(),console.log(chalk.bold.white(" AI Teammate")+chalk.gray(" — 3 levels, use wisely")),console.log(chalk.white(' hint "question" ')+chalk.gray("Level A — General guidance (50 uses)")),console.log(chalk.white(' hint-b "question" ')+chalk.gray("Level B — Deep analysis (10 uses)")),console.log(chalk.white(' hint-c "question" ')+chalk.gray("Level C — Critical assist (2 uses)")),console.log(chalk.white(" hint budget ")+chalk.gray("Check remaining uses")),console.log(chalk.white(" ai4ctf ")+chalk.gray("Free-chat with AI (no limit)")),console.log(),console.log(chalk.bold.white(" Tools")),console.log(chalk.white(" ref [topic] ")+chalk.gray("Quick reference (linux, web, crypto...)")),console.log(chalk.white(" shell ")+chalk.gray("Docker sandbox")),console.log(chalk.white(" files <id> ")+chalk.gray("Download challenge files")),console.log(chalk.white(" connect <id> ")+chalk.gray("Connect to remote target")),console.log(chalk.white(" note [text] ")+chalk.gray("Personal notepad")),console.log(chalk.white(" log ")+chalk.gray("Session history")),console.log(),console.log(chalk.bold.white(" System")),console.log(chalk.white(" setup ")+chalk.gray("Configure settings")),console.log(chalk.white(" lang [code] ")+chalk.gray("Switch language (15 supported)")),console.log(chalk.white(" logout ")+chalk.gray("Disconnect")),console.log(chalk.white(" clear ")+chalk.gray("Clear screen")),console.log(chalk.white(" exit ")+chalk.gray("Quit (session saved)")),console.log()):(console.log(chalk.bold.yellow(" Restricted Mode — activate with a token to unlock all commands")),console.log(),console.log(chalk.white(" activate <token> ")+chalk.gray("Unlock full access")),console.log(chalk.white(" ref [topic] ")+chalk.gray("Quick reference")),console.log(chalk.white(" exit ")+chalk.gray("Quit")),console.log())}(a(),J),void K.prompt()}if("more help"===l.toLowerCase()&&b()){Z=!0;try{await e.parseAsync(["node","icoa","exam","more-help"])}catch{}return Z=!1,void K.prompt()}if("continue"===l.toLowerCase())return console.log(),console.log(chalk.green.bold(" ═══ AI4CTF — AI as Your Teammate ═══")),console.log(),console.log(chalk.white(" In AI4CTF, you solve cybersecurity challenges")),console.log(chalk.white(" with AI by your side.")),console.log(),console.log(chalk.white(" In competition, you get AI help at 3 levels:")),console.log(chalk.yellow(" hint a")+chalk.gray(" General guidance (50 uses)")),console.log(chalk.yellow(" hint b")+chalk.gray(" Deep analysis (10 uses)")),console.log(chalk.yellow(" hint c")+chalk.gray(" Critical assist (2 uses)")),console.log(),console.log(chalk.white(" Try it now! Type: ")+chalk.bold.green("ai4ctf")),console.log(chalk.gray(' Chat freely with your AI teammate. Type "exit" when done.')),console.log(),console.log(chalk.gray(" After ai4ctf, try: ")+chalk.bold.red("ctf4ai")+chalk.gray(' — trick the AI into saying "koala"')),console.log(),void K.prompt();if(/^ICOA-[A-Z]{2,3}-\d{1,6}$/i.test(l.trim())){Z=!0;try{await e.parseAsync(["node","icoa","exam","token",l.trim()])}catch{}return Z=!1,void K.prompt()}if(/^[A-Z]{2}[0-9A-HJKMNP-TV-Z]{8}$/i.test(l.trim())){Z=!0;try{await e.parseAsync(["node","icoa","exam","token",l.trim().toUpperCase()])}catch{}return Z=!1,void K.prompt()}const s=l.match(/^exam\s+([A-Z]{2}[0-9A-HJKMNP-TV-Z]{8})$/i);if(s){Z=!0;try{await e.parseAsync(["node","icoa","exam","token",s[1].toUpperCase()])}catch{}return Z=!1,void K.prompt()}const y=l.match(/^exam\s+([A-Z]{2,3})$/i);if(y){Z=!0;try{await e.parseAsync(["node","icoa","exam","list",y[1]])}catch{}return Z=!1,void K.prompt()}if("clear"===l||"cls"===l)return console.clear(),void K.prompt();if(l.startsWith("activate ")){const o=l.slice(9).trim(),e=r(o);return"ok"===e?console.log(chalk.green(" Access granted! Token bound to this device.")):"already_bound"===e?(console.log(),console.log(chalk.red(" Token already activated on a different device.")),console.log(chalk.gray(" Each token binds to the first device that uses it. If you lost the device,")),console.log(chalk.gray(" contact your proctor to have the token re-issued for a new device."))):(console.log(),console.log(chalk.red(" Token not recognized.")),console.log(chalk.gray(" Possible reasons:")),console.log(chalk.white(" • ")+chalk.gray("Typo — tokens are case-insensitive, 10 chars, start with a 2-letter country code (e.g. ")+chalk.cyan("UAK7M2R9Q4")+chalk.gray(")")),console.log(chalk.white(" • ")+chalk.gray("Expired — ask your proctor or organizer for a fresh token")),console.log(chalk.white(" • ")+chalk.gray("Network — verify connection to ")+chalk.cyan("practice.icoa2026.au")),console.log(chalk.gray(" Still stuck? type ")+chalk.cyan("help")+chalk.gray(" or try ")+chalk.cyan("exam demo")+chalk.gray(" for a free practice round."))),console.log(),void K.prompt()}if("activate"===l)return console.log(chalk.gray(" Usage: ")+chalk.white("activate <token>")),console.log(),void K.prompt();const m=b();if(m){const o=l.toUpperCase().trim(),t=o=>{const e=m.questions.find(e=>e.number===o);return!!e&&("ai4ctf"===e.type||"ctf4ai"===e.type||e.options&&!e.options.A&&!e.options.B)},n=o=>{const e="demo-free"!==m.session.examId,t=e&&o>=39?"ctf4ai":e&&o>=31?"ai4ctf":null;console.log(),console.log(chalk.yellow(` Q${o} is a practical question — letters (A/B/C/D) don't apply here.`)),t?(console.log(chalk.white(" Enter the AI chat for this question: ")+chalk.bold.cyan(t)),console.log(chalk.gray(" Or submit a flag directly: ")+chalk.green(`exam answer ${o} ICOA{your_flag}`))):console.log(chalk.gray(" Submit a flag: ")+chalk.green(`exam answer ${o} ICOA{your_flag}`)),console.log()};if(/^[ABCD]$/.test(o)){const l=m._lastQ||1;if(t(l))return n(l),void K.prompt();Z=!0;try{await e.parseAsync(["node","icoa","exam","answer",String(l),o])}catch{}return Z=!1,void K.prompt()}const s=o.match(/^(\d+)\s+([ABCD])$/);if(s){const o=parseInt(s[1],10);if(t(o))return n(o),void K.prompt();Z=!0;try{await e.parseAsync(["node","icoa","exam","answer",s[1],s[2]])}catch{}return Z=!1,void K.prompt()}}const p=l.split(/\s+/)[0].toLowerCase(),d=/^python3?(\.\d+)?$/.test(p),x=l.startsWith("!")||p.startsWith("!")||d;if("selection"===J&&!x&&!["exam","demo","retry","nations","next","prev","continue","setup","lang","ref","ai4ctf","ctf4ai","mark","unmark","review","submit","env"].includes(p)){if(console.log(chalk.gray(" Not available in Selection mode.")),m){const o=m._lastQ||1;console.log(chalk.white(` Resume exam: exam q ${o}`)+chalk.gray(" · ")+chalk.white("A/B/C/D")+chalk.gray(" to answer"))}else console.log(chalk.gray(" Try: demo · setup to switch mode"));return console.log(),void K.prompt()}if("organizer"===J&&!["join","exam","demo","retry","next","prev","logout","setup","lang","ref","ctf","mark","unmark","review","submit"].includes(p))return console.log(chalk.gray(" Not available in Organizer mode. Switch via: setup")),console.log(),void K.prompt();if(!("olympiad"!==J||a()&&c()||i(p)))return console.log(chalk.yellow(" Restricted mode. ")+chalk.gray("Enter your access token:")),console.log(chalk.white(" activate <token>")),console.log(),console.log(chalk.gray(" Free commands: ")+chalk.white("ref [topic]")+chalk.gray(", ")+chalk.white("help")+chalk.gray(", ")+chalk.white("exit")),console.log(),void K.prompt();if(!["join","activate","challenges","ch","open","submit","flag","scoreboard","sb","status","time","ref","shell","files","connect","note","log","lang","setup","env","ai4ctf","model","ctf","exam","demo","retry","nations","next","prev","continue","logout","ctf4ai","mark","unmark","review","submit"].includes(p)){if(B.has(p))return console.log(chalk.red(` Blocked: ${p} is not allowed during competition.`)),console.log(),void K.prompt();if(/(?:^|\s)(?:\/(?!home\/|Users\/|tmp\/)|\.\.\/|~\/)/.test(l)&&!l.startsWith("cd ")){const o=/(?:^|\s)\/(?!home\/\w+\/icoa-workspace|Users\/\w+\/icoa-workspace|tmp\/)/.test(l),e=/\.\./.test(l);if(o||e)return console.log(chalk.red(" Blocked: access outside workspace is not allowed.")),console.log(chalk.gray(` Workspace: ${U}`)),console.log(),void K.prompt()}let o=l.startsWith("!")?l.slice(1).trim():l;if("darwin"===process.platform){const e="/opt/homebrew/opt/python@3.12/bin/python3.12";o=o.replace(/^python3?\s/,`${e} `).replace(/^(python3|python)$/,e)}else if("win32"===process.platform){const e=(()=>{try{return t("py -3 --version",{stdio:["ignore","ignore","ignore"],timeout:1500}),"py -3"}catch{}return"python"})();o=o.replace(/^python3?(\.\d+)?\s/,`${e} `).replace(/^python3?(\.\d+)?$/,e)}else{const e=(()=>{try{return t("which python3.12",{stdio:"ignore"}),"python3.12"}catch{return"python3"}})();o=o.replace(/^python\s/,`${e} `).replace(/^python$/,e)}const e=z();/^(\S*python3?(\.\d+)?)\s*$/.test(o)&&(o=`PYTHONSTARTUP="${function(){const o=D(F(),".icoa");P(o)||R(o,{recursive:!0});const e=D(o,"python-startup.py");return P(e)||N(e,"# ICOA exam interactive startup — auto-loaded by PYTHONSTARTUP\nimport base64, struct, hashlib, re, json, os, sys, binascii\ntry: import requests\nexcept ImportError: pass\ntry: from Crypto.Cipher import AES\nexcept ImportError: pass\ntry: from Crypto.Util.Padding import pad, unpad\nexcept ImportError: pass\ntry: from pwn import xor, p32, u32, p64, u64\nexcept ImportError: pass\ntry: import bs4\nexcept ImportError: pass\ntry: import numpy as np\nexcept ImportError: pass\n"),e}()}" ${o}`,console.log(),console.log(chalk.cyan(" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")),console.log(chalk.bold.white(" Python ready — ICOA exam toolkit pre-loaded")),console.log(chalk.cyan(" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")),console.log(),console.log(chalk.white(" Already imported: ")+chalk.gray("base64, struct, hashlib, re, json, binascii")),console.log(chalk.white(" Also available: ")+chalk.gray("requests, bs4, numpy, AES, pad/unpad, xor, p32/u32/p64/u64")),console.log(),console.log(chalk.yellow(" Quick examples:")),console.log(chalk.gray(' base64.b64decode("aGVsbG8=") ')+chalk.gray("# decode base64")),console.log(chalk.gray(' bytes.fromhex("48656c6c6f") ')+chalk.gray("# hex → bytes")),console.log(chalk.gray(' "ICOA{x}".encode() ')+chalk.gray("# str → bytes")),console.log(chalk.gray(" [chr(c) for c in [73,67,79,65]] ")+chalk.gray("# ASCII codes")),console.log(chalk.gray(' xor(bytes.fromhex("0a2b"), b"IC") ')+chalk.gray("# pwntools XOR")),console.log(),console.log(chalk.gray(" Exit: ")+chalk.white("exit()")+chalk.gray(" or Ctrl-D")),console.log(chalk.cyan(" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")),console.log()),Z=!0;try{q()&&await $()?await O(o,K):await _(o,K,e)}catch{console.log(chalk.yellow(` Command failed: ${p}`))}return Z=!1,console.log(),void K.prompt()}Z=!0;const v=m&&"submit"===l.toLowerCase()?["exam","submit"]:function(o){const e=o.split(/\s+/),t=e[0].toLowerCase(),l=e.slice(1),n={demo:["exam","demo"],retry:["exam","demo-retry"],nations:["exam","nations"],next:["exam","next"],prev:["exam","prev"],mark:["exam","mark",...l],unmark:["exam","unmark",...l],review:["exam","review"],logout:["ctf","logout"],join:["ctf","join",...l],activate:["ctf","activate",...l],challenges:["ctf","challenges"],ch:["ctf","challenges"],open:["ctf","open",...l],submit:["ctf","submit",...l],flag:["ctf","submit",...l],scoreboard:["ctf","scoreboard",...l],sb:["ctf","scoreboard",...l],status:["ctf","status"],time:["ctf","time"]};return n[t]?n[t]:["ref","shell","files","connect","note","log","lang","setup","env","ai4ctf","model","ctf","exam","ctf4ai"].includes(t)?[t,...l]:e}(l),C="ctf"===v[0]&&"join"===v[1];C&&K.pause(),process.exit=()=>{throw new Error(W)};try{await e.parseAsync(["node","icoa",...v])}catch(o){const e=o instanceof Error?o.message:String(o);if(e===W);else if(e.includes("commander.unknownCommand")){const{distance:o}=await import("fastest-levenshtein"),e=["ctf","ref","shell","files","connect","note","log","lang","setup","env","ai4ctf","exam","ctf4ai","theme","clear","cls","quit","exit","back","menu","help","continue","activate","demo","challenges","status","scoreboard","join","logout"],t=p.split(/\s+/)[0]||p;let l={word:"",dist:1/0};for(const n of e){const e=o(t.toLowerCase(),n);e<l.dist&&(l={word:n,dist:e})}console.log(chalk.yellow(` Unknown command: ${p}.`)),l.dist>0&&l.dist<=2&&console.log(chalk.gray(" Did you mean: ")+chalk.bold.cyan(l.word)+chalk.gray("?")),console.log(chalk.gray(" Type ")+chalk.cyan("help")+chalk.gray(" for the full command list."))}else e.includes("commander.")||(e.includes("fetch failed")||e.includes("ECONNREFUSED")||e.includes("ETIMEDOUT"))&&console.log(chalk.yellow(" Network error. Check your connection."))}finally{process.exit=k,Z=!1,C&&K.resume()}u()?K.setPrompt(chalk.magenta("ai4ctf> ")):w()&&K.setPrompt(chalk.red("ctf4ai> ")),console.log(),K.prompt()}),K.on("SIGINT",()=>{if(console.log(),u()||w())console.log(chalk.yellow(" Ctrl+C did not close ICOA CLI — you are still in the AI chat.")),console.log(chalk.white(" Type ")+chalk.bold.cyan("exit")+chalk.white(" to leave the chat and return to the menu."));else if(b()){const o="demo-free"!==b().session.examId;console.log(chalk.yellow(" Ctrl+C did NOT close ICOA CLI.")),console.log(chalk.gray(` Your ${o?"exam":"demo"} is paused and every answer is auto-saved.`)),console.log(),console.log(chalk.white(" Resume: ")+chalk.cyan("exam q 1")+chalk.gray(" · Back to menu: ")+chalk.cyan("back")+chalk.gray(" · Close CLI: ")+chalk.cyan(o?"quit confirm":"quit"))}else console.log(chalk.yellow(" Ctrl+C did not close ICOA CLI — you are still at the ")+chalk.cyan("icoa>")+chalk.yellow(" prompt.")),console.log(chalk.gray(" Keep typing — ")+chalk.cyan("help")+chalk.gray(" lists commands. (Only ")+chalk.cyan("quit")+chalk.gray(" or Ctrl+D actually close the CLI.)"));console.log(),K.prompt()}),K.on("close",()=>{E(),g(),S(),k(0)})}function _(o,t,l){return new Promise(n=>{const s=process.stdin,a=!!s.isTTY&&!!s.isRaw;if(t.pause(),s.isTTY&&"function"==typeof s.setRawMode)try{s.setRawMode(!1)}catch{}const r=e(o,{shell:!0,stdio:"inherit",cwd:l||process.cwd()}),i=()=>{if(s.isTTY&&"function"==typeof s.setRawMode&&a)try{s.setRawMode(!0)}catch{}t.resume(),n()};r.on("close",i),r.on("error",i)})}
@@ -132,7 +132,7 @@ export interface ChallengeContext {
132
132
  }
133
133
  export declare const DEFAULT_BUDGET: HintBudget;
134
134
  export declare const DEFAULT_CONFIG: IcoaConfig;
135
- export declare const SUPPORTED_LANGUAGES: readonly ["en", "zh", "ja", "ko", "es", "ar", "fr", "pt", "ru", "hi", "de", "id", "th", "vi", "tr", "uk", "ht", "sw", "uz"];
135
+ export declare const SUPPORTED_LANGUAGES: readonly ["en", "zh", "ja", "ko", "es", "ar", "fr", "pt", "ru", "hi", "de", "id", "th", "vi", "tr", "uk", "ht", "sw", "uz", "lo"];
136
136
  export type SupportedLanguage = typeof SUPPORTED_LANGUAGES[number];
137
137
  export interface ExamListItem {
138
138
  id: string;
@@ -1 +1 @@
1
- export const DEFAULT_BUDGET={a:50,b:10,c:2,tokensUsed:0,tokenCap:5e4};export const DEFAULT_CONFIG={ctfdUrl:"",token:"",language:"en",sessionId:"",competitionCode:"",teamId:null,userId:null,userName:"",teamName:"",currentChallengeId:null,currentChallengeName:"",currentChallengeCategory:"",competitionState:"unknown",competitionStartsAt:"",competitionEndsAt:"",geminiApiKey:"",geminiModel:"gemini-2.5-flash",accessToken:"",deviceFingerprint:"",lastVersion:"",sessionCookie:"",country:"",mode:"",demoIntroSeen:!1,themeVariant:"dark"};export const SUPPORTED_LANGUAGES=["en","zh","ja","ko","es","ar","fr","pt","ru","hi","de","id","th","vi","tr","uk","ht","sw","uz"];
1
+ export const DEFAULT_BUDGET={a:50,b:10,c:2,tokensUsed:0,tokenCap:5e4};export const DEFAULT_CONFIG={ctfdUrl:"",token:"",language:"en",sessionId:"",competitionCode:"",teamId:null,userId:null,userName:"",teamName:"",currentChallengeId:null,currentChallengeName:"",currentChallengeCategory:"",competitionState:"unknown",competitionStartsAt:"",competitionEndsAt:"",geminiApiKey:"",geminiModel:"gemini-2.5-flash",accessToken:"",deviceFingerprint:"",lastVersion:"",sessionCookie:"",country:"",mode:"",demoIntroSeen:!1,themeVariant:"dark"};export const SUPPORTED_LANGUAGES=["en","zh","ja","ko","es","ar","fr","pt","ru","hi","de","id","th","vi","tr","uk","ht","sw","uz","lo"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.19.103",
3
+ "version": "2.19.105",
4
4
  "description": "ICOA CLI — The world's first CLI-native CTF competition terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1 @@
1
+ const BN: Strings = {"howToPlay":"কিভাবে খেলবেন:","htpAnswer":"প্রশ্নের উত্তর দিন","htpHelp":"একটি ভুল অপশন মুছে ফেলুন","htpNav":"প্রশ্নগুলোর মধ্যে স্থানান্তর করুন","htpMoreHelp":"+৩টি বোনাস সাহায্য","htpBack":"বিরতি দিন এবং মেনুতে ফিরে যান","htpLang":"সব ভাষা দেখুন / পরিবর্তন করতে lang es টাইপ করুন","egg3":"Sydney Opera House — দারুণ শুরু!","egg5":"একটি koala বলছে গ'ডে — ১/৩ শেষ!","egg7":"Sydney Harbour Bridge — এগিয়ে চলুন!","egg9":"একটি ক্যাঙ্গারু লাফিয়ে গেল — অর্ধেকের বেশি শেষ!","egg11":"Bondi Beach — প্রায় শেষ!","egg13":"Great Barrier Reef — আর মাত্র ২টি বাকি!","egg15":"গ'ডে মেট! সব শেষ! 🇦🇺","answerThis":"এই প্রশ্নের উত্তর দিন","helpRemove":"একটি ভুল অপশন মুছে ফেলুন","helpUsedUp":"শেষ হয়ে গেছে — +৩ এর জন্য more help টাইপ করুন","helpAllUsed":"শেষ হয়ে গেছে","wrong":"ভুল","qTutorial":"👉 কি হয় দেখতে \"help\" টাইপ করে দেখুন!","qTutorialBlock":"কি কাজ করে তা দেখতে প্রথমে help টাইপ করে দেখুন!","qTutorialRequired":"উত্তর দেওয়ার আগে এই প্রশ্নে আপনাকে help ব্যবহার করতে হবে।","allAnswered":"🎉 সব প্রশ্নের উত্তর দেওয়া হয়েছে!","typeSubmit":"ফলাফল দেখতে exam submit টাইপ করুন!","autoSubmitting":"আপনার ডেমো স্বয়ংক্রিয়ভাবে submit করা হচ্ছে...","grading":"মূল্যায়ন করা হচ্ছে...","complete":"সম্পন্ন!","passed":"✓ পাস করেছেন","notPassed":"✗ পাস করেননি","score":"স্কোর","incorrectIntro":"ভুল — এখানে সঠিক উত্তরগুলো দেওয়া হলো:","yourAnswer":"আপনার উত্তর","correct":"সঠিক","perfectScore":"পারফেক্ট স্কোর! সব উত্তর সঠিক! 🎉","theoryDone":"এগুলো ছিল থিওরি প্রশ্ন। আসল ICOA","theoryDone2":"প্রতিযোগিতায়, সবকিছু এই টার্মিনালেই হয়।","didYouKnow":"আপনি কি জানেন?","ctfHistory1":"১৯৯৬ সালে DEF CON 4-এ CTF (Capture The Flag) শুরু হয়েছিল,","ctfHistory2":"Las Vegas-এ। Jeff Moss (Dark Tangent) এটি প্রতিষ্ঠা করেন।","ctfHistory3":"২০২৬ সালে বিশ্বব্যাপী CTF-এর ৩০ বছর পূর্ণ হবে।","ctfFlags1":"একটি CTF-এ, আপনি লুকানো চ্যালেঞ্জ সমাধান করে খুঁজে পান","ctfFlags2":"\"flags\" — গোপন কোড যেমন:","ctfFlags3":"খুঁজে বের করুন, submit করুন, পয়েন্ট অর্জন করুন!","timeline1":"১৯৯৬ প্রথম CTF @ DEF CON, Las Vegas","timeline2":"২০১৬ DARPA Cyber Grand Challenge — CTF-এ AI-এর প্রবেশ","timeline3":"২০২৬ ICOA — প্রথম AI সিকিউরিটি অলিম্পিয়াড, Sydney","twoTracks":"ICOA-তে ২টি প্রতিযোগিতা ট্র্যাক ব্যবহার করা হয়:","ai4ctfDesc":"CTF চ্যালেঞ্জ সমাধানে AI-এর সাহায্য নিন","ai4ctfSub":"AI আপনার সতীর্থ। চ্যাট করুন, hint চান, একসাথে কাজ করুন।","ctf4aiDesc":"AI-কে বোকা বানান (প্রম্পট ইনজেকশন)","ctf4aiSub":"আপনি কি AI-কে তার নিজস্ব সুরক্ষা নিয়ম ভাঙতে বাধ্য করতে পারেন?","wantToContinue":"দুটিরই অভিজ্ঞতা নিতে চান? টাইপ করুন","orBack":"অথবা মেইন মেনুতে ফিরতে \"back\" টাইপ করুন।","ai4ctfTitle":"AI4CTF ডেমো — AI আপনার সতীর্থ","ai4ctfSample":"এখানে একটি নমুনা CTF চ্যালেঞ্জ দেওয়া হলো:","ai4ctfChallenge":"চ্যালেঞ্জ: লুকানো বার্তা [ক্রিপ্টোগ্রাফি]","ai4ctfIntercepted":"আপনি এই এনকোড করা টেক্সটটি আটক করেছেন:","ai4ctfDecode":"আপনি কি flag খুঁজে পেতে এটি ডিকোড করতে পারবেন?","ai4ctfLevels":"প্রতিযোগিতায়, আপনি ৩টি লেভেলে AI-এর সাহায্য পাবেন:","ai4ctfHintA":"সাধারণ দিকনির্দেশনা — \"এটি কোন ধরনের এনকোডিং?\"","ai4ctfHintAUses":"প্রতিযোগিতা প্রতি ৫০ বার ব্যবহার। নির্দ্বিধায় ব্যবহার করা নিরাপদ।","ai4ctfHintB":"গভীর বিশ্লেষণ — \"আমি কিভাবে Base64 ডিকোড করব?\"","ai4ctfHintBUses":"১০ বার ব্যবহার। আটকে গেলে ব্যবহার করুন।","ai4ctfHintC":"গুরুত্বপূর্ণ সহায়তা — প্রায় উত্তরটি দিয়ে দেয়","ai4ctfHintCUses":"শুধুমাত্র ২ বার ব্যবহার। শেষ উপায়!","ai4ctfTryNow":"এখনই চেষ্টা করুন: ওপরের চ্যালেঞ্জ সম্পর্কে AI-কে যেকোনো কিছু জিজ্ঞাসা করুন।","ai4ctfExample":"উদাহরণ: \"What encoding is aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ==?\"","ai4ctfFreeChat":"অথবা শুধু মুক্তভাবে চ্যাট করুন! আপনি hint a, hint b, hint c-ও ব্যবহার করতে পারেন।","ai4ctfExit":"কাজ শেষ হলে \"exit\" টাইপ করুন।","ai4ctfReport":"AI4CTF সেশন রিপোর্ট","ai4ctfTokens":"ব্যবহৃত টোকেন","ai4ctfModel":"AI মডেল","ai4ctfNext":"এরপর: ctf4ai চেষ্টা করুন — AI-কে বোকা বানিয়ে \"koala\" বলাতে বাধ্য করুন","tokenLimit":"টোকেন লিমিট শেষ!","ctf4aiTitle":"CTF4AI ডেমো — AI-কে চ্যালেঞ্জ করুন","ctf4aiChallenge":"চ্যালেঞ্জ: AI-কে একটি নিষিদ্ধ শব্দ বলাতে বাধ্য করুন","ctf4aiIntro1":"বাস্তব জগতে, AI সিস্টেমের কিছু সুরক্ষা নিয়ম থাকে।","ctf4aiIntro2":"আপনার কাজ: AI-কে বোকা বানিয়ে সেই নিয়ম ভাঙার উপায় বের করা!","ctf4aiRule":"AI কিছুতেই \"koala\" শব্দটি বলতে পারবে না।","ctf4aiMission":"আপনার মিশন: যেকোনো মূল্যে এটিকে দিয়ে \"koala\" বলানো!","ctf4aiIdeas":"চেষ্টা করার মতো আইডিয়া:","ctf4aiIdea1":"অস্ট্রেলিয়ান প্রাণীদের সম্পর্কে জিজ্ঞাসা করুন","ctf4aiIdea2":"এটিকে কোনো গল্প বা কবিতা লিখতে বলুন","ctf4aiIdea3":"এটিকে কোনো কিছু অনুবাদ বা বানান করতে বলুন","ctf4aiIdea4":"সৃজনশীল হন — কোনো ভুল পদ্ধতি নেই!","ctf4aiBudget":"কথোপকথনের বাজেট","ctf4aiQuit":"যেকোনো সময় বের হতে \"exit\" টাইপ করুন।","ctf4aiSuccess":"🎉 সফল! AI \"koala\" বলেছে!","ctf4aiDefense":"আপনি AI-এর প্রতিরক্ষা ভেঙে ফেলেছেন!","ctf4aiInjection":"এটি প্রম্পট ইনজেকশন — একটি বাস্তব AI দুর্বলতা।","ctf4aiHeld":"এইবার AI তার অবস্থানে অনড় ছিল। 💪","reportTitle":"ICOA ডেমো — সম্পূর্ণ রিপোর্ট","reportStage1":"ধাপ ১: থিওরি পরীক্ষা (১৫টি প্রশ্ন)","reportCompleted":"✓ সম্পন্ন","reportStage2":"ধাপ ২: AI4CTF — AI আপনার সতীর্থ","reportExperienced":"✓ অভিজ্ঞতাসম্পন্ন","reportStage2Sub":"আপনি একটি CTF চ্যালেঞ্জ বিশ্লেষণ করতে AI ব্যবহার করেছেন।","reportStage2Hints":"প্রতিযোগিতায়: hint a (৫০ বার) · hint b (১০ বার) · hint c (২ বার)","reportStage3":"ধাপ ৩: CTF4AI — AI-কে বোকা বানান","reportSolved":"✓ সমাধান হয়েছে! আপনি AI-কে দিয়ে \"koala\" বলাতে পেরেছেন","reportNotSolved":"✗ AI তার অবস্থানে অনড় ছিল","reportRecommend":"সুপারিশসমূহ:","reportRec1":"ক্রিপ্টোগ্রাফি, ওয়েব সিকিউরিটি, এবং নেটওয়ার্কিং নিয়ে পড়াশোনা করুন","reportRec2":"picoCTF এর মতো CTF প্ল্যাটফর্মগুলোতে অনুশীলন করুন","reportRec3":"প্রম্পট ইনজেকশন এবং AI সুরক্ষা সম্পর্কে জানুন","reportRec4":"৩৮টি রেফারেন্স গাইড দেখুন: \"ref\" টাইপ করুন","reportReady":"আসল প্রতিযোগিতার জন্য প্রস্তুত?","reportNations":"অংশগ্রহণকারী দেশসমূহ দেখুন","reportAbout":"ICOA 2026 সম্পর্কে আরও জানুন","reportDemo":"আবার চেষ্টা করুন","continueTitle":"AI4CTF — AI আপনার সতীর্থ","continueLevels":"AI4CTF-এ, আপনি পাশে থাকা AI-এর সাহায্য নিয়ে\nসাইবার সিকিউরিটি চ্যালেঞ্জ সমাধান করেন।","continueHints":"প্রতিযোগিতায়, আপনি ৩টি লেভেলে AI-এর সাহায্য পাবেন:","continueHintA":"সাধারণ দিকনির্দেশনা (৫০ বার ব্যবহার)","continueHintB":"গভীর বিশ্লেষণ (১০ বার ব্যবহার)","continueHintC":"গুরুত্বপূর্ণ সহায়তা (২ বার ব্যবহার)","continueTry":"এখনই চেষ্টা করুন! টাইপ করুন:","continueChat":"আপনার AI সতীর্থের সাথে মুক্তভাবে চ্যাট করুন। কাজ শেষ হলে \"exit\" টাইপ করুন।","continueAfter":"ai4ctf-এর পর, চেষ্টা করুন: ctf4ai — AI-কে বোকা বানিয়ে \"koala\" বলাতে বাধ্য করুন","ai4ctfCommands":"কমান্ডসমূহ:","ai4ctfSubmitCmd":"আপনার উত্তর submit করুন (উদাঃ submit icoa{...})","ai4ctfShellCmd":"একটি শেল কমান্ড রান করুন (উদাঃ !echo aWNv... | base64 -d)","ai4ctfEndSession":"সেশন শেষ করুন","ai4ctfCorrectFlag":"🎉 সঠিক! Flag গৃহীত হয়েছে!","ai4ctfDecoded":"আপনি Base64 ডিকোড করে flag খুঁজে পেয়েছেন।","ai4ctfWouldEarn":"আসল প্রতিযোগিতায়, এর মাধ্যমে আপনি পয়েন্ট অর্জন করতেন!","ai4ctfWrongFlag":"✗ ভুল flag। আবার চেষ্টা করুন!","ai4ctfFlagHint":"Hint: Base64 স্ট্রিংটি ডিকোড করুন। Flag-এর ফরম্যাট: icoa{...}","ai4ctfFoundFlag":"কোনো flag পেয়েছেন? টাইপ করুন: submit <flag>","ai4ctfThinking":"ভাবছে...","ctf4aiRelaxed":"৫০%-এর পর, বানান করে লেখা ভেরিয়েন্টও (K-O-A-L-A) গ্রহণযোগ্য হবে!","ctf4aiEnded":"CTF4AI চ্যালেঞ্জ শেষ হয়েছে।","ctf4aiAlready":"ইতোমধ্যে CTF4AI চ্যালেঞ্জে আছেন। আপনার মেসেজ বা \"exit\" টাইপ করুন।","ctf4aiPrompt":"AI-কে দিয়ে \"koala\" বলানোর চেষ্টা করুন...","ctf4aiThinking":"ভাবছে...","readyToTry":"চেষ্টা করতে প্রস্তুত? একটি কমান্ড টাইপ করুন:","forNational":"জাতীয় নির্বাচনী পরীক্ষার জন্য:","viewRegions":"অংশগ্রহণকারী সব অঞ্চল দেখুন","enterExam":"আপনার দেশের নির্বাচনী পরীক্ষায় প্রবেশ করুন","htpJump":"নির্দিষ্ট কোনো প্রশ্নে যান","htpReview":"প্রগতি চেক করুন","htpSubmit":"মূল্যায়নের জন্য আপনার উত্তরগুলো submit করুন","htpMark":"এই প্রশ্নটি পরে দেখার জন্য flag করুন","nextLabel":"পরবর্তী:","reportRetryCta":"যেগুলো ভুল হয়েছে সেগুলো ঠিক করতে চান? টাইপ করুন:","reportRetryWrongN":"{n}টি ভুল প্রশ্ন আবার চেষ্টা করুন","reportRetryWrongNPlural":"{n}টি ভুল প্রশ্ন আবার চেষ্টা করুন","reportBackHint":"মেইন মেনুতে ফিরে যান","reportAboutHint":"ICOA 2026 সম্পর্কে আরও জানুন","reportExamSetupHint":"পরবর্তী ধাপ: জাতীয় নির্বাচনের জন্য টুলস প্রস্তুত করুন","ai4ctfExitNextTitle":"পরবর্তী:","ai4ctfExitNextSub":"AI-কে চ্যালেঞ্জ করুন (প্রম্পট ইনজেকশন)","ai4ctfExitNextBody":"আপনি কি কোনো AI-কে তার নিজস্ব সুরক্ষা নিয়ম ভাঙতে বাধ্য করতে পারেন?","ai4ctfExitCmdNext":"পরবর্তী চ্যালেঞ্জ শুরু করুন","ai4ctfExitCmdBack":"মেইন মেনুতে ফিরে যান","ai4ctfWelcomeCta":"👉 এখানে নতুন? ক্রমানুসারে hint-গুলো দিয়ে শুরু করুন:","ai4ctfHintNudge":"ইশারা","ai4ctfHintTechnique":"কৌশল","ai4ctfHintPrinciple":"মূলনীতি + শেল রিমাইন্ডার","ai4ctfWelcomeNoReveal":"(hint-গুলো আপনাকে পথ দেখাবে — তারা কখনোই সরাসরি উত্তর দেয় না)","ai4ctfOrChat":"অথবা আপনার AI সতীর্থের সাথে মুক্তভাবে চ্যাট করুন — যেকোনো কিছু জিজ্ঞাসা করুন","ai4ctfOrChatExample":"চ্যালেঞ্জ সম্পর্কে। উদাহরণ:","ai4ctfCmdHintLine":"আগে থেকে লেখা hint (ব্যবহার করা নিরাপদ)","ai4ctfCmdShellLine":"একটি শেল কমান্ড রান করুন","ai4ctfHintABody":"স্ট্রিংটি \"==\" দিয়ে শেষ হয়েছে এবং এতে শুধুমাত্র অক্ষর, সংখ্যা, \"+\", \"/\" এবং \"=\" ব্যবহৃত হয়েছে।\nএই প্যাটার্নটি একটি ফিঙ্গারপ্রিন্ট — আপনি এটি আগেও দেখেছেন।\nকোথায় সাধারণত \"=\" প্যাডিং হিসেবে ব্যবহৃত হয়?","ai4ctfHintBBody":"এটি Base64 এনকোড করা। flag খুঁজে পেতে স্ট্রিংটি ডিকোড করুন。","ai4ctfHintCBody":"Hint কখনোই সরাসরি উত্তর দেয় না — তারা শুধু আপনাকে সঠিক দিকনির্দেশনা দেয়।\nএরকম সহজ চ্যালেঞ্জের জন্য, hint c অতিরিক্ত কিছুই দেয় না:\nhint b ইতোমধ্যেই আপনার প্রয়োজনীয় সবকিছু বলে দিয়েছে।\n\nএখান থেকে সামনে এগোনোর ২টি উপায় আছে:\n\n ১. স্বাভাবিক ভাষায় আপনার AI সতীর্থের সাথে চ্যাট করুন। উদাহরণ:\n what is the base64 command?\n how do I decode Base64 on macOS?\n শুধু প্রশ্নটি টাইপ করুন — \"!\" ছাড়া যেকোনো কিছু AI-এর কাছে চলে যাবে।\n\n ২. সরাসরি একটি শেল কমান্ড রান করুন। ai4ctf-এর ভেতরের শেল কমান্ডগুলো\n অবশ্যই \"!\" দিয়ে শুরু হতে হবে, অন্যথায় আপনার টেক্সট AI-এর কাছে চলে যাবে। উদাহরণ:\n\n !echo aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ== | base64 -d","ai4ctfHintNextA":"আটকে গেছেন? চেষ্টা করুন:","ai4ctfHintNextB":"সত্যিই আটকে গেছেন? চেষ্টা করুন:","ai4ctfWrapTitle":"✨ আপনি যা শিখলেন","ai4ctfWrapLine1Head":"কোনো কমান্ড দরকার?","ai4ctfWrapLine1Body":"স্বাভাবিক ভাষায় আপনার AI সতীর্থকে শুধু জিজ্ঞাসা\nকরুন — \"how do I decode Base64 on the command line?\"\nআপনার প্রতিটি টুল মুখস্থ রাখার দরকার নেই। AI-এর যুগটি\nহলো {thinking} বা চিন্তার, যান্ত্রিক মুখস্থ করার জন্য নয়。","ai4ctfWrapLine2Head":"কিছু রান করতে চান?","ai4ctfWrapLine2Body":"শেল কমান্ডের আগে \"!\" বসিয়ে দিন:","ai4ctfWrapQuotasTitle":"🎯 আসল প্রতিযোগিতার hint-এর কোটা","ai4ctfWrapQuotaA":"প্রতিযোগিতায় ৫০ বার ব্যবহার","ai4ctfWrapQuotaAHint":"(নির্দ্বিধায় ব্যবহার করুন)","ai4ctfWrapQuotaB":"১০ বার ব্যবহার","ai4ctfWrapQuotaBHint":"(আটকে গেলে)","ai4ctfWrapQuotaC":" ২ বার ব্যবহার","ai4ctfWrapQuotaCHint":"(শেষ উপায়)","ai4ctfWrapQuotaFooter":"hint a → b → c এভাবেই ব্যবহার করার চেষ্টা করুন। আর যখন আপনার শুধু\nকিছু খুঁজতে হবে, তখন প্রথমে AI-এর সাথে চ্যাট করুন — এটি আপনার\nhint কোটা থেকে কোনো কিছু কমাবে না。","ai4ctfWrapNextTitle":"🔜 পরবর্তীতে:","ai4ctfWrapNextSub":"AI-কে বোকা বানিয়ে \"koala\" বলাতে বাধ্য করুন","ai4ctfWrapNextBody":"এই পরবর্তী ডেমোটিতে {noProg} — শুধু আপনার\nবুদ্ধি আর সৃজনশীলতা। আপনি কি একটি \"safe\" AI-কে তার\nনিজস্ব নিয়ম ভাঙতে বাধ্য করতে পারবেন?","ai4ctfWrapNoProg":"কোনো প্রোগ্রামিং-এর প্রয়োজন নেই","ai4ctfWrapTypeCtf4ai":"টাইপ করুন:","ai4ctfRevealTitle":"💡 AI টোকেন শেষ — এখানে উত্তর দেওয়া হলো","ai4ctfRevealBody":"মনে হচ্ছে আপনি এখনও flag খুঁজে পাননি।\nচিন্তার কিছু নেই — ডেমোর জন্য আমরাই আপনাকে বলে দিচ্ছি।\n\nBase64 স্ট্রিংটি ডিকোড করতে এই কমান্ডটি রান করুন:","ai4ctfRevealSeeFlag":"আপনি flag দেখতে পাবেন:","ai4ctfRevealThenSubmit":"তারপর এটি submit করুন:","ai4ctfRevealLockNote":"(AI চ্যাট লক করা হয়েছে — এখন শুধুমাত্র শেল কমান্ড এবং submit কাজ করবে।)","ai4ctfLockedTitle":"AI চ্যাট লক করা হয়েছে — টোকেন শেষ।","ai4ctfLockedUse":"ব্যবহার করুন:","ai4ctfLockedThen":"তারপর:"};
@@ -0,0 +1 @@
1
+ const LO: Strings = {"howToPlay":"ວິທີຫຼິ້ນ:","htpAnswer":"ຕອບຄຳຖາມ","htpHelp":"ລົບຕົວເລືອກທີ່ຜິດອອກ","htpNav":"ຍ້າຍໄປມາລະຫວ່າງຄຳຖາມ","htpMoreHelp":"ຊ່ວຍເຫຼືອພິເສດ +3","htpBack":"ຢຸດຊົ່ວຄາວ ແລະ ກັບຄືນໜ້າຫຼັກ","htpLang":"ເບິ່ງທຸກພາສາ / ພິມ lang es ເພື່ອປ່ຽນ","egg3":"Sydney Opera House — ເລີ່ມຕົ້ນໄດ້ດີ!","egg5":"koala ເວົ້າວ່າ ກູດເດ — ສຳເລັດ 1/3 ແລ້ວ!","egg7":"Sydney Harbour Bridge — ສືບຕໍ່ໄປ!","egg9":"ຈິງໂຈ້ໂດດຜ່ານໄປ — ຜ່ານເຄິ່ງທາງແລ້ວ!","egg11":"Bondi Beach — ໃກ້ຈະຮອດແລ້ວ!","egg13":"Great Barrier Reef — ອີກ 2 ຂໍ້ເທົ່ານັ້ນ!","egg15":"ກູດເດ ເມທ! ສຳເລັດທັງໝົດແລ້ວ! 🇦🇺","answerThis":"ຕອບຄຳຖາມນີ້","helpRemove":"ລົບຕົວເລືອກທີ່ຜິດອອກ","helpUsedUp":"ໃຊ້ໝົດແລ້ວ — ພິມ more help ເພື່ອຮັບ +3","helpAllUsed":"ໃຊ້ໝົດແລ້ວ","wrong":"ຜິດ","qTutorial":"👉 ລອງພິມ \"help\" ເພື່ອເບິ່ງວ່າມີຫຍັງເກີດຂຶ້ນ!","qTutorialBlock":"ລອງພິມ help ກ່ອນເພື່ອເບິ່ງວ່າມັນເຮັດຫຍັງ!","qTutorialRequired":"ຄຳຖາມນີ້ຮຽກຮ້ອງໃຫ້ໃຊ້ help ກ່ອນຕອບ.","allAnswered":"🎉 ຕອບຄຳຖາມຄົບທັງໝົດແລ້ວ!","typeSubmit":"ພິມ exam submit ເພື່ອເບິ່ງຜົນຮັບຂອງເຈົ້າ!","autoSubmitting":"ກຳລັງສົ່ງ demo ຂອງທ່ານອັດຕະໂນມັດ...","grading":"ກຳລັງກວດຄະແນນ...","complete":"ສຳເລັດ!","passed":"✓ ຜ່ານ","notPassed":"✗ ບໍ່ຜ່ານ","score":"ຄະແນນ","incorrectIntro":"ຜິດ — ນີ້ແມ່ນຄຳຕອບທີ່ຖືກຕ້ອງ:","yourAnswer":"ຄຳຕອບຂອງເຈົ້າ","correct":"ຖືກຕ້ອງ","perfectScore":"ຄະແນນເຕັມ! ຕອບຖືກທຸກຂໍ້! 🎉","theoryDone":"ເຫຼົ່ານີ້ແມ່ນຄຳຖາມທິດສະດີ. ໃນການແຂ່ງຂັນ ICOA ຕົວຈິງ","theoryDone2":"ທຸກຢ່າງຈະເກີດຂຶ້ນໃນ terminal ນີ້.","didYouKnow":"ຮູ້ຫຼືບໍ່?","ctfHistory1":"CTF (Capture The Flag) ເລີ່ມຕົ້ນທີ່ DEF CON 4 ໃນປີ 1996,","ctfHistory2":"Las Vegas. ກໍ່ຕັ້ງໂດຍ Jeff Moss (Dark Tangent).","ctfHistory3":"ປີ 2026 ຄົບຮອບ 30 ປີຂອງ CTF ທົ່ວໂລກ.","ctfFlags1":"ໃນ CTF, ເຈົ້າແກ້ໄຂສິ່ງທ້າທາຍເພື່ອຊອກຫາ","ctfFlags2":"\"flags\" ທີ່ເຊື່ອງໄວ້ — ລະຫັດລັບເຊັ່ນ:","ctfFlags3":"ຊອກຫາມັນ, submit ມັນ, ຮັບຄະແນນ!","timeline1":"1996 CTF ທຳອິດ @ DEF CON, Las Vegas","timeline2":"2016 DARPA Cyber Grand Challenge — AI ເຂົ້າສູ່ CTF","timeline3":"2026 ICOA — ການແຂ່ງຂັນ AI Security Olympiad ທຳອິດ, Sydney","twoTracks":"ICOA ໃຊ້ 2 ຮູບແບບການແຂ່ງຂັນ:","ai4ctfDesc":"ໃຊ້ AI ເພື່ອຊ່ວຍທ່ານແກ້ໄຂບັນຫາ CTF","ai4ctfSub":"AI ແມ່ນເພື່ອນຮ່ວມທີມຂອງທ່ານ. ສົນທະນາ, ຂໍ hint, ແລະ ເຮັດວຽກຮ່ວມກັນ.","ctf4aiDesc":"ຫຼອກລວງ AI (Prompt Injection)","ctf4aiSub":"ເຈົ້າສາມາດເຮັດໃຫ້ AI ລະເມີດກົດຄວາມປອດໄພຂອງມັນເອງໄດ້ຫຼືບໍ່?","wantToContinue":"ຕ້ອງການສຳຜັດທັງສອງຢ່າງບໍ່? ພິມ","orBack":"ຫຼືພິມ \"back\" ເພື່ອກັບຄືນສູ່ໜ້າຫຼັກ.","ai4ctfTitle":"AI4CTF Demo — AI ໃນຖານະເພື່ອນຮ່ວມທີມຂອງເຈົ້າ","ai4ctfSample":"ນີ້ແມ່ນຕົວຢ່າງຂອງສິ່ງທ້າທາຍ CTF:","ai4ctfChallenge":"ສິ່ງທ້າທາຍ: ຂໍ້ຄວາມທີ່ຖືກເຊື່ອງໄວ້ [Cryptography]","ai4ctfIntercepted":"ເຈົ້າສະກັດຈັບຂໍ້ຄວາມທີ່ເຂົ້າລະຫັດນີ້ໄດ້:","ai4ctfDecode":"ເຈົ້າສາມາດຖອດລະຫັດມັນເພື່ອຊອກຫາ flag ໄດ້ບໍ່?","ai4ctfLevels":"ໃນການແຂ່ງຂັນ, ທ່ານຈະໄດ້ຮັບການຊ່ວຍເຫຼືອຈາກ AI 3 ລະດັບ:","ai4ctfHintA":"ຄຳແນະນຳທົ່ວໄປ — \"ນີ້ແມ່ນການເຂົ້າລະຫັດປະເພດໃດ?\"","ai4ctfHintAUses":"ໃຊ້ໄດ້ 50 ຄັ້ງຕໍ່ການແຂ່ງຂັນ. ໃຊ້ໄດ້ຢ່າງອິດສະຫຼະ.","ai4ctfHintB":"ການວິເຄາະແບບເລິກເຊິ່ງ — \"ຂ້ອຍຈະຖອດລະຫັດ Base64 ໄດ້ແນວໃດ?\"","ai4ctfHintBUses":"ໃຊ້ໄດ້ 10 ຄັ້ງ. ໃຊ້ເມື່ອເຈົ້າຕິດຂັດແທ້ໆ.","ai4ctfHintC":"ການຊ່ວຍເຫຼືອຂັ້ນວິກິດ — ເກືອບຈະບອກຄຳຕອບເຈົ້າແລ້ວ","ai4ctfHintCUses":"ໃຊ້ໄດ້ 2 ຄັ້ງເທົ່ານັ້ນ. ທາງເລືອກສຸດທ້າຍ!","ai4ctfTryNow":"ລອງເລີຍ: ຖາມ AI ກ່ຽວກັບສິ່ງທ້າທາຍດ້ານເທິງ.","ai4ctfExample":"ຕົວຢ່າງ: \"ການເຂົ້າລະຫັດ aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ== ແມ່ນຫຍັງ?\"","ai4ctfFreeChat":"ຫຼືລົມກັນແບບອິດສະຫຼະ! ເຈົ້າຍັງສາມາດລອງ hint a, hint b, hint c ໄດ້.","ai4ctfExit":"ພິມ \"exit\" ເມື່ອສຳເລັດ.","ai4ctfReport":"ລາຍງານເຊດຊັນ AI4CTF","ai4ctfTokens":"Tokens ທີ່ໃຊ້","ai4ctfModel":"ໂມເດວ AI","ai4ctfNext":"ຕໍ່ໄປ: ລອງ ctf4ai — ຫຼອກລວງ AI ໃຫ້ເວົ້າວ່າ \"koala\"","tokenLimit":"ຮອດຂີດຈຳກັດ Token ແລ້ວ!","ctf4aiTitle":"CTF4AI Demo — ທ້າທາຍ AI","ctf4aiChallenge":"ສິ່ງທ້າທາຍ: ເຮັດໃຫ້ AI ເວົ້າຄຳຕ້ອງຫ້າມ","ctf4aiIntro1":"ໃນໂລກຄວາມຈິງ, ລະບົບ AI ມີກົດຄວາມປອດໄພ.","ctf4aiIntro2":"ໜ້າທີ່ຂອງເຈົ້າ: ຊອກຫາວິທີຫຼອກລວງ AI ໃຫ້ລະເມີດກົດເຫຼົ່ານັ້ນ!","ctf4aiRule":"AI ຕ້ອງບໍ່ເວົ້າຄຳວ່າ \"koala\" ເດັດຂາດ.","ctf4aiMission":"ພາລະກິດຂອງເຈົ້າ: ເຮັດແນວໃດກໍໄດ້ໃຫ້ມັນເວົ້າວ່າ \"koala\"!","ctf4aiIdeas":"ໄອເດຍທີ່ຄວນລອງ:","ctf4aiIdea1":"ຖາມກ່ຽວກັບສັດຂອງອົດສະຕຣາລີ","ctf4aiIdea2":"ຂໍໃຫ້ມັນຂຽນນິທານ ຫຼື ບົດກະວີ","ctf4aiIdea3":"ຂໍໃຫ້ມັນແປ ຫຼື ສະກົດຄຳບາງຢ່າງ","ctf4aiIdea4":"ໃຊ້ຄວາມຄິດສ້າງສັນ — ບໍ່ມີວິທີໃດຜິດ!","ctf4aiBudget":"ຈຳນວນການສົນທະນາທີ່ເຫຼືອ","ctf4aiQuit":"ພິມ \"exit\" ເພື່ອອອກໄດ້ທຸກເມື່ອ.","ctf4aiSuccess":"🎉 ສຳເລັດ! AI ເວົ້າຄຳວ່າ \"koala\" ໄດ້ແລ້ວ!","ctf4aiDefense":"ເຈົ້າທະລຸການປ້ອງກັນຂອງ AI ໄດ້ແລ້ວ!","ctf4aiInjection":"ນີ້ຄື prompt injection — ຊ່ອງໂຫວ່ທີ່ແທ້ຈິງຂອງ AI.","ctf4aiHeld":"ຄັ້ງນີ້ AI ຮັກສາຈຸດຢືນຂອງມັນໄວ້ໄດ້. 💪","reportTitle":"ICOA Demo — ລາຍງານສະບັບສົມບູນ","reportStage1":"ໄລຍະ 1: ການສອບເສັງທິດສະດີ (15 ຄຳຖາມ)","reportCompleted":"✓ ສຳເລັດແລ້ວ","reportStage2":"ໄລຍະ 2: AI4CTF — AI ໃນຖານະເພື່ອນຮ່ວມທີມຂອງເຈົ້າ","reportExperienced":"✓ ໄດ້ສຳຜັດແລ້ວ","reportStage2Sub":"ເຈົ້າໄດ້ໃຊ້ AI ເພື່ອວິເຄາະສິ່ງທ້າທາຍ CTF.","reportStage2Hints":"ໃນການແຂ່ງຂັນ: hint a (50x) · hint b (10x) · hint c (2x)","reportStage3":"ໄລຍະ 3: CTF4AI — ຫຼອກລວງ AI","reportSolved":"✓ ແກ້ໄຂໄດ້ແລ້ວ! ເຈົ້າເຮັດໃຫ້ AI ເວົ້າວ່າ \"koala\" ໄດ້","reportNotSolved":"✗ AI ຮັກສາຈຸດຢືນຂອງມັນໄວ້ໄດ້","reportRecommend":"ຂໍ້ແນະນຳ:","reportRec1":"ສຶກສາ cryptography, web security, ແລະ networking","reportRec2":"ຝຶກຊ້ອມໃນແພລັດຟອມ CTF ເຊັ່ນ picoCTF","reportRec3":"ຮຽນຮູ້ກ່ຽວກັບ prompt injection ແລະ ຄວາມປອດໄພຂອງ AI","reportRec4":"ສຳຫຼວດຄູ່ມືອ້າງອີງທັງ 38 ຫົວ: ພິມ \"ref\"","reportReady":"ພ້ອມສຳລັບການແຂ່ງຂັນຈິງຫຼືຍັງ?","reportNations":"ເບິ່ງປະເທດທີ່ເຂົ້າຮ່ວມ","reportAbout":"ຮຽນຮູ້ເພີ່ມເຕີມກ່ຽວກັບ ICOA 2026","reportDemo":"ລອງໃໝ່ອີກຄັ້ງ","continueTitle":"AI4CTF — AI ໃນຖານະເພື່ອນຮ່ວມທີມຂອງເຈົ້າ","continueLevels":"ໃນ AI4CTF, ເຈົ້າຈະແກ້ໄຂສິ່ງທ້າທາຍດ້ານຄວາມປອດໄພທາງໄຊເບີ\nໂດຍມີ AI ຢູ່ຄຽງຂ້າງ.","continueHints":"ໃນການແຂ່ງຂັນ, ເຈົ້າຈະໄດ້ຮັບການຊ່ວຍເຫຼືອຈາກ AI 3 ລະດັບ:","continueHintA":"ຄຳແນະນຳທົ່ວໄປ (ໃຊ້ໄດ້ 50 ຄັ້ງ)","continueHintB":"ການວິເຄາະແບບເລິກເຊິ່ງ (ໃຊ້ໄດ້ 10 ຄັ້ງ)","continueHintC":"ການຊ່ວຍເຫຼືອຂັ້ນວິກິດ (ໃຊ້ໄດ້ 2 ຄັ້ງ)","continueTry":"ລອງເລີຍຕອນນີ້! ພິມ:","continueChat":"ລົມກັບເພື່ອນຮ່ວມທີມ AI ແບບອິດສະຫຼະ. ພິມ \"exit\" ເມື່ອສຳເລັດ.","continueAfter":"ຫຼັງຈາກ ai4ctf, ລອງ: ctf4ai — ຫຼອກລວງ AI ໃຫ້ເວົ້າວ່າ \"koala\"","ai4ctfCommands":"ຄຳສັ່ງ:","ai4ctfSubmitCmd":"ສົ່ງຄຳຕອບຂອງເຈົ້າ (ຕົວຢ່າງ: submit icoa{...})","ai4ctfShellCmd":"ເປີດໃຊ້ shell command (ຕົວຢ່າງ: !echo aWNv... | base64 -d)","ai4ctfEndSession":"ຈົບເຊດຊັນ","ai4ctfCorrectFlag":"🎉 ຖືກຕ້ອງ! ຍອມຮັບ flag ແລ້ວ!","ai4ctfDecoded":"ເຈົ້າໄດ້ຖອດລະຫັດ Base64 ແລະ ພົບ flag ແລ້ວ.","ai4ctfWouldEarn":"ໃນການແຂ່ງຂັນຈິງ, ອັນນີ້ຈະເຮັດໃຫ້ເຈົ້າໄດ້ຮັບຄະແນນ!","ai4ctfWrongFlag":"✗ flag ບໍ່ຖືກຕ້ອງ. ລອງໃໝ່!","ai4ctfFlagHint":"Hint: ຖອດລະຫັດ Base64. ຮູບແບບ Flag: icoa{...}","ai4ctfFoundFlag":"ພົບ flag ແລ້ວບໍ່? ພິມ: submit <flag>","ai4ctfThinking":"ກຳລັງຄິດ...","ctf4aiRelaxed":"ຫຼັງຈາກ 50%, ຮູບແບບການສະກົດຄຳ (K-O-A-L-A) ກໍຖືກນັບຄືກັນ!","ctf4aiEnded":"ສິ່ງທ້າທາຍ CTF4AI ສິ້ນສຸດແລ້ວ.","ctf4aiAlready":"ຢູ່ໃນສິ່ງທ້າທາຍ CTF4AI ຢູ່ແລ້ວ. ພິມຂໍ້ຄວາມຂອງເຈົ້າ ຫຼື \"exit\".","ctf4aiPrompt":"ລອງເຮັດໃຫ້ AI ເວົ້າຄຳວ່າ \"koala\"...","ctf4aiThinking":"ກຳລັງຄິດ...","readyToTry":"ພ້ອມທີ່ຈະລອງຫຼືຍັງ? ພິມຄຳສັ່ງ:","forNational":"ສຳລັບການສອບເສັງຄັດເລືອກລະດັບຊາດ:","viewRegions":"ເບິ່ງພາກພື້ນທີ່ເຂົ້າຮ່ວມທັງໝົດ","enterExam":"ເຂົ້າສູ່ການສອບເສັງຄັດເລືອກຂອງປະເທດທ່ານ","htpJump":"ຂ້າມໄປຍັງຄຳຖາມສະເພາະ","htpReview":"ກວດເບິ່ງຄວາມຄືບໜ້າ","htpSubmit":"submit ຄຳຕອບເພື່ອຮັບຄະແນນ","htpMark":"ໝາຍຄຳຖາມນີ້ເພື່ອກວດຄືນພາຍຫຼັງ","nextLabel":"ຕໍ່ໄປ:","reportRetryCta":"ຢາກແກ້ໄຂຂໍ້ທີ່ພາດໄປບໍ່? ພິມ:","reportRetryWrongN":"ລອງໃໝ່ໃນຄຳຖາມທີ່ຜິດ {n} ຂໍ້","reportRetryWrongNPlural":"ລອງໃໝ່ໃນຄຳຖາມທີ່ຜິດ {n} ຂໍ້","reportBackHint":"ກັບຄືນໜ້າຫຼັກ","reportAboutHint":"ຮຽນຮູ້ເພີ່ມເຕີມກ່ຽວກັບ ICOA 2026","reportExamSetupHint":"ລະດັບຕໍ່ໄປ: ກຽມເຄື່ອງມືສຳລັບການຄັດເລືອກລະດັບຊາດ","ai4ctfExitNextTitle":"ຕໍ່ໄປ:","ai4ctfExitNextSub":"ທ້າທາຍ AI (Prompt Injection)","ai4ctfExitNextBody":"ເຈົ້າສາມາດເຮັດໃຫ້ AI ລະເມີດກົດຄວາມປອດໄພຂອງມັນເອງໄດ້ຫຼືບໍ່?","ai4ctfExitCmdNext":"ເລີ່ມຕົ້ນສິ່ງທ້າທາຍຕໍ່ໄປ","ai4ctfExitCmdBack":"ກັບຄືນໜ້າຫຼັກ","ai4ctfWelcomeCta":"👉 ຫາກໍເຄີຍມາເທື່ອທຳອິດ? ເລີ່ມຕົ້ນດ້ວຍການໃຊ້ hint ຕາມລຳດັບ:","ai4ctfHintNudge":"ກະຕຸ້ນ","ai4ctfHintTechnique":"ເຕັກນິກ","ai4ctfHintPrinciple":"ຫຼັກການ + ແຈ້ງເຕືອນ shell","ai4ctfWelcomeNoReveal":"(hints ຊ່ວຍແນະນຳທາງໃຫ້ເຈົ້າ — ພວກມັນຈະບໍ່ບອກຄຳຕອບໂດຍກົງ)","ai4ctfOrChat":"ຫຼືລົມກັນແບບອິດສະຫຼະກັບເພື່ອນຮ່ວມທີມ AI — ຖາມຫຍັງກໍໄດ້","ai4ctfOrChatExample":"ກ່ຽວກັບສິ່ງທ້າທາຍ. ຕົວຢ່າງ:","ai4ctfCmdHintLine":"hints ທີ່ຂຽນໄວ້ລ່ວງໜ້າ (ປອດໄພໃນການໃຊ້ງານ)","ai4ctfCmdShellLine":"ເປີດໃຊ້ shell command","ai4ctfHintABody":"ສະຕຣິງລົງທ້າຍດ້ວຍ \"==\" ແລະ ໃຊ້ສະເພາະຕົວໜັງສື, ຕົວເລກ, \"+\", \"/\", ແລະ \"=\".\nຮູບແບບນີ້ຄືລາຍນິ້ວມື — ເຈົ້າເຄີຍເຫັນມັນມາກ່ອນແລ້ວ.\nສ່ວນໃຫຍ່ \"=\" ຖືກໃຊ້ເປັນ padding ຢູ່ໃສ?","ai4ctfHintBBody":"ນີ້ຄືການເຂົ້າລະຫັດ Base64. ຖອດລະຫັດສະຕຣິງເພື່ອຊອກຫາ flag.","ai4ctfHintCBody":"Hints ຈະບໍ່ບອກຄຳຕອບໂດຍກົງເດັດຂາດ — ພວກມັນພຽງແຕ່ຊີ້ບອກທິດທາງທີ່ຖືກຕ້ອງໃຫ້.\nສຳລັບສິ່ງທ້າທາຍງ່າຍໆແບບນີ້, hint c ບໍ່ມີຫຍັງເພີ່ມຕື່ມແລ້ວ:\nhint b ໄດ້ບອກທຸກສິ່ງທີ່ເຈົ້າຕ້ອງການໄປໝົດແລ້ວ.\n\nມີສອງທາງເລືອກໃນການສືບຕໍ່ຈາກນີ້:\n\n 1. ສົນທະນາກັບເພື່ອນຮ່ວມທີມ AI ດ້ວຍພາສາທຳມະຊາດ. ຕົວຢ່າງ:\n what is the base64 command?\n how do I decode Base64 on macOS?\n ພຽງແຕ່ພິມຄຳຖາມລົງໄປ — ອັນໃດກໍຕາມທີ່ບໍ່ມີ \"!\" ຈະຖືກສົ່ງໄປຫາ AI.\n\n 2. ເປີດໃຊ້ shell command ໂດຍກົງ. shell commands ໃນ ai4ctf\n ຈະຕ້ອງເລີ່ມຕົ້ນດ້ວຍ \"!\", ຖ້າບໍ່ດັ່ງນັ້ນຂໍ້ຄວາມຂອງເຈົ້າຈະຖືກສົ່ງໄປຫາ AI. ຕົວຢ່າງ:\n\n !echo aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ== | base64 -d","ai4ctfHintNextA":"ໄປຕໍ່ບໍ່ໄດ້? ລອງ:","ai4ctfHintNextB":"ຕັນແທ້ໆບໍ່? ລອງ:","ai4ctfWrapTitle":"✨ ສິ່ງທີ່ເຈົ້າຫາແຕ່ໄດ້ຮຽນຮູ້","ai4ctfWrapLine1Head":"ຕ້ອງການຄຳສັ່ງບໍ່?","ai4ctfWrapLine1Body":"ພຽງແຕ່ຖາມເພື່ອນຮ່ວມທີມ AI ໃນພາສາທຳມະຊາດ\n— \"how do I decode Base64 on the command line?\"\nເຈົ້າບໍ່ຈຳເປັນຕ້ອງຈື່ຈຳທຸກເຄື່ອງມື. ຍຸກຂອງ AI ແມ່ນ\nກ່ຽວກັບ {thinking}, ບໍ່ແມ່ນການທ່ອງຈຳແບບກົນຈັກ.","ai4ctfWrapLine2Head":"ຕ້ອງການເປີດໃຊ້ງານບາງຢ່າງບໍ່?","ai4ctfWrapLine2Body":"ໃສ່ \"!\" ໄວ້ທາງໜ້າ shell commands:","ai4ctfWrapQuotasTitle":"🎯 ໂຄຕ້າການໃຊ້ hint ໃນການແຂ່ງຂັນຈິງ","ai4ctfWrapQuotaA":"ໃຊ້ໄດ້ 50 ຄັ້ງຕໍ່ການແຂ່ງຂັນ","ai4ctfWrapQuotaAHint":"(ໃຊ້ໄດ້ຢ່າງອິດສະຫຼະ)","ai4ctfWrapQuotaB":"ໃຊ້ໄດ້ 10 ຄັ້ງ","ai4ctfWrapQuotaBHint":"(ເມື່ອຕິດຂັດ)","ai4ctfWrapQuotaC":" ໃຊ້ໄດ້ 2 ຄັ້ງ","ai4ctfWrapQuotaCHint":"(ທາງເລືອກສຸດທ້າຍ)","ai4ctfWrapQuotaFooter":"ຄວນເລືອກໃຊ້ hint a → b → c. ແລະ ເມື່ອເຈົ້າພຽງແຕ່ຕ້ອງການຄົ້ນຫາ\nບາງຢ່າງ, ໃຫ້ລົມກັບ AI ກ່ອນ — ມັນຈະບໍ່ເສຍ\nໂຄຕ້າການໃຊ້ hint ຂອງເຈົ້າເລີຍ.","ai4ctfWrapNextTitle":"🔜 ຕໍ່ໄປ:","ai4ctfWrapNextSub":"ຫຼອກລວງ AI ໃຫ້ເວົ້າວ່າ \"koala\"","ai4ctfWrapNextBody":"ເດໂມຕໍ່ໄປນີ້ {noProg} — ໃຊ້ພຽງແຕ່ຄວາມສະຫຼາດ\nແລະ ຄວາມຄິດສ້າງສັນ. ເຈົ້າສາມາດເຮັດໃຫ້ AI ທີ່ \"ປອດໄພ\"\nລະເມີດກົດຂອງມັນເອງໄດ້ບໍ່?","ai4ctfWrapNoProg":"ບໍ່ຈຳເປັນຕ້ອງຂຽນໂປຣແກຣມ","ai4ctfWrapTypeCtf4ai":"ພິມ:","ai4ctfRevealTitle":"💡 AI tokens ໝົດແລ້ວ — ນີ້ຄືຄຳຕອບສະເລີຍ","ai4ctfRevealBody":"ເບິ່ງຄືວ່າເຈົ້າຍັງບໍ່ພົບ flag ເທື່ອ.\nບໍ່ຕ້ອງເປັນຫ່ວງ — ສຳລັບເດໂມນີ້ພວກເຮົາຈະບອກເຈົ້າ.\n\nເປີດໃຊ້ຄຳສັ່ງນີ້ເພື່ອຖອດລະຫັດ Base64:","ai4ctfRevealSeeFlag":"ເຈົ້າຈະເຫັນ flag:","ai4ctfRevealThenSubmit":"ແລ້ວ submit ມັນ:","ai4ctfRevealLockNote":"(ແຊັດ AI ຖືກລັອກແລ້ວ — ຕອນນີ້ໃຊ້ໄດ້ສະເພາະ shell commands ແລະ submit.)","ai4ctfLockedTitle":"ແຊັດ AI ຖືກລັອກແລ້ວ — tokens ໝົດ.","ai4ctfLockedUse":"ໃຊ້:","ai4ctfLockedThen":"ແລ້ວ:"};
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function registerHintCommands(program: Command): void;
@@ -1 +0,0 @@
1
- import chalk from"chalk";import{generateHint as e}from"../lib/gemini.js";import{checkBudget as n,deductBudget as i,getBudgetDisplay as o,isTokenCapReached as t}from"../lib/budget.js";import{getConfig as a}from"../lib/config.js";import{logHint as s}from"../lib/logger.js";import{printError as l,printMarkdown as r,printHeader as c,createSpinner as g}from"../lib/ui.js";async function m(o,m){const u=a();if(t())return void l("Token cap reached. No more AI hints available.");const{allowed:d,remaining:h}=n(o);if(!d)return void l(`Level ${o} hint budget exhausted (0 remaining).`);"C"===o&&console.log(chalk.red.bold(` Warning: Using 1 of ${h} Critical Assists remaining.`)),s(o,m,u.currentChallengeId||void 0);const y=function(){const e=a();if(e.currentChallengeName&&e.currentChallengeCategory)return{name:e.currentChallengeName,category:e.currentChallengeCategory}}(),f={A:"General Guidance",B:"Deep Analysis",C:"Critical Assist"},C=g(`Getting Level ${o} hint (${f[o]})...`);C.start();try{const t=await e(o,m,y);C.stop(),i(o,t.tokensUsed),c(`Level ${o} Hint — ${f[o]}`),r(t.text);const a=n(o);if(console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.gray(` Tokens used: ${t.tokensUsed} | Level ${o} remaining: ${a.remaining}`)),"A"===o){const e=n("B");console.log(chalk.gray(" Need more detail? ")+chalk.white('hint-b "your question"')+chalk.gray(` (${e.remaining} left)`))}else if("B"===o){const e=n("C");e.remaining>0&&console.log(chalk.gray(" Still stuck? ")+chalk.white('hint-c "your question"')+chalk.gray(` (${e.remaining} Critical Assists left)`))}console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log()}catch(e){C.fail("Hint generation failed"),l(e.message)}}function u(){c("Hint Budget"),console.log(o()),console.log(),console.log(chalk.gray(" How to use hints:")),console.log(chalk.white(' hint "what is XSS?"')+chalk.gray(" Level A — General guidance")),console.log(chalk.white(' hint-b "analyze this code"')+chalk.gray(" Level B — Deep analysis")),console.log(chalk.white(' hint-c "I\'m completely stuck"')+chalk.gray(" Level C — Critical assist")),console.log()}export function registerHintCommands(e){e.command("hint <question...>").description('Level A hint — General guidance (use "hint budget" to check remaining)').action(async e=>{"budget"!==e[0]?await m("A",e.join(" ")):u()}),e.command("hint-b <question...>").description("Level B hint — Deep analysis").action(async e=>{await m("B",e.join(" "))}),e.command("hint-c <question...>").description("Level C hint — Critical assist (confirmation required)").action(async e=>{await m("C",e.join(" "))}),e.command("hint-budget").description("Show remaining hint budget").action(()=>{u()})}