Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
CTF
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grzegorz
CTF
Commits
049e790d
Commit
049e790d
authored
Apr 12, 2016
by
Dominik Rosiek
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.telemabk.pl:jifwin/CTF
parents
d44e9ca7
3dd5edae
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
13 deletions
+18
-13
Flag.java
...main/java/com/telephoners/krakyournet/ctf/beans/Flag.java
+3
-3
SolutionsRepository.java
...ers/krakyournet/ctf/repositories/SolutionsRepository.java
+5
-3
scoreboardController.js
...ces/assets/statics/js/controllers/scoreboardController.js
+7
-4
taskController.js
...resources/assets/statics/js/controllers/taskController.js
+1
-1
apiProvider.js
...main/resources/assets/statics/js/providers/apiProvider.js
+1
-1
task.html
service/src/main/resources/assets/task.html
+1
-1
No files found.
service/src/main/java/com/telephoners/krakyournet/ctf/beans/Flag.java
View file @
049e790d
package
com
.
telephoners
.
krakyournet
.
ctf
.
beans
;
import
com.fasterxml.jackson.annotation.Json
Ignore
;
import
com.fasterxml.jackson.annotation.Json
Property
;
public
class
Flag
{
private
String
value
;
...
...
@@ -16,12 +16,12 @@ public class Flag {
this
.
points
=
points
;
}
// @JsonIgnore //TODO!!
@JsonProperty
(
access
=
JsonProperty
.
Access
.
WRITE_ONLY
)
public
String
getValue
()
{
return
value
;
}
// @JsonIgnore //TODO!!
@JsonProperty
(
access
=
JsonProperty
.
Access
.
WRITE_ONLY
)
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
...
...
service/src/main/java/com/telephoners/krakyournet/ctf/repositories/SolutionsRepository.java
View file @
049e790d
...
...
@@ -52,9 +52,11 @@ public class SolutionsRepository extends Repository<Solution>
private
boolean
isAlreadySubmittedSolution
(
Solution
solution
)
{
return
!
datastore
.
find
(
Solution
.
class
)
.
filter
(
"flag.value"
,
solution
.
getFlag
().
getValue
())
.
asList
()
List
<
Solution
>
solutions
=
datastore
.
find
(
Solution
.
class
)
.
filter
(
"flag.value"
,
solution
.
getFlag
().
getValue
())
//todo: do not filter by field
.
filter
(
"team.name"
,
solution
.
getTeam
().
getName
())
//todo: whole object instead
.
asList
();
return
!
solutions
.
isEmpty
();
}
...
...
service/src/main/resources/assets/statics/js/controllers/scoreboardController.js
View file @
049e790d
...
...
@@ -3,12 +3,14 @@
var
calculatePerTeam
=
function
(
data
)
{
var
teams
=
{};
console
.
log
(
"data"
,
data
);
for
(
var
team
in
data
)
{
if
(
data
.
hasOwnProperty
(
team
))
{
teams
[
team
]
=
0
;
for
(
var
level
in
data
[
team
]){
if
(
data
[
team
].
hasOwnProperty
(
level
)){
teams
[
team
]
+=
data
[
team
][
level
].
length
;
var
score
=
data
[
team
][
level
].
map
(
function
(
o
){
return
o
.
points
;}).
reduce
(
function
(
a
,
b
){
return
a
+
b
;});
teams
[
team
]
+=
score
;
}
}
}
...
...
@@ -16,12 +18,12 @@
return
teams
;
};
function
viewGraph
(){
function
viewGraph
(
maxValue
){
$
(
'.column'
).
css
(
'height'
,
'0'
);
// console.log($scope.teamsScores);
setTimeout
(
function
(){
$
(
'.column'
).
each
(
function
(){
$
(
this
).
animate
({
width
:
150
*
$
(
this
).
attr
(
'data-score'
)
},
1500
);
$
(
this
).
animate
({
width
:
(
100
*
(
parseFloat
(
$
(
this
).
attr
(
'data-score'
))
/
maxValue
)).
toString
()
+
'%'
},
1500
);
});
}
);
...
...
@@ -32,7 +34,8 @@
// console.log('Data from server', data);
$scope
.
teamsScores
=
calculatePerTeam
(
data
);
// console.log('Teams scores', $scope.teamsScores);
viewGraph
();
var
maxValue
=
Math
.
max
.
apply
(
null
,
$
.
map
(
$scope
.
teamsScores
,
function
(
v
,
k
){
return
v
;}));
viewGraph
(
maxValue
);
});
...
...
service/src/main/resources/assets/statics/js/controllers/taskController.js
View file @
049e790d
...
...
@@ -16,7 +16,7 @@
if
(
!
$scope
.
task
.
completedFlags
){
$scope
.
task
.
completedFlags
=
[];
}
$scope
.
task
.
completedFlags
.
push
(
data
.
description
);
$scope
.
task
.
completedFlags
.
push
(
data
);
$scope
.
submitUnknown
=
false
;
$flag
.
val
(
''
);
}).
error
(
function
(){
...
...
service/src/main/resources/assets/statics/js/providers/apiProvider.js
View file @
049e790d
...
...
@@ -88,7 +88,7 @@
if
(
!
task
.
completedFlags
){
task
.
completedFlags
=
[];
}
task
.
completedFlags
.
push
(
data
.
description
);
task
.
completedFlags
.
push
(
data
);
}
});
}.
bind
(
this
));
...
...
service/src/main/resources/assets/task.html
View file @
049e790d
...
...
@@ -39,7 +39,7 @@
<p
ng-if=
"task.completedFlags && task.completedFlags.length !== 0"
>
<div
ng-repeat=
"flag in task.completedFlags"
>
{{ flag
}}
{{ flag
.description }} ({{ flag.points }} pkt)
</div>
</p>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment