Skip to content

Commit

Permalink
[wip] add sqlite example
Browse files Browse the repository at this point in the history
  • Loading branch information
zsarge committed Jan 19, 2024
1 parent 234dac2 commit 02fcd85
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
70 changes: 70 additions & 0 deletions challenges/sql/select/challenge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This file represents the base specification of your challenge. It is used by
# other tools to install and deploy your challenge.

# Required sections
name: "SELECT"
author: "Zack Sargent"
category: SQL
description: |
TODO - figure this out
# prompt is inserted into the editor
prompt: |
-- This is a test
# This is SQL
# 💡 Notice how the same operation (+) is treated
# differently on variables of different types.
# user code is inserted into template to replace USER_CODE
# template: |
# USER_CODE
# print("===== MAGIC DEBUGGER OUTPUT =====")
# for variable_name in ('a', 'b', 'c', 'd'):
# try:
# i = eval(variable_name)
# print(f"{variable_name} equals {repr(i)} and has type {type(i).__name__}")
# except NameError:
# print(f"variable '{variable_name}' is not defined.")
# print("===== MAGIC DEBUGGER OUTPUT =====")
value: 10
type: standard

# Flags specify answers that your challenge use. You should generally provide at least one.
# Can be removed if unused
# Accepts strings or dictionaries of CTFd API data
flags:
# A static case sensitive flag
- cybersword{select_one_and_all}

# Topics are used to help tell what techniques/information a challenge involves
# They are generally only visible to admins
# Accepts strings
topics:
- SQL

# Hints are used to give players a way to buy or have suggestions. They are not
# required but can be nice.
# Can be removed if unused
# Accepts dictionaries or strings
hints:
- "Press tab to indent code."
- "You can also use Ctrl + `]` to indent and Ctrl + `[` to un-indent."

# Requirements are used to make a challenge require another challenge to be
# solved before being available.
# Can be removed if unused
# Accepts challenge names as strings or challenge IDs as integers
requirements:
- "Welcome"
- "Hello, World!" # Hello, World! is id=0, so it has the nice introduction.

# The state of the challenge.
# If the field is omitted, the challenge is visible by default.
# If provided, the field can take one of two values: hidden, visible.
state: visible

# Specifies what version of the challenge specification was used.
# Subject to change until ctfcli v1.0.0
version: "0.1"
Binary file added challenges/sql/select/db.sqlite
Binary file not shown.
3 changes: 3 additions & 0 deletions services/judge0-ide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ It has been modified to:
When starting this server for development, do so in this directory.

The editor must be mounted at `/ide/index.html`

If you're running this with `docker compose`, and you modify `challenges.yml`, you must reload everything for your changes to take effect. This is because challenges.yml is run once at program start, and the results are cached for subsequent uses. More intelligent caching would resolve this, but `docker compose down && docker compose up --build` should do the trick.

9 changes: 8 additions & 1 deletion services/judge0-wrapper/challenges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,11 @@ challenges:
template_path: "challenges/python/fizzbuzz/challenge.yml"
challenge_id: 50
language_id: 71 # Python, according to Judge0's id system
answer_path: "challenges/python/fizzbuzz/answer.yml"
answer_path: "challenges/python/fizzbuzz/answer.yml"

- flag_path: "challenges/sql/select/challenge.yml"
prompt_path: "challenges/sql/select/challenge.yml"
input_path: "challenges/sql/select/db.sqlite"
challenge_id: 100
language_id: 82 # Python, according to Judge0's id system
answer_path: "challenges/python/fizzbuzz/answer.yml"

0 comments on commit 02fcd85

Please sign in to comment.