Giter Site home page Giter Site logo

ctfd-challenge-discovery-plugin's Introduction

CTFd-Challenge-Discovery-Plugin

V2.0.3 BETA

This is a CTFd platform plugin that allows for Challenge Discovery.

Challenge Discovery

This will allow for certain problems to show up only after a predefined set of problems have been solved.

Specifically, this plugin allows for an arbitrarily large number of 'ORed' sets of dependent problems before a problem is shown. This means that the problem will be shown when any predefined list of problems is solved by the viewing user.

Example

The Dev Team has made Problem A be shown if either (Problem B AND Problem C) or if (Problem D) is solved. This means that a competitor will only need to solve either (B and C) or D for Problem A to be visible to them.

DISCLAIMER

This plugin is currently in development, but works. It is just a bit of a duct-tape User Interface right now

Usage:

There are two different functions this plugin has: Adding challenge-discovery information to a given challenge, and Deleting challenge-dsicvoery information from a given challenge.

ADDING AUTO-LOAD CHALLENGES AFTER SOLVING CHALLENGE FEATURE

Correctly, the default theme does not support Challenge Discovery completely. When a user submits a correct answer, the challenges displayed aren't updated until they refresh.

To correct this, all that has to be down is to add: update();

at the end of the submitkey(chal, key, nonce) function of the chalboard.js in the theme folder that your CTFd instance is using. Specifically, for CTFd 1.0.5, this file is found in CTFd\themes\original\static\js\chalboard.js. Specifically, in CTFd 1.0.5, this line of code can be placed on line 125 of the chalboard.js file. Below I have an example of how the "update();" line could be put in:

else if (result.status == 1){ // Challenge Solved
            result_notification.addClass('alert alert-success alert-dismissable text-center');
            result_notification.slideDown();

            $('.chal-solves').text((parseInt($('.chal-solves').text().split(" ")[0]) + 1 +  " Solves") );

            answer_input.val("");update()
            answer_input.removeClass("wrong");
            answer_input.addClass("correct");
            
            update(); //For Auto-Loading Challenges
}

Installing

Simply copy the files in this repo into an existing CTFd 1.0.5 CTF workspace. You will most likely need to delete the CTFd\ctfd.db file in your instance and restart the CTFd service.

Terminology

Challenge Discovery - The process of having challenges depend on other challenges before being visible to the competitor/user Discovery Set - The set of challenges a competitor/user needs to solve before a particular challenge is able to be seen. Discovery List - The set of Discovery Sets for a particular challenge. (If it shows up)

Adding discovery to a challenge:

  1. Open up the Admin's challenge page and create any problem you wish.
  2. Open the plugin tab called "Discovery". Open up a created problem.
  3. Click on the dropdown menu that appears to the right of the challenge's name that you wish to add a Discovery Set to.
  4. Click the problems you want to make up a Discovery Set for the Challenge in set 3.
  • NOTE: there can be multiple Discovery Sets. When any of the Challenge's Discovery Sets have been satisified, the challenge becomes visible
  1. When you are done, click Update. This refreshes the page, so you can add another Discovery Set using these 5 steps.

Note: A challenge is defaulted to showing up for everyone if no discovery set is given. If you want a problem to be hidden for everyone no matter what, I would suggest clicking on the "Hidden" checkbox that is built into the CTFd platform.

Deleting Discovery Set:

Simply click on the light blue / gray "x" that is below the last challenge in the Discovery Set.

Features

Auto-Discovery

This feature automatically adds a set of preconfigured Discovery Sets to each challenge.

The settings for this will unlock a challenge if:

  • If it is the first challenge in a catagory
  • If the next lowest challenge in the catagory has been solved
  • If the next two lowest challenges in the catagory have been solved and a challenge of greater value in a different catagory have been solved.

NOTE: The Discovery Sets created from this feature cannot be easily deleted without deleting all manually-created Discovery Sets with them.

Delete All

This feature will delete all stored data.

ON/OFF

This feature will turn off or on Challenge Discovery for the entire CTFd instance. This is usefull for a quick unlocking of all challenges without permanently deleting all of the Discovery Sets.

