ctfd-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CTFd CLI

CTFd CLI

Keep the shell in the directory that contains the target CTF's
.env
. Resolve this skill's directory to an absolute path and invoke its
scripts/ctfd.sh
; do not change into the skill directory. The wrapper invokes:
console
uvx --from git+https://github.com/p1atdev/ctfd-cli.git ctfd ...
Override the source when a branch, tag, commit, fork, or local checkout is required:
console
CTFD_CLI_SOURCE='git+https://github.com/p1atdev/ctfd-cli.git@main' /path/to/skill/scripts/ctfd.sh --help
CTFD_CLI_SOURCE='/path/to/ctfd-cli' /path/to/skill/scripts/ctfd.sh --help
请保持Shell处于包含目标CTF的
.env
文件的目录中。将此skill的目录解析为绝对路径并调用其
scripts/ctfd.sh
;不要切换到该skill目录。该包装器会调用:
console
uvx --from git+https://github.com/p1atdev/ctfd-cli.git ctfd ...
当需要指定分支、标签、提交记录、复刻仓库或本地检出版本时,可覆盖源地址:
console
CTFD_CLI_SOURCE='git+https://github.com/p1atdev/ctfd-cli.git@main' /path/to/skill/scripts/ctfd.sh --help
CTFD_CLI_SOURCE='/path/to/ctfd-cli' /path/to/skill/scripts/ctfd.sh --help

Configure Access

配置访问权限

Set
CTFD_URL
,
CTFD_TOKEN
, and optionally
CTFD_TIMEOUT
in the environment or in the current directory's
.env
.
Do not print, log, or pass
CTFD_TOKEN
on the command line. Prefer environment or
.env
configuration so the token does not appear in process listings or shell history.
在环境变量或当前目录的
.env
文件中设置
CTFD_URL
CTFD_TOKEN
,可选设置
CTFD_TIMEOUT
请勿在命令行中打印、记录或传递
CTFD_TOKEN
。优先使用环境变量或
.env
文件进行配置,以免令牌出现在进程列表或Shell历史记录中。

Run Commands

运行命令

Use
--short
before the command for concise, agent-readable output:
console
/path/to/skill/scripts/ctfd.sh --short challenges list
/path/to/skill/scripts/ctfd.sh --short challenges show 12
/path/to/skill/scripts/ctfd.sh --short scoreboard
/path/to/skill/scripts/ctfd.sh --short me
/path/to/skill/scripts/ctfd.sh --short me solves
/path/to/skill/scripts/ctfd.sh --short me submissions --challenge-id 12
Use
--json
instead of
--short
when structured output is required:
console
/path/to/skill/scripts/ctfd.sh challenges list --json
/path/to/skill/scripts/ctfd.sh challenges show 12 --json
/path/to/skill/scripts/ctfd.sh me submissions --json
Forward filters and global connection overrides directly to the CLI. Keep global options such as
--url
,
--timeout
, and
--short
before the subcommand.
在命令前使用
--short
参数以获取简洁、适合Agent读取的输出:
console
/path/to/skill/scripts/ctfd.sh --short challenges list
/path/to/skill/scripts/ctfd.sh --short challenges show 12
/path/to/skill/scripts/ctfd.sh --short scoreboard
/path/to/skill/scripts/ctfd.sh --short me
/path/to/skill/scripts/ctfd.sh --short me solves
/path/to/skill/scripts/ctfd.sh --short me submissions --challenge-id 12
当需要结构化输出时,使用
--json
替代
--short
console
/path/to/skill/scripts/ctfd.sh challenges list --json
/path/to/skill/scripts/ctfd.sh challenges show 12 --json
/path/to/skill/scripts/ctfd.sh me submissions --json
直接将过滤器和全局连接覆盖参数传递给CLI。请将
--url
--timeout
--short
等全局选项放在子命令之前。

Mutating Operations

变更操作

Submit a flag only when the user intends that exact value to be submitted:
console
/path/to/skill/scripts/ctfd.sh --short challenges submit 12 'flag{example}'
Unlock a paid hint only after explicit user confirmation because it can spend CTF points:
console
/path/to/skill/scripts/ctfd.sh --short challenges unlock-hint 4
Do not retry incorrect submissions automatically.
仅当用户明确要提交特定值时,才提交flag:
console
/path/to/skill/scripts/ctfd.sh --short challenges submit 12 'flag{example}'
解锁付费提示前必须获得用户明确确认,因为这会消耗CTF积分:
console
/path/to/skill/scripts/ctfd.sh --short challenges unlock-hint 4
请勿自动重试提交错误的内容。

Handle Results

处理结果

Interpret exit codes as follows:
  • 0
    : success, including a correct or already-solved submission
  • 1
    : operation-level failure, such as an incorrect submission
  • 3
    : missing or invalid configuration
  • 4
    : authentication or permission failure
  • 5
    : network failure
  • 6
    : CTFd API response failure
Preserve stdout and stderr when reporting failures, but redact credentials if an unexpected upstream message contains them.
按以下规则解释退出码:
  • 0
    :成功,包括提交正确或已解决的题目
  • 1
    :操作级失败,例如提交错误
  • 3
    :配置缺失或无效
  • 4
    :认证或权限失败
  • 5
    :网络失败
  • 6
    :CTFd API响应失败
报告失败时保留标准输出和标准错误,但如果意外的上游消息包含凭据,请对其进行脱敏处理。