Skip to content

Commit

Permalink
Merge pull request #31 from jdabtieu/md
Browse files Browse the repository at this point in the history
Full Markdown support
  • Loading branch information
jdabtieu committed Dec 8, 2020
2 parents 268aab9 + b42f8c7 commit ce6add8
Show file tree
Hide file tree
Showing 15 changed files with 360 additions and 151 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Problem download files
# Problem files
/dl/
/metadata/

# Database
/database.db
Expand All @@ -13,4 +14,4 @@
/secret_key.txt

# Logs
/logs/*
/logs/
19 changes: 10 additions & 9 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ sqlite3>
CREATE TABLE 'users' ('id' integer PRIMARY KEY NOT NULL, 'username' varchar(20) NOT NULL, 'password' varchar(64) NOT NULL, 'email' varchar(128), 'join_date' datetime NOT NULL DEFAULT (0) , 'admin' boolean NOT NULL DEFAULT (0) , 'banned' boolean NOT NULL DEFAULT (0), 'verified' boolean NOT NULL DEFAULT (0));
CREATE TABLE 'submissions' ('sub_id' integer PRIMARY KEY NOT NULL, 'date' datetime NOT NULL,'user_id' integer NOT NULL,'problem_id' varchar(32) NOT NULL,'contest_id' varchar(32), 'correct' boolean NOT NULL);
CREATE TABLE 'problems_master' ('user_id' integer NOT NULL);
CREATE TABLE 'problems' ('id' varchar(64) NOT NULL, 'name' varchar(256) NOT NULL, 'description' varchar(16384), 'point_value' integer NOT NULL DEFAULT (0), 'category' varchar(64), 'flag' varchar(256) NOT NULL , 'editorial' text, 'hints' varchar(16384), 'draft' boolean NOT NULL DEFAULT(0));
CREATE TABLE 'contests' ('id' varchar(32) NOT NULL, 'name' varchar(256) NOT NULL, 'start' datetime NOT NULL, 'end' datetime NOT NULL, 'description' text, 'scoreboard_visible' boolean NOT NULL DEFAULT (1));
CREATE TABLE 'announcements' ('id' integer PRIMARY KEY NOT NULL, 'name' varchar(256) NOT NULL, 'date' datetime NOT NULL, 'description' varchar(16384) NOT NULL);
CREATE TABLE 'problems' ('id' varchar(64) NOT NULL, 'name' varchar(256) NOT NULL, 'point_value' integer NOT NULL DEFAULT (0), 'category' varchar(64), 'flag' varchar(256) NOT NULL, 'draft' boolean NOT NULL DEFAULT(0));
CREATE TABLE 'contests' ('id' varchar(32) NOT NULL, 'name' varchar(256) NOT NULL, 'start' datetime NOT NULL, 'end' datetime NOT NULL, 'scoreboard_visible' boolean NOT NULL DEFAULT (1));
CREATE TABLE 'announcements' ('id' integer PRIMARY KEY NOT NULL, 'name' varchar(256) NOT NULL, 'date' datetime NOT NULL);
INSERT INTO 'users' VALUES(1, 'admin', 'pbkdf2:sha256:150000$XoLKRd3I$2dbdacb6a37de2168298e419c6c54e768d242aee475aadf1fa9e6c30aa02997f', 'e', datetime('now'), 1, 0, 1);
INSERT INTO 'problems_master' ('user_id') VALUES(1);
```

3.
```bash
$ mkdir logs
$ mkdir logs dl metadata metadata/contests metadata/problems metadata/announcements
$ touch logs/application.log
$ python3 daily_tasks.py
$ cp default_settings.py settings.py
Expand All @@ -45,7 +45,7 @@ In settings.py, you should add your email credentials as indicated by default_se
$ export FLASK_APP=application.py
$ flask run
```
If you do not want to export the FLASK_APP every time you reset your terminal, you can put it in your .bashrc or create a symbolic link.
If you do not want to export the FLASK_APP every time you reset your terminal, you can create a symbolic link from app.py to application.py.

Do not expose the app to the web using debug mode. You should run the app through nginx, Apache, or a similar service.

Expand All @@ -56,8 +56,9 @@ You should also change the admin email to your email so that you can reset your
$ sqlite3 database.db
sqlite3> UPDATE 'users' SET email='YOUR EMAIL HERE' WHERE id=1;
```
Furthermore, when regular users log in for the first time, they will be directed to a helloworld problem. You should create a helloworld problem as a welcome/landing page. This problem must have an id of 'helloworld', without the single quotes. See below for an example helloworld problem:
```sql
$ sqlite3 database.db
sqlite3> INSERT INTO 'problems' VALUES('helloworld', 'Hello World', 'Welcome to CTF Club! In each problem, you must find a flag hidden somewhere on the problem page.', 1, 'general', 'CTF{your_first_ctf_flag}', 'The flag starts with CTF{', 'The flag ends with }', 0);
Furthermore, when regular users log in for the first time, they will be directed to a helloworld problem. You should create a helloworld problem as a welcome/landing page. This problem must have an id of 'helloworld', without the single quotes. You can do this on the 'Create Problem' page in the admin toolbar, once logged in. Markdown is supported. See below for an example helloworld problem:
```
Welcome to CTF Club! In each problem, you must find a flag hidden somewhere on the problem page.
The flag for this problem is: `CTF{your_first_ctf_flag}`
```
Loading

0 comments on commit ce6add8

Please sign in to comment.