Skip to content

Commit

Permalink
Merge pull request #1662 from OWASP/ctfd-generation-fix
Browse files Browse the repository at this point in the history
fix for disabled challenges for ctfd data generation
  • Loading branch information
commjoen authored Oct 10, 2024
2 parents 05fea69 + b45079a commit a7acbe6
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ public String getChallenges() {
jsonChallenge.put("name", definition.name().name());
jsonChallenge.put("key", definition.name().shortName());
jsonChallenge.put("category", getCategory() + " - " + definition.category().category());
String disabledChallenge = "This challenge is disbled";
jsonChallenge.put(
"description",
definition
.source(runtimeEnvironment)
.map(s -> s.explanation().contents().get())
.orElse(null));
.orElse(disabledChallenge));
jsonChallenge.put(
"hint",
definition.source(runtimeEnvironment).map(s -> s.hint().contents().get()).orElse(null));
definition
.source(runtimeEnvironment)
.map(s -> s.hint().contents().get())
.orElse(disabledChallenge));
jsonChallenge.put("solved", scoreCard.getChallengeCompleted(definition));
jsonChallenge.put("disabledEnv", getDisabledEnv(definition));
jsonChallenge.put("difficulty", definition.difficulty().difficulty());
Expand Down

0 comments on commit a7acbe6

Please sign in to comment.