You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add challenge mirror, verify, format functionality (#134)
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
Copy file name to clipboardExpand all lines: README.md
+89-17Lines changed: 89 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,48 +20,55 @@ Alternatively, you can always install it with `pip` as a python module:
20
20
21
21
## 1. Create an Event
22
22
23
-
ctfcli turns the current folder into a CTF event git repo. It asks for the base url of the CTFd instance you're working with and an access token.
23
+
Ctfcli turns the current folder into a CTF event git repo.
24
+
It asks for the base url of the CTFd instance you're working with and an access token.
24
25
25
26
```
26
27
❯ ctf init
27
28
Please enter CTFd instance URL: https://demo.ctfd.io
28
29
Please enter CTFd Admin Access Token: d41d8cd98f00b204e9800998ecf8427e
29
-
Do you want to continue with https://demo.ctfd.io and d41d8cd98f00b204e9800998ecf8427e [y/N]: y
30
+
Do you want to continue with https://demo.ctfd.io and d41d8cd98f00b204e9800998ecf8427e [Y/n]: y
30
31
Initialized empty Git repository in /Users/user/Downloads/event/.git/
31
32
```
32
33
33
-
This will create the `.ctf` folder with the `config` file that will specify the URL, access token, and keep a record of all the challenges dedicated for this event.
34
+
This will create the `.ctf` folder with the `config` file that will specify the URL, access token, and keep a record of
35
+
all the challenges dedicated for this event.
34
36
35
37
## 2. Add challenges
36
38
37
-
Events are made up of challenges. Challenges can be made from a subdirectory or pulled from another repository. Remote challenges are pulled into the event repo and a reference is kept in the `.ctf/config` file.
39
+
Events are made up of challenges.
40
+
Challenges can be made from a subdirectory or pulled from another repository.
41
+
GIT-enabled challenges are pulled into the event repo, and a reference is kept in the `.ctf/config` file.
Syncing a challenge will automatically update the challenge in your CTFd instance using the API. Any changes made in the `challenge.yml` file will be reflected in your instance.
84
+
Syncing a challenge will update the challenge in your CTFd instance using the API.
85
+
Any changes made in the `challenge.yml` file will be reflected in your instance.
78
86
79
87
```
80
-
❯ ctf challenge sync [challenge.yml | DIRECTORY]
88
+
❯ ctf challenge sync [challenge]
81
89
```
82
90
83
91
```
@@ -88,6 +96,70 @@ Syncing buffer_overflow
88
96
Success!
89
97
```
90
98
99
+
## 5. Deploy services
100
+
101
+
Deploying a challenge will automatically create the challenge service (by default in your CTFd instance).
102
+
You can also use a different deployment handler to deploy the service via SSH to your own server,
103
+
or a separate docker registry.
104
+
105
+
The challenge will also be automatically installed or synced.
106
+
Obtained connection info will be added to your `challenge.yml` file.
107
+
```
108
+
❯ ctf challenge deploy [challenge]
109
+
```
110
+
111
+
```
112
+
❯ ctf challenge deploy web-1
113
+
Deploying challenge service 'web-1' (web-1/challenge.yml) with CloudDeploymentHandler ...
114
+
Challenge service deployed at: https://web-1-example-instance.chals.io
115
+
Updating challenge 'web-1'
116
+
Success!
117
+
```
118
+
119
+
## 6. Verify challenges
120
+
121
+
Verifying a challenge will check if the local version of the challenge is the same as one installed in your CTFd instance.
You can perform operations on all challenges defined in your config by simply skipping the challenge parameter.
156
+
157
+
-`ctf challenge install`
158
+
-`ctf challenge sync`
159
+
-`ctf challenge deploy`
160
+
-`ctf challenge verify`
161
+
-`ctf challenge mirror`
162
+
91
163
# Challenge Templates
92
164
93
165
`ctfcli` contains pre-made challenge templates to make it faster to create CTF challenges with safe defaults.
@@ -126,6 +198,6 @@ The specification format has already been tested and used with CTFd in productio
126
198
127
199
# Plugins
128
200
129
-
`ctfcli` plugins are essentially additions to to the command line interface via dynamic class modifications. See the [plugin documentation page](docs/plugins.md) for a simple example.
201
+
`ctfcli` plugins are essentially additions to the command line interface via dynamic class modifications. See the [plugin documentation page](docs/plugins.md) for a simple example.
130
202
131
203
*`ctfcli` is an alpha project! The plugin interface is likely to change!*
0 commit comments