The ON/OFF feature is the toggle at the very top of the page right below "Challenge Discovery" in the center of the page. When the white circle is on the right, Challenge Discovery is turned on, otherwise it is turned off.

Preview

This feature simulates which challenge would be visible to users/competitors after solving a certain set of challenges.

To use the feature:

  1. Click on the dropdown menu at the top under the word "Preview"
  2. Select the list of challenges you want to simulate as being "solved"
  3. Click on the "Preview" button at near top of the page

Colors:

  • Challenge Thumbnail:
    • Green: The challenge is visible to the user/competitor who has solved the list of "solved" challenges. (This one hasn't been solved though)
    • Red: The challenge is not visible to the user/competitor and it has not been solved.
    • Blue: The challenge is visible, because the user/compeitor has solved this challenge. Because you can "solve" any problem (regardless of if would be visible or not), the particular set of "solved" problems may be impossible for a compeitor/user to get without the help of an admin.
  • Challenges in each Discovery Set:
    • Green: The challenge has been solved
    • red: The challenge has not been solved
  • Discovery Set:
    • Green: All challenges in the Discovery Set have been solved, and therefore the challenge would be visible. (Only one of a challenge's Discovery Set has to be green for the challenge to become visible)
    • red: Not all of the challenges in the Discovery Set have been solved.

ctfd-challenge-discovery-plugin's People

Contributors

ameserole avatar jonygrimes avatar r-gomez avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ctfd-challenge-discovery-plugin's Issues

[Issue] Jumping to top when adding new Discovery Sets

Description of Problem

When clicking on any of the dropdown menus of a challenge, the entire screen will reload, forcing the user to the top of the screen each time. This means that the user will have to scroll down for every problem they wish to add to any "Discovery Set", or a set of problems needed to be solved before the current challenge will appear.

Discussion

Currently, I haven't looked to much into this issue, as this appears to be more of an annoyance than a problem that will stop the plugin from working, but it is annoying enough to fix. This definitely wasn't a problem in the previous iteration of the plugin, because the previous iteration only had one challenge's dropdown menu(s) visible to the user at a time. This of course is different in the current iteration of the code.

;tldr I'll have to look into some of the legacy code to see what is happening.

[Feature] Auto-Discovery

Description of Problem

Currently, the User Interface (UI) of the Auto-Challenge-Discovery (or Auto-Discovery for short) is a simple switch that will add a predefined set of Challenge Discovery to the challenges that have been created. The problem here is deciding the graphic used to represent this and trying to decide whether to give a choice to the user as to which method Auto-Discovery will use, as currently I only give one choice to the user through the UI.

Discussion

The switch only add the challenges, not delete them. This is because of the method in which the feature works. The plugin doesn't have anyway of knowing which problems were added before/after adding the challenges, and therefore I wouldn't feel comfortable deleting a problem just because it is in a list.

The predefined list of Challenge Discovery that is added is currently visible through "[IP:port]/DiscoveryList/auto " which is basically a list of ints that maps to a lists of a list of lists of ints. Each Challenge (represented by their ID) has the same index as a list of lists of ints. Represented below:

  • List of Challenges (a List of single Lists of multiple Lists of ints)
    • List of Challenge Discoveries (List of list of ints)
      • Each challenge in a Challege Discovery Set (int)

;tldr I need to decide UI and how feature works

[Feature Request] Delete Button

Description of Feature

I need to have a button that deletes all Challenge Discovery sets.

Discussion

This shouldn't be too hard to get done, but I'm concerned that this might end up making the UI bulky, so I'll need to decide where to put it.

[Feature Request] Preview

Description of Feature

Basically I want to be able to select problems from a dropdown to act as "solved problems" and the UI to show me which problems would show up for a user. This would also show which Discovery Set made the problem show up, possibly even having the problems within each Discovery Set show up as Green or Red depending on if it had been solved.

Discussion

Well, this might be a little bit more difficult to get going, and it would also slow down the loading of the plugin as a whole, so I would definitely need to optimize the code a little better before attempting this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.