Skip to content

Commit 04bc42d

Browse files
committed
Import from jdabtieu/ctf-server
0 parents  commit 04bc42d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2724
-0
lines changed

.github/CODEOWNERS

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
* @jdabtieu
2+
3+
4+
LICENSE @ComputerGenius152
5+
/templates/terms.html @ComputerGenius152
6+
/templates/privacy.html @ComputerGenius152

.github/ISSUE_TEMPLATE/bug_report.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG]"
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
Please use this template only for reporting bugs. Bug reports not using this template may be denied.
11+
12+
## Describe the bug
13+
A clear and concise description of what the bug is.
14+
15+
## Expected Behavior
16+
A clear and concise description of what you expected to happen.
17+
18+
## Current Behavior
19+
A clear and concise description of what is happening.
20+
21+
## Possible Solution
22+
Not obligatory, but suggest a fix/reason for the bug.
23+
24+
## Steps to Reproduce
25+
Provide a link to a video showing off the bug or steps to trigger the bug.
26+
1.
27+
2.
28+
3.
29+
4.
30+
31+
## Context (Environment)
32+
What were you doing right before this bug happened that might have triggered it?
33+
Please also include your OS (including version), browser (including version), and device, if relevant.
34+
35+
## Additional Information
36+
Please put anything not already mentioned here, including screenshots.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: "[FEATURE]"
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
## Is your feature request related to a problem? Please describe.
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
## Describe the solution you'd like
14+
A clear and concise description of what you want to happen.
15+
16+
## Describe alternatives you've considered
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
## Additional context
20+
Add any other context or screenshots about the feature request here.

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Problem download files
2+
/dl/
3+
4+
# Database
5+
/database.db
6+
/backup.db
7+
8+
# Python Cache
9+
/__pycache__/
10+
11+
# Private config
12+
/email_config.txt
13+
/secret_key.txt

INSTALL.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Prerequisites: Python 3, SQLite 3
2+
3+
It is recommended to create a venv (virtual environment) first.
4+
5+
# First time setup
6+
The setup process involves 3 main steps:
7+
1. Install dependencies
8+
2. Create database
9+
3. Configure application
10+
11+
1.
12+
```
13+
$ pip install -r requirements.txt
14+
```
15+
16+
2.
17+
```
18+
$ touch database.db
19+
$ sqlite3 database.db
20+
sqlite3>
21+
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));
22+
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);
23+
CREATE TABLE 'problems_master' ('user_id' integer NOT NULL);
24+
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));
25+
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));
26+
CREATE TABLE 'announcements' ('id' integer PRIMARY KEY NOT NULL, 'name' varchar(256) NOT NULL, 'date' datetime NOT NULL, 'description' varchar(16384) NOT NULL);
27+
```
28+
29+
3.
30+
```
31+
$ echo 'YOUR EMAIL ADDRESS' > email_config.txt
32+
$ echo 'EMAIL PASSWORD' >> email_config.txt
33+
$ echo 'YOUR EMAIL NAME (eg. CTF Club)' >> email_config.txt
34+
$ python3 daily-tasks.py
35+
```
36+
37+
# Running
38+
```
39+
$ export FLASK_APP=application.py
40+
$ flask run
41+
```
42+
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.
43+
44+
45+
At this time, it is recommended to sign up for an account and then give it administrator access
46+
```
47+
$ sqlite3 database.db
48+
sqlite3> UPDATE users SET admin=1 WHERE username='username';
49+
```

0 commit comments

Comments
 (0)