icoa-cli 2.19.564 → 2.19.565
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/lib/tls-trust.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"node:tls";import chalk from"chalk";const e=new Set(["UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","SELF_SIGNED_CERT_IN_CHAIN","DEPTH_ZERO_SELF_SIGNED_CERT","CERT_UNTRUSTED","CERT_CHAIN_TOO_LONG","CERT_SIGNATURE_FAILURE"]);export function transportCauseCode(t){let e=t;for(let t=0;t<5&&e;t++){const t=e.code;if("string"==typeof t&&t)return t;e=e.cause}return""}export function isCertTrustError(t){return e.has(transportCauseCode(t))}let o=!1;export function systemTrustActive(){return o}export function enableSystemTrust(){if(o)return!1;const e=t.getCACertificates,r=t.setDefaultCACertificates;if("function"!=typeof e||"function"!=typeof r)return!1;let n
|
|
1
|
+
import t from"node:tls";import chalk from"chalk";const e=new Set(["UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","SELF_SIGNED_CERT_IN_CHAIN","DEPTH_ZERO_SELF_SIGNED_CERT","CERT_UNTRUSTED","CERT_CHAIN_TOO_LONG","CERT_SIGNATURE_FAILURE"]);export function transportCauseCode(t){let e=t;for(let t=0;t<5&&e;t++){const t=e.code;if("string"==typeof t&&t)return t;e=e.cause}return""}export function isCertTrustError(t){return e.has(transportCauseCode(t))}let o=!1;export function systemTrustActive(){return o}export function enableSystemTrust(){if(o)return!1;const e=t.getCACertificates,r=t.setDefaultCACertificates;if("function"!=typeof e||"function"!=typeof r)return!1;let s,n;try{s=e("system"),n=e("default")}catch{return!1}if(!Array.isArray(s)||0===s.length)return!1;try{r([...new Set([...n,...s])])}catch{return!1}return o=!0,console.log(),console.log(chalk.yellow(" ⚠ This network inspects HTTPS traffic (school / library / office firewall).")),console.log(chalk.gray(" Continuing with the certificates your operating system already trusts.")),console.log(chalk.gray(" 这个网络对 HTTPS 做了拦截,已改用系统证书库继续 —— 属正常现象,可以照常上课。")),console.log(),!0}export function transportAdvice(t){const o=transportCauseCode(t);if(e.has(o))return["This network re-signs HTTPS traffic and Node does not trust its certificate.","Fix: run NODE_OPTIONS=--use-system-ca icoa (needs Node 22.15+ — check with: node -v)","Or ask the network admin to exempt practice.icoa2026.au from SSL inspection."];if("CERT_HAS_EXPIRED"===o||"CERT_NOT_YET_VALID"===o)return["This computer's clock is wrong, so every HTTPS certificate looks invalid.","Fix: correct the system date/time, then try again."];if("ERR_TLS_CERT_ALTNAME_INVALID"===o)return["Something on this network is answering for practice.icoa2026.au with the wrong certificate.","Fix: try a phone hotspot, or ask the network admin about the web filter."];if("ENOTFOUND"===o||"EAI_AGAIN"===o)return["This network cannot look up practice.icoa2026.au (DNS is blocked or broken).","Fix: set DNS to 1.1.1.1 or 8.8.8.8, or use a phone hotspot."];if("ECONNREFUSED"===o||"ECONNRESET"===o||"ENETUNREACH"===o||o.includes("CONNECT_TIMEOUT"))return["The connection to practice.icoa2026.au was blocked before it reached us.","If your browser CAN open https://practice.icoa2026.au this network only allows browser traffic (a proxy).","Fix: ask the admin to allow practice.icoa2026.au on TCP 443, or use a phone hotspot."];if("ETIMEDOUT"===o||/timeout/i.test(o)||function(t,e){let o=t;for(let t=0;t<5&&o;t++){const t=o.message;if("string"==typeof t&&e.test(t))return!0;o=o.cause}return!1}(t,/timed? ?out/i)){const t=["Nothing answered — this network cannot reach practice.icoa2026.au at all.","A VPN or proxy app on this computer is the usual cause: quit it fully, then retry.","Then try a phone hotspot — if that works, this WiFi blocks the route (tell your coach)."];return(process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy)&&t.unshift("This shell is set to use a web proxy (HTTPS_PROXY) which icoa cannot use — browsers can, so they still work."),t}return[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "icoa-cli",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.565",
|
|
4
4
|
"description": "ICOA CLI — AI-native competition runtime of the International Cyber Olympiad in AI: learn, practise, and compete in AI & cybersecurity from the terminal (AI4CTF · CTF4AI · CTF4EAI)",
|
|
5
5
|
"author": "Charlie Zhu",
|
|
6
6
|
"type": "module",
|