dashboard: can now change the sidebar

This commit is contained in:
nemunaire 2019-01-19 08:01:29 +01:00
commit a4e0a90adf
7 changed files with 410 additions and 57 deletions

View file

@ -23,7 +23,7 @@
</div>
</noscript>
<div ng-repeat="(k,s) in scene" class="repeatedd-item" style="margin-bottom: 15px;" ng-cloak>
<div ng-repeat="(k,s) in display.scenes" class="repeatedd-item" style="margin-bottom: 15px;" ng-cloak>
<div class="card niceborder bg-dark" ng-if="s.type == 'welcome' && !s.params.hide && s.params.kind == 'teams'">
<div class="card-body text-light text-indent">
@ -85,7 +85,7 @@
<div class="card-header bg-{{ s.params.color }} text-white" ng-if="s.params.title">
<h3 style="margin:0" ng-bind="s.params.title"></h3>
</div>
<div class="card-body text-light" ng-if="s.params.text || s.params.lead">
<div class="card-body" ng-if="s.params.text || s.params.lead">
<h4 ng-if="s.params.lead" class="card-title text-justify" ng-bind="s.params.lead"></h4>
<p class="card-text" ng-bind="s.params.text"></p>
</div>
@ -98,7 +98,7 @@
<strong>Challenge <em>{{ themes[my.exercices[s.params.exercice].theme_id].exercices[s.params.exercice].title }}</em> du thème {{ themes[my.exercices[s.params.exercice].theme_id].name }}</strong>
<small class="authors" ng-if="themes[my.exercices[s.params.exercice].theme_id].authors">par {{ themes[my.exercices[s.params.exercice].theme_id].authors | stripHTML }}</small>
</p>
<p ng-bind-html="my.exercices[s.params.exercice].statement"></p>
<p ng-bind-html="my.exercices[s.params.exercice].overview"></p>
<ul class="list-inline text-secondary">
<li>Rapporte <ng-pluralize count="themes[my.exercices[s.params.exercice].theme_id].exercices[s.params.exercice].gain" when="{'0': 'aucun point', 'one': '{} point', 'other': '{} points'}"></ng-pluralize></li>
<li ng-if="my.exercices[s.params.exercice].files"><ng-pluralize count="my.exercices[s.params.exercice].files.length" when="{'0': 'Aucun fichier disponible', 'one': '{} fichier disponible', 'other': '{} fichiers disponibles'}"></ng-pluralize></li>
@ -130,7 +130,7 @@
</tr>
</tbody>
<tbody class="table-bordered" ng-if="s.params.kind == 'teams'">
<tr ng-repeat="team in rank | orderBy: 'rank' | limitTo: s.params.limit: s.params.begin" ng-if="s.params.teams.indexOf(team.id-0) !== -1" ng-controller="TeamController">
<tr ng-repeat="team in teams" ng-if="s.params.teams.indexOf(team.id) !== -1" ng-controller="TeamController">
<th class="text-center">{{ team.rank }}<sup ng-if="team.rank == 1">er</sup><sup ng-if="team.rank > 1">e</sup><br><span style="text-overflow: ellipsis; display: inline-block; width: 82px;overflow: hidden;">{{ team.name }}</span></th>
<td ng-repeat="(tid,th) in themes" class="text-center" ng-if="mystats && s.params.themes.indexOf(tid-0) !== -1">
<span ng-class="{'text-success': mystats.themes[tid].solved}">{{ mystats.themes[tid].solved }}/{{ mystats.themes[tid].total }}</span>
@ -249,7 +249,7 @@
<br>
<small class="authors" ng-if="themes[exercice.theme_id].authors">par {{ themes[exercice.theme_id].authors }}</small>
</p>
<p ng-bind-html="exercice.statement"></p>
<p ng-bind-html="exercice.overview"></p>
<ul class="list-inline text-secondary">
<li>Rapporte <ng-pluralize count="themes[exercice.theme_id].exercices[eid].gain" when="{'0': 'aucun point', 'one': '{} point', 'other': '{} points'}"></ng-pluralize></li>
<li ng-if="exercice.files"><ng-pluralize count="exercice.files.length" when="{'0': 'Aucun fichier disponible', 'one': '{} fichier disponible', 'other': '{} fichiers disponibles'}"></ng-pluralize></li>
@ -271,8 +271,110 @@
<div class="col-4">
<div id="themesSummary" ng-cloak>
<div ng-repeat="(k,s) in display.side" class="repeatedd-item" style="margin-bottom: 7px;">
<div class="card niceborder bg-dark" ng-if="s.type == 'welcome' && !s.params.hide">
<div class="card-body text-light text-indent" style="padding: 0.4rem;">
<h1 ng-if="!s.params.notitle" class="text-center niceborder">Le challenge forensic&nbsp;!</h1>
<p class="lead text-justify">
Durant ce challenge, les équipes doivent <strong>remonter des scénarii
d'attaques</strong> auxquels nos systèmes d'information <strong>font face
chaque jour</strong> : fuite de données, compromission d'un poste de
travail, exploitation de vulnérabilités d'un site web, ...
</p>
<p class="lead text-justify">
Pour valider un challenge, chaque participant va télécharger :
soit des <strong>journaux d'évènements</strong>, des extraits de trafic réseau
ou même des <strong>copies</strong> figées <strong>de la mémoire vive</strong> de machines
malveillantes, pour <strong>essayer de comprendre</strong> comment l'attaquant a
<strong>contourné la sécurité</strong> de la machine et quelles actions hostiles
ont été effectuées.
</p>
</div>
</div>
<div class="card niceborder bg-dark" ng-if="s.type == 'themes' && !s.params.hide">
<div class="text-light text-bold text-right" style="position: absolute; z-index: 10; width: 100%; padding: 1rem;">
<span style="background: rgba(50,50,50,0.66); padding: 0.2rem 0.4rem; border-radius: 3px; border-bottom-width: 3px;">
Les entreprises ciblées
</span>
</div>
<div class="card-body bg-dark">
<div class="carousel slide" data-interval="12000" style="padding-bottom: 0px" autocarousel>
<div class="carousel-inner">
<div class="carousel-item" ng-repeat="theme in themes" ng-class="{active: $first}">
<div class="carousel-caption text-indent">
<div class="card-img-top theme-card" style="background-image: url('{{theme.image}}')"></div>
<h3 class="text-left" ng-bind="theme.name"></h3>
<p class="text-justify" style="font-size: 111%" ng-bind-html="theme.headline"></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card niceborder bg-dark" ng-if="s.type == 'exercice' && !s.params.hide">
<div class="card-img-top theme-card" style="background-image: url('{{themes[my.exercices[s.params.exercice].theme_id].image}}')"></div>
<div class="card-body text-light">
<h3 style="font-size: 1.0rem; text-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap">Défi <em>{{ themes[my.exercices[s.params.exercice].theme_id].exercices[s.params.exercice].title }}</em> du thème <em>{{ themes[my.exercices[s.params.exercice].theme_id].name }}</em></h3>
<p ng-bind-html="my.exercices[s.params.exercice].overview"></p>
<ul class="list-inline text-muted mr-2 ml-2 mb-1" style="font-size: 0.9rem">
<li><ng-pluralize count="themes[my.exercices[s.params.exercice].theme_id].exercices[s.params.exercice].gain" when="{'0': 'aucun point', 'one': '{} point', 'other': '{} points'}"></ng-pluralize></li>
<li ng-if="my.exercices[s.params.exercice].files"><ng-pluralize count="my.exercices[s.params.exercice].files.length" when="{'0': 'Aucun fichier', 'one': '{} fichier', 'other': '{} fichiers'}"></ng-pluralize></li>
<li ng-if="my.exercices[s.params.exercice].hints.length"><ng-pluralize count="my.exercices[s.params.exercice].hints.length" when="{'0': 'Aucun indice disponible', 'one': '{} indice disponible', 'other': '{} indices disponibles'}"></ng-pluralize></li>
<li>Tenté par <ng-pluralize count="themes[my.exercices[s.params.exercice].theme_id].exercices[s.params.exercice].tried" when="{'0': 'aucune équipe', 'one': '{} équipe', 'other': '{} équipes'}"></ng-pluralize></li>
<li ng-if="my.exercices[s.params.exercice].tries">Résolu par <ng-pluralize count="themes[my.exercices[s.params.exercice].theme_id].exercices[s.params.exercice].solved" when="{'0': 'aucune équipe', 'one': '{} équipe', 'other': '{} équipes'}"></ng-pluralize></li>
</ul>
</div>
</div>
<div class="card niceborder bg-dark" ng-if="s.type == 'exercice_follow' && !s.params.hide">
<div class="text-light text-bold text-right" style="position: absolute; z-index: 10; width: 100%; padding: 1rem;">
<span style="background: rgba(50,50,50,0.66); padding: 0.2rem 0.4rem; border-radius: 3px; border-bottom-width: 3px;">
Challenges à la une
</span>
</div>
<div class="card-img-top theme-card" style="background-image: url('{{themes[my.exercices[lastExercice].theme_id].image}}')"></div>
<div class="card-body text-light">
<h3 style="font-size: 1.0rem; text-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap"><em>{{ themes[my.exercices[lastExercice].theme_id].exercices[lastExercice].title }}</em> du thème <em>{{ themes[my.exercices[lastExercice].theme_id].name }}</em></h3>
<p ng-bind-html="my.exercices[lastExercice].overview"></p>
<ul class="list-inline text-muted mr-2 ml-2 mb-1" style="font-size: 0.9rem">
<li><ng-pluralize count="themes[my.exercices[lastExercice].theme_id].exercices[lastExercice].gain" when="{'0': 'aucun point', 'one': '{} point', 'other': '{} points'}"></ng-pluralize></li>
<li ng-if="my.exercices[lastExercice].files"><ng-pluralize count="my.exercices[lastExercice].files.length" when="{'0': 'Aucun fichier', 'one': '{} fichier', 'other': '{} fichiers'}"></ng-pluralize></li>
<li ng-if="my.exercices[lastExercice].hints.length"><ng-pluralize count="my.exercices[lastExercice].hints.length" when="{'0': 'Aucun indice disponible', 'one': '{} indice disponible', 'other': '{} indices disponibles'}"></ng-pluralize></li>
<li>Tenté par <ng-pluralize count="themes[my.exercices[lastExercice].theme_id].exercices[lastExercice].tried" when="{'0': 'aucune équipe', 'one': '{} équipe', 'other': '{} équipes'}"></ng-pluralize></li>
<li ng-if="my.exercices[lastExercice].tries">Résolu par <ng-pluralize count="themes[my.exercices[lastExercice].theme_id].exercices[lastExercice].solved" when="{'0': 'aucune équipe', 'one': '{} équipe', 'other': '{} équipes'}"></ng-pluralize></li>
</ul>
</div>
</div>
<div class="card niceborder bg-dark" ng-if="s.type == 'message' && !s.params.hide">
<div class="card-body text-light">
<h2 class="text-center niceborder ml-1 mr-1" ng-if="s.params.title" ng-bind="s.params.title"></h2>
<p ng-if="s.params.lead" class="lead text-justify" ng-bind="s.params.lead"></p>
<p ng-bind-html="s.params.html" ng-if="s.params.html"></p>
<p ng-if="s.params.text" ng-bind="s.params.text"></p>
</div>
</div>
<div class="card border-{{ s.params.color }} niceborder" ng-if="s.type == 'panel' && !s.params.hide">
<div class="card-header bg-{{ s.params.color }} text-white" style="padding: 0" ng-if="s.params.title">
<h3 style="background: none; margin:0" class="text-center" ng-bind="s.params.title"></h3>
</div>
<div class="card-body" ng-if="s.params.text || s.params.lead">
<h4 ng-if="s.params.lead" class="card-title text-justify" ng-bind="s.params.lead"></h4>
<p class="card-text" ng-bind="s.params.text"></p>
</div>
<div class="card-body" ng-if="s.params.html" ng-bind-html="s.params.html"></div>
</div>
</div>
</div>
<div ng-controller="EventsController" id="eventsList" style="position:fixed;padding-right:10px">
<div ng-repeat="e in events track by e.id" class="swap-animation" ng-cloak>
<div ng-repeat="e in events track by e.id" class="swap-animation" ng-if="!display.hideEvents" ng-cloak>
<div class="card card-sm niceborder" ng-class="e.kind">
<div class="card-header text-right">
<small class="text-muted">{{ e.since | since }}</small>
@ -283,8 +385,19 @@
</div>
</div>
<div ng-controller="CountdownController" style="position: fixed; bottom: 109px; right: 0; width: 33vw; overflow: hidden; padding-top: 25px;" ng-cloak>
<div class="bg-light text-center text-dark" ng-if="time.hours === 0 || time.hours" style="margin-top: -5px; width: inherit; box-shadow: white 0px -10px 15px 0px;">
<div ng-controller="TimerController" ng-init="display.customCountdown.end?init(display.customCountdown.end):initStart()" style="position: fixed; bottom: {{ display.hideCountdown?'109px':'195px' }}; right: 0; width: 33vw; overflow: hidden; padding-top: 25px;" ng-if="display.customCountdown && display.customCountdown.show" ng-cloak>
<div class="bg-light text-center text-dark" style="margin-top: -5px; width: inherit; box-shadow: white 0px -10px 15px 0px;">
<div class="text-center clock" style="font-size: 50px;" ng-if="duration > 0">{{ duration / 60 | time }} <span class="point">:</span> {{ duration % 60 | time }}</div>
<div class="text-center clock" style="font-size: 50px;" ng-if="duration <= 0">00 : 00</div>
<div style="font-size: 18px; margin-top: -15px; text-shadow: 0 0 6px {{ display.customCountdown.shadow}};">
<span ng-if="duration <= 0" ng-bind="display.customCountdown.after"></span>
<span ng-if="duration > 0" ng-bind="display.customCountdown.before"></span>
</div>
</div>
</div>
<div ng-controller="CountdownController" style="position: fixed; bottom: {{ display.hideCarousel?'0':'109px' }}; right: 0; width: 33vw; overflow: hidden; padding-top: 25px;" ng-if="!display.hideCountdown" ng-cloak>
<div class="bg-light text-center text-dark" ng-if="time.hours === 0 || time.hours" style="margin-top: -5px; width: inherit; {{ display.customCountdown?'':'box-shadow: white 0px -10px 15px 0px;' }}">
<div class="clock" ng-class="{expired: time.expired, end: time.end}" style="font-size: 50px">
<span id="hours">{{ time.hours | time }}</span>
<span class="point">:</span>
@ -303,7 +416,7 @@
</div>
</div>
<div style="position: fixed; bottom: 0; right: 0; width: 33vw; height: 110px;" class="bg-dark">
<div style="position: fixed; bottom: 0; right: 0; width: 33vw; height: 110px; {{ display.hideCountdown && !display.customCountdown.show?'box-shadow: white 0px -10px 15px 0px;':'' }}" class="bg-dark" ng-if="!display.hideCarousel">
<div class="carousel slide" id="carousel-logos" data-ride="carousel" data-interval="10500" style="height: inherit">
<div class="carousel-inner" style="height: inherit">
<div class="carousel-item">

