This commit is contained in:
Thomas 2016-01-03 14:15:36 -06:00
commit b8522340a5
8 changed files with 8 additions and 16 deletions

2
.gitignore vendored
View file

@ -2,7 +2,7 @@
.secret_key .secret_key
.bundle/config .bundle/config
logs/ logs/
uploads/ files/
# Object files # Object files
*.o *.o

View file

@ -37,14 +37,9 @@ def problem_add():
if len(filename) == 0: if len(filename) == 0:
continue continue
folder = problem.name.replace(" ", "-") file_path = os.path.join(app.config["UPLOAD_FOLDER"], filename)
folder_path = os.path.join(os.path.normpath(app.config["UPLOAD_FOLDER"]), folder)
if not os.path.exists(folder_path):
os.makedirs(folder_path)
file_path = os.path.join(folder_path, filename)
_file.save(file_path) _file.save(file_path)
db_file = Files(problem.pid, file_path) db_file = Files(problem.pid, "/".join(file_path.split("/")[2:]))
db.session.add(db_file) db.session.add(db_file)
db.session.commit() db.session.commit()
@ -80,6 +75,7 @@ def problem_update():
problem = Problems.query.filter_by(pid=pid).first() problem = Problems.query.filter_by(pid=pid).first()
if problem: if problem:
problem.name = name problem.name = name
problem.category = category
problem.description = description problem.description = description
problem.hint = hint problem.hint = hint
problem.flag = flag problem.flag = flag

View file

@ -15,7 +15,7 @@ SECRET_KEY = key
SQLALCHEMY_DATABASE_URI = "mysql://root:i_hate_passwords@localhost/easyctf" SQLALCHEMY_DATABASE_URI = "mysql://root:i_hate_passwords@localhost/easyctf"
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False
UPLOAD_FOLDER = os.path.normpath("files") UPLOAD_FOLDER = os.path.normpath("../web/files")
CTF_BEGIN = 0 # To be used later CTF_BEGIN = 0 # To be used later
CTF_END = 0 # To be used later CTF_END = 0 # To be used later

View file

@ -1 +0,0 @@
This is hard! I'm telling you!

View file

@ -1 +0,0 @@
Binary is not fun at all!

View file

@ -1 +0,0 @@
This is an example file, and should be removed before the tournament starts.

View file

@ -1 +0,0 @@
Hello World! How art thou?

View file

@ -27,15 +27,15 @@ function render_problems() {
<br><br> <br><br>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<input type="text" name="flag" placeholder="Flag" autocomplete="off" class="form-control"> <input type="text" name="flag" placeholder="Flag" autocomplete="off" class="form-control" value="` + data[i]["flag"] + `">
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<input type="text" name="hint" placeholder="Hint" autocomplete="off" class="form-control"> <input type="text" name="hint" placeholder="Hint" autocomplete="off" class="form-control" value="` + data[i]["hint"] + `">
</div> </div>
</div> </div>
<br> <br>
<div class="row"> <div class="row">
<input type="number" name="value" placeholder="Value" autocomplete="off" class="form-control-number"> <input type="number" name="value" placeholder="Value" autocomplete="off" class="form-control-number" value="` + data[i]["value"] + `">
<label><input type="checkbox" name="disabled" value="1"` + checked + `>Disabled</label> <label><input type="checkbox" name="disabled" value="1"` + checked + `>Disabled</label>
</div> </div>
</div> </div>