From c77a1c2d1ff3fa4795b3025cdf229073e0c00f2f Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Fri, 30 Jul 2021 13:13:16 -0400 Subject: [PATCH] Add connection_info to Challenges model (#1965) * Closes #1964 * Adds connection_info to Challenges --- CTFd/models/__init__.py | 1 + CTFd/plugins/challenges/__init__.py | 1 + CTFd/plugins/dynamic_challenges/__init__.py | 1 + .../admin/templates/challenges/update.html | 12 ++++++++ CTFd/themes/core/templates/challenge.html | 12 ++++++++ ...dd_connection_info_column_to_challenges.py | 28 +++++++++++++++++++ 6 files changed, 55 insertions(+) create mode 100644 migrations/versions/6012fe8de495_add_connection_info_column_to_challenges.py diff --git a/CTFd/models/__init__.py b/CTFd/models/__init__.py index b49537b5a..398f64fd4 100644 --- a/CTFd/models/__init__.py +++ b/CTFd/models/__init__.py @@ -85,6 +85,7 @@ class Challenges(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(80)) description = db.Column(db.Text) + connection_info = db.Column(db.Text) max_attempts = db.Column(db.Integer, default=0) value = db.Column(db.Integer) category = db.Column(db.String(80)) diff --git a/CTFd/plugins/challenges/__init__.py b/CTFd/plugins/challenges/__init__.py index 8c7c4f2bc..110b2c821 100644 --- a/CTFd/plugins/challenges/__init__.py +++ b/CTFd/plugins/challenges/__init__.py @@ -53,6 +53,7 @@ def read(cls, challenge): "name": challenge.name, "value": challenge.value, "description": challenge.description, + "connection_info": challenge.connection_info, "category": challenge.category, "state": challenge.state, "max_attempts": challenge.max_attempts, diff --git a/CTFd/plugins/dynamic_challenges/__init__.py b/CTFd/plugins/dynamic_challenges/__init__.py index e5d511bcc..c9db56617 100644 --- a/CTFd/plugins/dynamic_challenges/__init__.py +++ b/CTFd/plugins/dynamic_challenges/__init__.py @@ -102,6 +102,7 @@ def read(cls, challenge): "decay": challenge.decay, "minimum": challenge.minimum, "description": challenge.description, + "connection_info": challenge.connection_info, "category": challenge.category, "state": challenge.state, "max_attempts": challenge.max_attempts, diff --git a/CTFd/themes/admin/templates/challenges/update.html b/CTFd/themes/admin/templates/challenges/update.html index a1fe4050e..f1de26653 100644 --- a/CTFd/themes/admin/templates/challenges/update.html +++ b/CTFd/themes/admin/templates/challenges/update.html @@ -34,6 +34,18 @@ {% endblock %} + {% block connection_info %} +
+ + +
+ {% endblock %} + {% block value %}