This repository was archived by the owner on Dec 17, 2025. It is now read-only.
forked from CTFd/ctfcli
-
Notifications
You must be signed in to change notification settings - Fork 0
update #3
Open
lakomyt
wants to merge
54
commits into
PWrWhiteHats:update-to-python3.11
Choose a base branch
from
CTFd:master
base: update-to-python3.11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
update #3
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bumps [certifi](https://github.com/certifi/python-certifi) from 2022.9.24 to 2022.12.7. - [Release notes](https://github.com/certifi/python-certifi/releases) - [Commits](certifi/python-certifi@2022.09.24...2022.12.07) --- updated-dependencies: - dependency-name: certifi dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Replace flake8 with ruff
* Add cloud deploy for hosted CTFd instances * Further define what other deployment methods should provide & return
* Add configurable cookies via config file --------- Co-authored-by: Kevin Chung <kchung@nyu.edu>
# 0.0.12 / 2023-06-25 ### Added - Add cloud deploy for hosted CTFd instances - Add the `protocol` field in the challenge.yml spec - Further define what other deployment methods should provide & return - Add the ability to add HTTP cookies to ctfcli requests via the config file ### Fixed - Allow ignoring category during challenge sync
1. Add env variable `CTFCLI_PLUGIN_DIR` to override default plugin dir - useful for development of plugins. 2. Change plugin load print to a debug log so it's not displayed with every invocation of ctfcli 3. Move plugin loading logic from __main__ file to utils/plugins
This adds `--directory` argument to `ctfcli add` - useful for grouping challenges into separate directories like: `web/challenge1`.
* Bump PyYAML version to 6.0.1 * Closes #124
* feat: allow provided `connection_info` in `deploy` * Add some logging information to show that we will use hardcoded connection_info * Fixes #120 --------- Co-authored-by: Kevin Chung <kchung@ctfd.io>
# 0.0.13 / 2023-07-29 ### Added - Add env variable `CTFCLI_PLUGIN_DIR` to override the default plugin dir for development. - Add `--directory` argument to `ctfcli challenge add` - Can also be called as `ctf challenge add git@github.com:repo.git directory` - Useful for grouping challenges into separate directories like: `web/challenge1`. - `connection_info` specified in challenge.yml will be used instead of details generated by a deploy handler ### Fixed - Bump PyYAML version to 6.0.1
* Refactor ctfcli structure * Switch to poetry --------- Co-authored-by: Kevin Chung <kchung@ctfd.io>
# 0.1.0 / 2023-10-03 ### Added - ctfcli has been separated into two main modules `cli` and `core`. The `core` module now packages logic previously found inside `utils`, wrapped into classes. - The classes in the `core` module will only print out warnings instead of interrupting the whole process. Everything else will throw exceptions which can be caught and handled however desired - `cli` and `core` internal modules have type hints - Improved error messages - Unit tests have been added for the entire `core` module - ctfcli will now ask to initialize a new project if one does not exist - Added `--hidden` to `ctf challenge install` which will deploy the challenge / challenges in a hidden state regardless of their `challenge.yml` value. - Added `ctf challenge edit <name>` and `ctf challenge edit <name> --dockerfile` to open challenge.yml or Dockerfile for that challenge - Added aliases under `ctf templates` and `ctf plugins` for `dir` (`path`) and for `view` (`show`) - Progress bars for `ctf challenge deploy` / `ctf challenge install` / `ctf challenge sync` - `ctf challenge deploy` will now deploy ALL deployable challenges if a specific challenge is not specified - For the SSH and Registry deployments, to facilitate this behaviour the challenge name will be automatically appended. So the host should be for example: `registry://registry.example.com/example-project` and the challenge name will be appended for a full location. - `ctf challenge deploy` will now also automatically login to the registry with Cloud and Registry deployments. - For cloud deployments the instance url must be ctfd assigned (e.g. example.ctfd.io) - this is because to log-in to the registry we require a username like `admin@example.ctfd.io`. The deployment will use the access token as the password. - For registry deployment it will look for the `username` and `password` keys inside a `[registry]` section in the project config file. - ctfcli will read a `LOGLEVEL` environment variable to enable DEBUG logging has been added ### Fixed - When syncing a challenge to a remote instance, state specified in challenge.yml will now be ignored to prevent accidental challenge leaking - The CLI will now exit with a 0 if everything went right, and 1 if something went wrong. - With `install`/`sync`/`deploy` - exit code will be 1 if ANY of the challenges failed to `install`/`sync`/`deploy`. ### Changed - Built using poetry and `pyproject.toml` - `python-fire` has been updated to 0.5.0 ### Removed - Removed the `ctf challenge finalize` command
Adds `ctf challenge mirror <challenge>` and `ctf challenge verify <challenge>` adapted from #106 Originally, this functionality was called `pull` and `verify` - however, `push` is already used to push challenge changes to the git repository. I think `mirror` is a better name, as ctfcli will attempt to mirror / copy the remote state from ctfd. This way `pull` stays in its current git-like form, for git-related operations. More additions: - I've removed update / create / verify files - this can be achieved by just using --ignore=files. - I've added `files_directory_name` (defaulting to `dist`) to specify where ctfcli should download the files, relative to challenge.yml - I've added a warning when there are additional challenges on the remote, that are not registered locally - `ctf challenge verify` will exit with status code 2 if the verification was successful, but some challenges are out of sync. - I've fixed some typos Thanks to @reteps for the initial contribution! Closes: #101 #106
- extract challenge resolving code from each command to a reusable method - stop relying on config whenever it's not necessary (challenge new, format, lint) - improve variable naming (explicit `challenge_instance` instead of shadowing the `challenge` kwarg) - fix some typos Closes #135
* do not expose helper methods as commands * additional fix for plugin loading
#139) * Have poetry run a preprocess script which replaces the challenge.yml symlinks with the actual file contents
# 0.1.1 / 2023-12-11 ### Added - Added `ctf challenge mirror` command to pull changes from the remote CTFd instance into the local project ### Fixed - Properly include challenge.yml when generating a challenge from a template ### Changed - No longer require a ctfcli project to run all `ctf challenge` (e.g. `new`, `format`, `lint`)
* use sha1sum to compare files when syncing and verifying * `load_installed_challenge` should throw an exception when it fails to load the challenge. This has been always assumed and there are checks before that call, but there's just no reason for it to return None instead of throwing.
* support remote images in challenge deployment * add registry:// prefix to mark images as remote
Co-authored-by: Miłosz Skaza <milosz.skaza@ctfd.io>
# 0.1.3 / 2024-08-20
### Added
- Added support for `git subrepo` instead of only `git subtree`
- Added the `--create` switch to `ctf challenge mirror` to create local copies of challenges that exist on a remote CTFd instance
### Fixed
- `ctf challenge {push, pull}` will now push / pull all challenges instead of the challenge in the current working directory.
### Changed
- Use `--load` switch as part of docker build to support alternate build drivers
* Add instance command with config subcommand * Use logging * Add instance folder * Fix typing
…RLs in Pages (#156) * Add `ctf media add`, `ctf media rm`, `ctf media url` commands * Allows ctfcli repos to manage files locally and reference the actual server URLs of media files in Pages * Adds concept of replacing placeholders like `{{ media/ctfd.png }}` with the actual URL on the server
* Handle challenge attribution and its related tests * Update upload-artifact to v3 --------- Co-authored-by: Kevin Chung <kchung@ctfd.io>
* Fix issue with managing challenges with an empty files section --------- Signed-off-by: AlexNg <contact@ngjx.org>
* feat: allow specifying access_token as an env var * Allow specifying URL via envvar update token envvar name * Show error if instance URL not configured * update upload-artifact version --------- Co-authored-by: Kevin Chung <kchung@ctfd.io>
* Bump Python Fire version * Add Python 3.13 to test matrix * Closes #174
…#181) * Add slugify to dependencies and add slugify to cloud image deployment * Fix lints
* Added next_id support * Some improvements - Added support for anonymize flag in requirements - Added data in flags with static type in challenge-example.yml to avoid verify command fails - Added sort for requirements because it seems CTFd does not accept prerequisites if they are not sorted. - Applied black to challenge.py to avoid Linting error. * Updated to pass tests * deleted debug print * Applied black again * Fixed ruff check errors * Changed next_id to next * Ommit require_anonymize and support anonymize in requirements * Changed back to mistakenly edit lines --------- Co-authored-by: Kevin Chung <kchung@ctfd.io>
# 0.1.4 / 2025-04-29
### Added
- Added support for `ctf instance` with the `ctf instance config` command which can be used to `get` and `set` configuration on CTFd
- Added `ctf media add`, `ctf media rm`, `ctf media url`
- Allows ctfcli repos to manage files locally and reference the actual server URLs of media files in Pages
- Adds concept of replacing placeholders like `{{ media/ctfd.png }}` with the actual URL on the server
- Added the `attribution` field to challenge.yml
- Added the `next` field to challenge.yml
- Added ability to anoymize challenges while specifying prerequisites
- Added specifying CTFd instance URL and access token via envvars: `CTFCLI_URL`, `CTFCLI_ACCESS_TOKEN`
### Fixed
- Fix issue with managing challenges with an empty files section
- Fix issue where images could not be deployed due to being named incorrectly
* Add support for hint titles released in CTFd 3.7.7
* Fix issue with resolving relative challenge paths during install * Fix lint
* Add `logic` support and add `logic` key to challenge specification * Fix minor issue in attribution field * Show server response when challenges fail to sync or install
# 0.1.5 / 2025-09-04 ### Added - Support for hint titles - Support `logic` key for challenges ### Fixed - Fix issue with resolving relative challenge paths during install
* Challenges without an image key will not be considered as a failed deploy and will be considered a skipped deploy
* Can't compare relative paths to absolute paths * Use full challenge_file_path * Fix lint --------- Co-authored-by: Kevin Chung <kchung@ctfd.io>
* always populate connection info * Add connection_info update message * Update ctfcli/cli/challenges.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Kevin Chung <kchung@ctfd.io> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* use uv and ruff instead of poetry * address new linter and formatter config * add python 3.14 to the test matrix * bump pytest and fix tests
* Add: checksum ignore * Fix lint
# 0.1.6 / 2026-01-06 ### Added - Add `sha1sum` to `--ignore` as part of `ctf challenge sync` to allow syncing files when the remote checksum or local checksum is corrupted ### Fixed - Fix an issue where if deployment returned updated connection info we wouldn't update it in challenge.yml - Fix an issue where relative paths would not deploy due to a logging error ### Changed - Challenges without an image will be considered a skipped deploy instead of a failed deploy - Switch from poetry to uv - Switch from to ruff
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.