View file

@ -1,5 +1,5 @@
angular.module("FICApp", ["ngSanitize", "ngAnimate"])
.controller("EventsController", function($scope, $http, $interval) {
.controller("EventsController", function($scope, $rootScope, $http, $interval) {
$scope.events = [];
var refreshEvents = function() {
// Update times
@ -14,12 +14,27 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
return;
$scope.lasteventsetag = response.headers()["last-modified"];
var lastExercice = undefined;
$scope.events = response.data;
$scope.events.forEach(function(event) {
if (!lastExercice && $scope.themes) {
var res = event.txt.match(/<strong>(\d+)<sup>e<\/sup><\/strong> défi ([^&]+)/);
if (res) {
for (var tid in $scope.themes) {
if ($scope.themes[tid].name == res[2]) {
lastExercice = Object.keys($scope.themes[tid].exercices)[parseInt(res[1])-1];
break;
}
}
}
}
event.time = Date.parse(event.time);
event.since = now - event.time;
event.kind = ["border-" + event.kind, "alert-" + event.kind];
});
$rootScope.lastExercice = lastExercice;
});
}
refreshEvents()
@ -61,7 +76,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
return;
$scope.lastpublicetag = response.headers()["last-modified"];
$scope.scene = response.data;
$scope.display = response.data;
});
}
refreshScene();