fix: correct number of solved assignments in report card (#2065)

* fix: correct number of solved assignments in report card

Filter the list of assignments to accurately count the number of solved assignments.

Closes: gh-2063

* chore: remove scoreboard code

This is added when we run a CTF challenge during OWASP AppSecEU in 2017. We can remove this code.

Closes: gh-2064
This commit is contained in:
Nanne Baars
2025-03-11 22:57:49 +01:00
committed by GitHub
parent 2c5e4c4491
commit 23d6fe6f36
16 changed files with 106 additions and 441 deletions

View File

@ -4,7 +4,7 @@
The challenges contain more a CTF like lessons where we do not provide any explanations what you need to do, no hints
will be provided. You can use these challenges in a CTF style where you can run WebGoat on one server and all
participants can join and hack the challenges. A scoreboard is available at link:scoreboard["scoreboard",window=_blank]
participants can join and hack the challenges.
:hardbreaks:
In this CTF you will need to solve a couple of challenges, each challenge will give you a flag which you will

View File

@ -1172,46 +1172,10 @@ span.show-next-page, span.show-prev-page {
width: 95% !important
}
/* scoreboard */
div.scoreboard-title {
font-size: xx-large;
}
.scoreboard-table tr {
}
div.scoreboard-username {
background-color: #222;
color: aliceblue;
padding: 4px;
padding-left: 8px;
font-size: medium;
border-radius: 6px;
}
th.username {
padding-bottom: 6px;
}
td.user-flags {
padding-left: 8px;
padding-bottom: 6px;
}
div.captured-flag {
border-radius: 6px;
background-color: #444;
color: white;
padding: 4px;
font-size: medium;
display: inline-block;
}
.scoreboard-page {
background-color: #e0dfdc;
padding: 20px;
}
.fa-flag {
color: red
}

View File

@ -1,9 +0,0 @@
define(['jquery',
'underscore',
'backbone'],
function($,
_,
Backbone) {
return Backbone.Model.extend({
});
});

View File

@ -1,13 +0,0 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/model/FlagModel'],
function($,
_,
Backbone,
FlagModel) {
return Backbone.Collection.extend({
url:'scoreboard-data',
model:FlagModel
});
});

View File

@ -1,16 +0,0 @@
define(['underscore',
'goatApp/support/goatAsyncErrorHandler',
'goatApp/view/ScoreboardView'],
function (
_,
asyncErrorHandler,
ScoreboardView) {
'use strict'
class ScoreboardApp {
initApp() {
asyncErrorHandler.init();
this.scoreboard = new ScoreboardView();
}
}
return new ScoreboardApp();
});

View File

@ -1,14 +0,0 @@
<table class="scoreboard-table">
<% _.each(rankings, function(userRanking, index) { %>
<tr>
<th class="username"> <div class="scoreboard-username"><%= index+1%> - <%=userRanking.username %> </div></th>
<td class="user-flags"> <% _.each(userRanking.flagsCaptured, function(flag) { %>
<div class="captured-flag">
<i class="fa fa-flag" aria-hidden="true"></i>
<%=flag%> </div>
<% }); %>
</td>
</tr>
<% }); %>
</table>

View File

@ -1,32 +0,0 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/model/FlagsCollection',
'text!templates/scoreboard.html'],
function($,
_,
Backbone,
FlagsCollection,
ScoreboardTemplate) {
return Backbone.View.extend({
el:'#scoreboard',
initialize: function() {
this.template = ScoreboardTemplate,
this.collection = new FlagsCollection();
this.listenTo(this.collection,'reset',this.render)
this.collection.fetch({reset:true});
},
render: function() {
//this.$el.html('test');
var t = _.template(this.template);
this.$el.html(t({'rankings':this.collection.toJSON()}));
setTimeout(this.pollData.bind(this), 5000);
},
pollData: function() {
this.collection.fetch({reset:true});
}
});
});

View File

@ -1,44 +0,0 @@
//main.js
/*
/js
js/main.js << main file for require.js
--/libs/(jquery,backbone,etc.) << base libs
--/goatApp/ << base dir for goat application, js-wise
--/goatApp/model
--/goatApp/view
--/goatApp/support
--/goatApp/controller
*/
require.config({
baseUrl: "js/",
paths: {
jquery: 'libs/jquery.min',
jqueryvuln: 'libs/jquery-2.1.4.min',
jqueryuivuln: 'libs/jquery-ui-1.10.4',
jqueryui: 'libs/jquery-ui.min',
underscore: 'libs/underscore-min',
backbone: 'libs/backbone-min',
text: 'libs/text',
templates: 'goatApp/templates',
polyglot: 'libs/polyglot.min'
},
shim: {
"jqueryui": {
exports:"$",
deps: ['jquery']
},
underscore: {
exports: "_"
},
backbone: {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
}
}
});
require(['underscore','backbone','goatApp/scoreboardApp'], function(_,Backbone,ScoreboardApp){
ScoreboardApp.initApp();
});

View File

@ -1,55 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
<meta http-equiv="Expires" CONTENT="-1"/>
<meta http-equiv="Pragma" CONTENT="no-cache"/>
<meta http-equiv="Cache-Control" CONTENT="no-cache"/>
<meta http-equiv="Cache-Control" CONTENT="no-store"/>
<!-- CSS -->
<link rel="shortcut icon" th:href="@{/css/img/favicon.ico}" type="image/x-icon"/>
<!-- Require.js used to load js asynchronously -->
<script src="js/libs/require.min.js" data-main="js/scoreboard.js"></script>
<!-- main css -->
<link rel="stylesheet" type="text/css" th:href="@{/css/main.css}"/>
<link rel="stylesheet" type="text/css" th:href="@{/plugins/bootstrap/css/bootstrap.min.css}"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/font-awesome.min.css}"/>
<meta http-equiv="Content-Type" content="text/id; charset=ISO-8859-1"/>
<title>WebGoat</title>
</head>
<!-- <body class="scoreboard-page"> -->
<body>
<header id="header">
<!--logo start-->
<div class="brand">
<a th:href="@{/welcome.mvc}" class="logo"><span>Web</span>Goat</a>
</div>
<!--logo end-->
<div id="lesson-title-wrapper">
<h1 id="lesson-title">WebGoat challenges ranking</h1>
</div><!--lesson title end-->
<div class="user-nav pull-right" id="user-and-info-nav" style="margin-right: 75px;">
</div>
</header>
<section id="container">
<!--main content start-->
<section class="main-content-wrapper">
<section id="main-content">
<div id="scoreboard-wrapper">
<div id="scoreboard">
<!-- will use _ template here -->
</div>
</div>
</section>
</section>
</section>
</body>
</html>