Skip to content

Commit

Permalink
Merge pull request #8 from wroersma/0.1
Browse files Browse the repository at this point in the history
0.1
  • Loading branch information
wroersma authored Jan 1, 2018
2 parents 4ad9af2 + 6850b4e commit 51198f7
Show file tree
Hide file tree
Showing 19 changed files with 1,283 additions and 1,062 deletions.
9 changes: 9 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CTFd multianswer plugin
https://github.com/wroersma/ctfd-multi-answer

multianswer plugin is developed by (in alphabetical order):

* Wyatt Roersma ([email protected])

To contact the Authors please feel free to email them or join the slack chat

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ This plugin allows you to create challenges that give players points by awards f
Clone multianswer from the dir /CTFd/plugins/


#How to use
Go to challenges to create a challenge
Create a new challenge
- from the drop down select multianswer

* Please note that the value you select is what will be added for correct answers and reduced from the players score for anything that matches wrong answers

For correct answers use the the "correct" key
For wrong answers use the "wrong" key


#Questions

If you have any questions please contact Wyatt Roersma([email protected])
337 changes: 203 additions & 134 deletions __init__.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions __version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.1'
2 changes: 0 additions & 2 deletions assets/CTFdWrongKey.hbs

This file was deleted.

3 changes: 3 additions & 0 deletions assets/create-correct-modal.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<label for="create-key-correct" class="control-label">Enter correct Key Data</label>
<input type="text" id="create-key-correct" class="form-control" name="key" value="{{key}}" placeholder="Enter correct key data">
<input type="text" id="create-value-correct" class="form-control" name="data" value="{{data}}" placeholder="Enter correct point value">
3 changes: 3 additions & 0 deletions assets/create-wrong-modal.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<label for="create-key-wrong" class="control-label">Enter Wrong Key Data</label>
<input type="text" id="create-key-wrong" class="form-control" name="key" value="{{key}}" placeholder="Enter wrong key data">
<input type="text" id="create-value-wrong" class="form-control" name="data" value="{{data}}" placeholder="Enter wrong point value">
19 changes: 0 additions & 19 deletions assets/edit-CTFdWrongKey-modal.hbs

This file was deleted.

29 changes: 29 additions & 0 deletions assets/edit-correct-modal.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<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">Correct Key</h3>
</div>
</div>
</div>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</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 correct key data">
<input type="text" id="key-value" class="form-control" name="pointvalue" value="{{pointvalue}}" placeholder="Enter correct point value">
<input type="hidden" id="key-type" name="key_type" value="correct">
<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>
29 changes: 29 additions & 0 deletions assets/edit-wrong-modal.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<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">Wrong Key</h3>
</div>
</div>
</div>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</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 wrong key data">
<input type="text" id="key-value" class="form-control" name="data" value="{{data}}" placeholder="Enter wrong point value">
<input type="hidden" id="key-type" name="key_type" value="wrong">
<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>
111 changes: 0 additions & 111 deletions assets/multianswer-challenge-create.hbs

This file was deleted.

99 changes: 99 additions & 0 deletions assets/multianswer-challenge-create.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<form method="POST" action="{{ script_root }}/admin/chal/new" enctype="multipart/form-data">
<div class="form-group">
<label for="name">Name
<i class="far fa-question-circle text-muted cursor-help" data-toggle="tooltip" data-placement="right" title="The name of your challenge"></i>
</label>
<input type="text" class="form-control" name="name" placeholder="Enter challenge name">
</div>
<div class="form-group">
<label for="category">Category
<i class="far fa-question-circle text-muted cursor-help" data-toggle="tooltip" data-placement="right" title="The category of your challenge"></i>
</label>
<input type="text" class="form-control" name="category" placeholder="Enter challenge category">
</div>

<ul class="nav nav-tabs" role="tablist" id="new-desc-edit">
<li class="nav-item">
<a class="nav-link active" href="#new-desc-write" aria-controls="home" role="tab" data-toggle="tab">Write</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#new-desc-preview" aria-controls="home" role="tab" data-toggle="tab">Preview</a>
</li>
</ul>

<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="new-desc-write">
<div class="form-group">
<label for="message-text" class="control-label">Message:
<i class="far fa-question-circle text-muted cursor-help" data-toggle="tooltip" data-placement="right" title="Use this to give a brief introduction to your challenge. The description supports HTML and Markdown."></i>
</label>
<textarea id="new-desc-editor" class="form-control" name="description" rows="10"></textarea>
</div>
</div>
<div role="tabpanel" class="tab-pane content" id="new-desc-preview" style="height:234px; overflow-y: scroll;">
</div>
</div>

<div class="form-group">
<label for="value">Value
<i class="far fa-question-circle text-muted cursor-help" data-toggle="tooltip" data-placement="right" title="This is how many points are rewarded for solving this challenge."></i>
</label>
<input type="number" class="form-control" name="value" placeholder="Enter value" required>
</div>

<div class="form-group">
<label>Flag
<i class="far fa-question-circle text-muted cursor-help" data-toggle="tooltip" data-placement="right" title="This is the flag or solution for your challenge. You can choose whether your flag is a static string or a regular expression."></i>
</label>
<input type="text" class="form-control" name="key" placeholder="Enter flag">
</div>

<div class="form-group">
<select class="custom-select" name="key_type[0]">
<option value="correct">Correct</option>
<option value="wrong">Wrong</option>
</select>
</div>

<div class="form-check">
<div class="checkbox">
<label class="form-check-label">
<input class="form-check-input" name="hidden" type="checkbox">
Hide challenge on creation
</label>
</div>
</div>

<div class="form-check">
<div class="checkbox">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" id="solve-attempts-checkbox">
Limit amount of solve attempts
</label>
</div>
</div>

<div class="form-group">
<div id="solve-attempts-input" style="display: none;">
<label for="max_attempts">Maximum Attempts
<i class="far fa-question-circle text-muted cursor-help" data-toggle="tooltip" data-placement="right" title="How many attempts should a user have for this challenge? For unlimited attempts, use the value 0"></i>
</label>
<input class="form-control" id='max_attempts' name='max_attempts' type='number' placeholder="0">
</div>
</div>

<div class="form-group">
<label>Upload Challenge Files
<i class="far fa-question-circle text-muted cursor-help" data-toggle="tooltip" data-placement="right" title="Challenges files are provided to users for download alongside your challenge description"></i>
</label>
<input class="form-control-file" type="file" name="files[]" multiple="multiple">
<sub class="help-block">Attach multiple files using Control+Click or Cmd+Click.</sub>
</div>

<input type="hidden" value="{{ nonce }}" name="nonce" id="nonce">
<input type="hidden" value="multianswer" name="chaltype" id="chaltype">

<div class="form-group">
<button class="btn btn-primary float-right create-challenge-submit" type="submit">Create</button>
</div>
</form>
Loading

0 comments on commit 51198f7

Please sign in to comment.