forked from CTFd/CTFd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Changing to a new plugin oriented challenge type plugin and fixing extra width on admin chal description * Add window.challenge.submit, renderSubmissionResponse, and csrf_nonce * Update admin side renderer calls * Updating to Flask 1.0 and adding files for flask run * Adding a preliminary case-insensitive key * Adding case insensitive keys * Adding CTF Logo * Reducing the amount of team information shown on the main page * Add better base64 helpers * Switch from button to badge * Rudimentary solve checking from admin panel * Refine admin chals solves view & fix PEP8 * Compare base64 encoded data with bytestring * Removing need to urlencode/urldecode in base64 wrappers * Adding decorator documentation * Randomly order tests & add test for case_insensitive flags * Add regex flag case_insensitive test * Add tests for /admin/chal/1/solves and ctf_logo
- Loading branch information
Showing
40 changed files
with
700 additions
and
434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FLASK_ENV=development | ||
FLASK_RUN_PORT=4000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 7 additions & 13 deletions
20
CTFd/plugins/challenges/assets/standard-challenge-create.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,29 @@ | ||
// Markdown Preview | ||
$('#desc-edit').on('shown.bs.tab', function (event) { | ||
var md = window.markdownit({ | ||
html: true, | ||
}); | ||
if (event.target.hash == '#desc-preview'){ | ||
if (event.target.hash == '#desc-preview') { | ||
var editor_value = $('#desc-editor').val(); | ||
$(event.target.hash).html( | ||
md.render(editor_value) | ||
window.challenge.render(editor_value) | ||
); | ||
} | ||
}); | ||
$('#new-desc-edit').on('shown.bs.tab', function (event) { | ||
var md = window.markdownit({ | ||
html: true, | ||
}); | ||
if (event.target.hash == '#new-desc-preview'){ | ||
if (event.target.hash == '#new-desc-preview') { | ||
var editor_value = $('#new-desc-editor').val(); | ||
$(event.target.hash).html( | ||
md.render(editor_value) | ||
window.challenge.render(editor_value) | ||
); | ||
} | ||
}); | ||
$("#solve-attempts-checkbox").change(function() { | ||
if(this.checked) { | ||
$("#solve-attempts-checkbox").change(function () { | ||
if (this.checked) { | ||
$('#solve-attempts-input').show(); | ||
} else { | ||
$('#solve-attempts-input').hide(); | ||
$('#max_attempts').val(''); | ||
} | ||
}); | ||
|
||
$(document).ready(function(){ | ||
$(document).ready(function () { | ||
$('[data-toggle="tooltip"]').tooltip(); | ||
}); |
52 changes: 31 additions & 21 deletions
52
CTFd/plugins/challenges/assets/standard-challenge-modal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,35 @@ | ||
$('#submit-key').unbind('click'); | ||
$('#submit-key').click(function (e) { | ||
e.preventDefault(); | ||
submitkey($('#chal-id').val(), $('#answer-input').val(), $('#nonce').val()) | ||
window.challenge.renderer = new markdownit({ | ||
html: true, | ||
}); | ||
|
||
$("#answer-input").keyup(function(event){ | ||
if(event.keyCode == 13){ | ||
$("#submit-key").click(); | ||
} | ||
}); | ||
window.challenge.preRender = function(){ | ||
|
||
}; | ||
|
||
window.challenge.render = function(markdown){ | ||
return window.challenge.renderer.render(markdown); | ||
}; | ||
|
||
|
||
$(".input-field").bind({ | ||
focus: function() { | ||
$(this).parent().addClass('input--filled' ); | ||
$label = $(this).siblings(".input-label"); | ||
}, | ||
blur: function() { | ||
if ($(this).val() === '') { | ||
$(this).parent().removeClass('input--filled' ); | ||
$label = $(this).siblings(".input-label"); | ||
$label.removeClass('input--hide' ); | ||
} | ||
window.challenge.postRender = function(){ | ||
|
||
}; | ||
|
||
|
||
window.challenge.submit = function(cb, preview){ | ||
var chal_id = $('#chal-id').val(); | ||
var answer = $('#answer-input').val(); | ||
var nonce = $('#nonce').val(); | ||
|
||
var url = "/chal/"; | ||
if (preview) { | ||
url = "/admin/chal/"; | ||
} | ||
}); | ||
|
||
$.post(script_root + url + chal_id, { | ||
key: answer, | ||
nonce: nonce | ||
}, function (data) { | ||
cb(data); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
<label for="create-key-regex" class="control-label">Enter Regex Key Data</label> | ||
<input type="text" id="create-key-regex" class="form-control" name="key" value="{{key}}" placeholder="Enter regex key data"> | ||
<input type="text" id="create-key-regex" class="form-control" name="key" value="{{key}}" placeholder="Enter regex key data"> | ||
<div class="form-check form-check-inline"> | ||
<input class="form-check-input" type="checkbox" id="keydata" name="keydata" value="case_insensitive"> | ||
<label class="form-check-label" for="keydata">Case Insensitive</label> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header text-center"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<h3 class="text-center">Regex Key</h3> | ||
</div> | ||
</div> | ||
</div> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<form method="POST" action="{{ script_root }}/admin/keys/{{id}}"> | ||
<input type="text" id="key-data" class="form-control" name="key" value="{{key}}" placeholder="Enter regex key data"> | ||
<input type="hidden" id="key-type" name="key_type" value="regex"> | ||
<input type="hidden" id="key-id"> | ||
<hr> | ||
<div class="form-group"> | ||
<input type="hidden" value="{{ nonce }}" name="nonce" id="nonce"> | ||
<button id="submit-keys" class="btn btn-success float-right">Update</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
<div class="modal-content"> | ||
<div class="modal-header text-center"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<h3 class="text-center">Regex Key</h3> | ||
</div> | ||
</div> | ||
</div> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<form method="POST" action="{{ script_root }}/admin/keys/{{id}}"> | ||
<input type="text" id="key-data" class="form-control" name="key" value="{{key}}" placeholder="Enter regex key data"> | ||
<div class="form-check form-check-inline"> | ||
<input class="form-check-input" type="checkbox" id="keydata" name="keydata" value="case_insensitive" | ||
{% if data %}checked{% endif %}> | ||
<label class="form-check-label" for="keydata">Case Insensitive</label> | ||
</div> | ||
<input type="hidden" id="key-type" name="key_type" value="regex"> | ||
<input type="hidden" id="key-id"> | ||
<hr> | ||
<div class="form-group"> | ||
<input type="hidden" value="{{ nonce }}" name="nonce" id="nonce"> | ||
<button id="submit-keys" class="btn btn-success float-right">Update</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.