Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
sudo apt-get update

- name: Git LFS Pull for deployment
run: |
run: |
echo "Pulling all Git LFS"
git lfs pull -I **/challenges/**/ansible/**/*

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ challenges/*/terraform/versions.tf

.vscode/
.idea
stats.html
stats.html
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: local
hooks:
- id: format
name: Format
entry: ruff format
language: python
pass_filenames: false
additional_dependencies: [ruff]
- id: fix-imports
name: Fix imports
entry: ruff check --fix --show-fixes
language: python
pass_filenames: false
additional_dependencies: [ruff]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tree until it finds `challenges/` and `.deploy` directories, which is the root o
```raw
my-ctf/
├── challenges/ # Directory containing all the tracks
│ ├── track1/ # Directory for a specific track that contains N flags.
│ ├── track1/ # Directory for a specific track that contains N flags.
│ │ ├── track.yaml # Main file that describes the track
│ │ ├── files/ # Directory that contains all the files available for download in the track
│ │ │ ├── somefile.zip
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php echo 'Hello world!'; ?>
<!-- {{ track_flags.mock_track_apache_php_flag_1 }} -->
<!-- {{ track_flags.mock_track_apache_php_flag_1 }} -->
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ api:
user: nsec
title: "Mock Track Apache PHP"
body: |-
Mock Track Apache PHP body.
Mock Track Apache PHP body.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ api:
user: nsec
title: "Mock Track Apache PHP body."
body: |-
Mock Track Apache PHP body.
Mock Track Apache PHP body.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ api:
user: nsec
title: "Mock Track Files Only"
body: |-
Mock Track Files Only body
Mock Track Files Only body
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ api:
user: nsec
title: "Mock Track Files Only"
body: |-
Mock Track Files Only body
Mock Track Files Only body
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ api:
user: nsec
title: "Mock Track Python Service"
body: |-
Mock Track Python Service body
Mock Track Python Service body
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ api:
user: nsec
title: "Mock Track Python Service"
body: |-
Mock Track Python Service body
Mock Track Python Service body
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ api:
user: nsec
title: "Mock Track Python Service"
body: |-
Mock Track Python Service body
Mock Track Python Service body
2 changes: 1 addition & 1 deletion challenges/mock-track-python-service/track.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ services:
instance: mock-track-python-service
address: '9000:d37e:c40b:b29a:216:3eff:fe09:23ea'
port: 5000
check: http
check: http
2 changes: 1 addition & 1 deletion ctf/templates/init/.deploy/common/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ resource "incus_network_zone" "this" {

output "ctf_dns_network_zone" {
value = incus_network_zone.this.name
}
}
2 changes: 1 addition & 1 deletion ctf/templates/init/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"--volume", "/dev:/dev",
"--volume", "/lib/modules:/lib/modules:ro"
]
}
}
2 changes: 1 addition & 1 deletion ctf/templates/init/.vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"github.codespaces",
"redhat.ansible"
]
}
}
2 changes: 1 addition & 1 deletion ctf/templates/init/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"schemas/track.yaml.json": "challenges/*/track.yaml",
"schemas/post.json": "challenges/*/posts/*.yaml"
}
}
}
2 changes: 1 addition & 1 deletion ctf/templates/init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,4 @@ flags:
ui_gif: my-awesome-gif.gif
```

2. If you are choosing to use a custom sound and not defaults ones in the `ctf` track folder, you must add them in `challenges/my-awesome-track/files/askgod/(sounds|gifs)/`. Example: `challenges/my-awesome-track/files/askgod/sounds/my-awesome-sound.mp3`.
2. If you are choosing to use a custom sound and not defaults ones in the `ctf` track folder, you must add them in `challenges/my-awesome-track/files/askgod/(sounds|gifs)/`. Example: `challenges/my-awesome-track/files/askgod/sounds/my-awesome-sound.mp3`.
2 changes: 1 addition & 1 deletion ctf/templates/init/schemas/post.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion ctf/templates/init/setup-codespace
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ sudo zfs set sync=disabled default
echo "==> Installing ctf tool"
pip install -e .

echo "==> You're all done, you can now run \"ctf deploy\""
echo "==> You're all done, you can now run \"ctf deploy\""
2 changes: 1 addition & 1 deletion ctf/templates/new/common/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ TODO CHANGE_ME: This track incorporates as the control center of a satelite movi

### Flag 1

TODO CHANGE_ME: This is a walkthrough of how to get the first flag.
TODO CHANGE_ME: This is a walkthrough of how to get the first flag.
2 changes: 1 addition & 1 deletion ctf/templates/new/common/inventory.j2
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ windows:
vars:
# This variable is used to tell Ansible that the hosts are Windows hosts and require a PowerShell shell.
ansible_shell_type: powershell
{% endif %}
{% endif %}
2 changes: 1 addition & 1 deletion ctf/templates/new/windows-vm/deploy.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
value: "{{ '{{ item.flag }}' }}"
ansible.builtin.set_fact:
track_flags: "{{ '{{ track_flags | default({}) | combine({key: value}) }}' }}"

- name: "Running free form: directly with the executable (PowerShell)"
ansible.builtin.raw: |
powershell -c $systeminfo = Get-ComputerInfo
Expand Down
2 changes: 1 addition & 1 deletion ctf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def create_terraform_modules_file(remote: str, production: bool = False):
{% if production %}deploy = "production"{% endif %}
{% if remote %}incus_remote = "{{ remote }}"{% endif %}
}

"""
)
)
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ classifiers = [
]

[project.optional-dependencies]
workflow = ["pybadges", "matplotlib", "standard-imghdr ; python_version >= \"3.13\""]
dev = ["pre-commit", "ruff"]
workflow = [
"pybadges",
"matplotlib",
"standard-imghdr ; python_version >= \"3.13\"",
"ctf-script[dev]"
]

[project.scripts]
ctf = "ctf.__main__:main"
Expand Down
Loading