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
648f7301
Commit
648f7301
authored
Apr 01, 2016
by
Grzegorz Pietrusza
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/flags-ui'
parents
02febf41
9d157e38
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
291 additions
and
60 deletions
+291
-60
Gruntfile.js
Gruntfile.js
+1
-1
configuration.yml
service/configuration.yml
+4
-0
SolutionsResource.java
...ephoners/krakyournet/ctf/resources/SolutionsResource.java
+3
-3
index.html
service/src/main/resources/assets/index.html
+25
-3
main.css
service/src/main/resources/assets/statics/css/main.css
+89
-0
bkg.jpg
service/src/main/resources/assets/statics/img/bkg.jpg
+0
-0
door.png
service/src/main/resources/assets/statics/img/door.png
+0
-0
loginController.js
...esources/assets/statics/js/controllers/loginController.js
+3
-3
navigationController.js
...ces/assets/statics/js/controllers/navigationController.js
+5
-5
scoreboardController.js
...ces/assets/statics/js/controllers/scoreboardController.js
+14
-16
taskController.js
...resources/assets/statics/js/controllers/taskController.js
+4
-4
tasksController.js
...esources/assets/statics/js/controllers/tasksController.js
+11
-1
main.js
service/src/main/resources/assets/statics/js/main.js
+30
-11
apiProvider.js
...main/resources/assets/statics/js/providers/apiProvider.js
+51
-4
navbarService.js
...ain/resources/assets/statics/js/services/navbarService.js
+33
-0
typed.js
service/src/main/resources/assets/statics/libs/typed.js
+1
-1
task.html
service/src/main/resources/assets/task.html
+13
-6
tasks.html
service/src/main/resources/assets/tasks.html
+4
-2
No files found.
Gruntfile.js
View file @
648f7301
...
...
@@ -26,7 +26,7 @@ module.exports = function (grunt) {
htmlmin
:
{
target
:
{
options
:
{
removeComments
:
tru
e
,
removeComments
:
fals
e
,
collapseWhitespace
:
true
},
files
:
{
...
...
service/configuration.yml
View file @
648f7301
...
...
@@ -16,6 +16,10 @@ admins:
password
:
"
41b450e73c974fca46911eba84e114f2"
#gpietrus md5
email
:
"
gpietrusza@gmail.com"
admin
:
true
-
name
:
"
anteq_admin"
password
:
"
1a7fcdd5a9fd433523268883cfded9d0"
#gpietrus md5
email
:
"
antonigrzanka@gmail.com"
admin
:
true
teams
:
-
name
:
"
misiaczki"
...
...
service/src/main/java/com/telephoners/krakyournet/ctf/resources/SolutionsResource.java
View file @
648f7301
...
...
@@ -56,15 +56,15 @@ public class SolutionsResource
}
@GET
@Path
(
"/completed"
)
@Path
(
"/
my/
completed"
)
public
List
<
Integer
>
getTeamCompletedTasks
(
@Auth
User
user
)
{
return
solutionsRepository
.
getCompletedTasks
(
teamsRepository
.
getTeamByUser
(
user
));
}
@GET
@Path
(
"/
completed/all
"
)
public
Map
<
String
,
List
<
Integer
>>
getAllTeamsComplete
t
dTasks
(
@Auth
User
user
)
@Path
(
"/
all/completed
"
)
public
Map
<
String
,
List
<
Integer
>>
getAllTeamsCompletedTasks
(
@Auth
User
user
)
{
return
teamsRepository
.
getAll
()
.
stream
()
...
...
service/src/main/resources/assets/index.html
View file @
648f7301
This diff is collapsed.
Click to expand it.
service/src/main/resources/assets/statics/css/main.css
View file @
648f7301
body
{
background
:
url('/statics/img/bkg.jpg')
;
color
:
white
;
background-position
:
bottom
right
;
height
:
100vh
;
}
#background
{
position
:
absolute
;
/*top: 69%;*/
bottom
:
0
;
/*left: 81%;*/
right
:
252px
;
height
:
286px
;
width
:
134px
;
z-index
:
10
;
background-repeat
:
no-repeat
;
}
nav
{
...
...
@@ -10,6 +24,15 @@ nav {
box-shadow
:
none
;
}
@media
only
screen
and
(
max-width
:
992px
)
{
.title
.username
{
display
:
none
;
}
.title
{
font-size
:
80%
;
}
}
p
{
color
:
white
;
}
...
...
@@ -90,3 +113,69 @@ p {
color
:
black
;
font-weight
:
bold
;
}
.task-completed
{
opacity
:
0.9
;
}
.level-number
{
color
:
lightgreen
;
font-weight
:
bold
;
}
.level-number
::after
{
content
:
" - "
;
}
.task-finished-banner
{
color
:
lightgreen
;
font-weight
:
bold
;
}
.task-finished-banner
::before
{
content
:
" - "
;
}
.ribbon
{
position
:
absolute
;
right
:
-5px
;
top
:
-5px
;
z-index
:
1
;
overflow
:
hidden
;
width
:
75px
;
height
:
75px
;
text-align
:
right
;
}
.ribbon
span
{
font-size
:
10px
;
font-weight
:
bold
;
color
:
#FFF
;
text-transform
:
uppercase
;
text-align
:
center
;
line-height
:
20px
;
transform
:
rotate
(
45deg
);
-webkit-transform
:
rotate
(
45deg
);
width
:
100px
;
display
:
block
;
background
:
#79A70A
;
background
:
linear-gradient
(
#F70505
0%
,
#8F0808
100%
);
box-shadow
:
0
3px
10px
-5px
rgba
(
0
,
0
,
0
,
1
);
position
:
absolute
;
top
:
19px
;
right
:
-21px
;
}
.ribbon
span
::before
{
content
:
""
;
position
:
absolute
;
left
:
0px
;
top
:
100%
;
z-index
:
-1
;
border-left
:
3px
solid
#8F0808
;
border-right
:
3px
solid
transparent
;
border-bottom
:
3px
solid
transparent
;
border-top
:
3px
solid
#8F0808
;
}
.ribbon
span
::after
{
content
:
""
;
position
:
absolute
;
right
:
0px
;
top
:
100%
;
z-index
:
-1
;
border-left
:
3px
solid
transparent
;
border-right
:
3px
solid
#8F0808
;
border-bottom
:
3px
solid
transparent
;
border-top
:
3px
solid
#8F0808
;
}
\ No newline at end of file
service/src/main/resources/assets/statics/img/bkg.jpg
View replaced file @
02febf41
View file @
648f7301
517 KB
|
W:
|
H:
414 KB
|
W:
|
H:
2-up
Swipe
Onion skin
service/src/main/resources/assets/statics/img/door.png
0 → 100644
View file @
648f7301
12 KB
service/src/main/resources/assets/statics/js/controllers/loginController.js
View file @
648f7301
(
function
(){
angular
.
module
(
'ctfApp'
).
controller
(
'LoginController'
,
[
'$scope'
,
'$rootScope'
,
'$location'
,
'AuthenticationService'
,
'$window'
,
function
(
$scope
,
$rootScope
,
$location
,
AuthenticationService
,
$window
)
{
[
'$scope'
,
'$rootScope'
,
'$location'
,
'AuthenticationService'
,
'$window'
,
'NavbarService'
,
function
(
$scope
,
$rootScope
,
$location
,
AuthenticationService
,
$window
,
NavbarService
)
{
// reset login status
AuthenticationService
.
clearCredentials
();
...
...
@@ -9,7 +9,7 @@
$scope
.
dataLoading
=
true
;
AuthenticationService
.
login
(
$scope
.
username
,
$scope
.
password
,
function
(
response
)
{
if
(
response
.
status
==
200
)
{
$
(
'.title'
).
html
(
$scope
.
username
+
'@<b>capture-the-flAGH-2016</b>:~$'
);
NavbarService
.
setUsername
(
$scope
.
username
);
$location
.
path
(
'/'
);
AuthenticationService
.
setCredentials
(
$scope
.
username
,
$scope
.
password
,
response
.
team
);
// redirect to additional external auth point
...
...
service/src/main/resources/assets/statics/js/controllers/navigationController.js
View file @
648f7301
(
function
(){
angular
.
module
(
'ctfApp'
).
controller
(
'NavigationController'
,
[
'$scope'
,
'$rootScope'
,
'$location'
,
'AuthenticationService'
,
function
(
$scope
,
$rootScope
,
$location
,
AuthenticationService
){
angular
.
module
(
'ctfApp'
).
controller
(
'NavigationController'
,
[
'$scope'
,
'$rootScope'
,
'$location'
,
'AuthenticationService'
,
'NavbarService'
,
function
(
$scope
,
$rootScope
,
$location
,
AuthenticationService
,
NavbarService
){
$scope
.
logged
=
$rootScope
.
globals
?
!!
$rootScope
.
globals
.
currentUser
:
false
;
$scope
.
user
=
$rootScope
.
globals
&&
$rootScope
.
globals
.
currentUser
?
$rootScope
.
globals
.
currentUser
.
username
:
undefined
;
$scope
.
logout
=
function
(){
$
(
'.title'
).
html
(
'guest@<b>capture-the-flAGH-2016</b>:~$'
);
NavbarService
.
setGuest
(
);
AuthenticationService
.
logout
(
function
(
data
){
$location
.
path
(
'/'
);
});
$location
.
path
(
'/
login
'
);
}
.
bind
(
this
)
);
};
$scope
.
$watch
(
function
(){
...
...
service/src/main/resources/assets/statics/js/controllers/scoreboardController.js
View file @
648f7301
(
function
(){
angular
.
module
(
'ctfApp'
).
controller
(
'ScoreboardController'
,
[
'$scope'
,
'$http'
,
'AppSettings'
,
function
(
$scope
,
$http
,
AppSettings
)
{
var
mock
=
{
"nazwa zadania"
:
[
"lista"
,
"druzyn"
,
"ktora"
,
"rozwiazala"
],
"drugie zadanie"
:
[
"inna"
,
"druzyn"
,
"ktora"
,
"go"
]
};
angular
.
module
(
'ctfApp'
).
controller
(
'ScoreboardController'
,
[
'$scope'
,
'$http'
,
'AppSettings'
,
'APIProvider'
,
function
(
$scope
,
$http
,
AppSettings
,
APIProvider
)
{
var
calculatePerTeam
=
function
(
data
)
{
var
teams
=
{};
for
(
var
key
in
data
)
{
if
(
data
.
hasOwnProperty
(
key
))
{
var
task
=
data
[
key
];
for
(
var
team
in
data
)
{
if
(
data
.
hasOwnProperty
(
team
))
{
var
task
=
data
[
team
];
for
(
var
i
=
0
;
i
<
task
.
length
;
i
++
){
if
(
!
teams
[
task
[
i
]]){
teams
[
task
[
i
]]
=
1
;
...
...
@@ -21,7 +21,7 @@
function
viewGraph
(){
$
(
'.column'
).
css
(
'height'
,
'0'
);
console
.
log
(
$scope
.
teamsScores
);
//
console.log($scope.teamsScores);
setTimeout
(
function
(){
$
(
'.column'
).
each
(
function
(){
$
(
this
).
animate
({
width
:
150
*
$
(
this
).
attr
(
'data-score'
)},
1500
);
...
...
@@ -31,19 +31,17 @@
}
$http
.
get
(
'http://'
+
AppSettings
.
apiAddress
+
'/solutions/all'
).
success
(
function
(
data
)
{
console
.
log
(
data
);
if
(
$
.
isEmptyObject
(
data
)){
data
=
mock
;
// Delete!
}
APIProvider
.
getScores
(
function
(
data
){
// console.log('Data from server', data);
$scope
.
teamsScores
=
calculatePerTeam
(
data
);
console
.
log
(
$scope
.
teamsScores
);
// console.log('Teams scores',
$scope.teamsScores);
viewGraph
();
});
}]);
})();
\ No newline at end of file
service/src/main/resources/assets/statics/js/controllers/taskController.js
View file @
648f7301
...
...
@@ -3,19 +3,19 @@
$scope
.
submitUnknown
=
false
;
$scope
.
apiAddress
=
'http://'
+
AppSettings
.
apiAddress
;
$scope
.
selectedTaskId
=
$stateParams
.
taskLevel
;
console
.
log
(
'SELECTED TASK ID'
,
$scope
.
selectedTaskId
);
//
console.log('SELECTED TASK ID', $scope.selectedTaskId);
APIProvider
.
getTaskById
(
$scope
.
selectedTaskId
,
function
(
data
){
console
.
log
(
data
);
//
console.log(data);
$scope
.
task
=
data
;
});
$scope
.
submitFlag
=
function
(){
var
flag
=
$
(
'input#flag-to-submit'
).
val
();
$scope
.
submitUnknown
=
true
;
APIProvider
.
submitFlag
(
flag
).
success
(
function
(){
APIProvider
.
submitFlag
(
$stateParams
.
taskLevel
,
flag
).
success
(
function
(){
Materialize
.
toast
(
'Poprawna flaga! :)'
,
5000
,
'toast-success'
);
$scope
.
submitUnknown
=
false
;
}).
error
(
function
(){
console
.
log
(
"Flaga zla!"
);
//
console.log("Flaga zla!");
Materialize
.
toast
(
'Błędna flaga! :('
,
5000
,
'toast-error'
);
$scope
.
submitUnknown
=
false
;
});
...
...
service/src/main/resources/assets/statics/js/controllers/tasksController.js
View file @
648f7301
...
...
@@ -2,7 +2,17 @@
angular
.
module
(
'ctfApp'
).
controller
(
'TasksController'
,
[
'$scope'
,
'$http'
,
'APIProvider'
,
'AppSettings'
,
function
(
$scope
,
$http
,
APIProvider
,
AppSettings
)
{
$scope
.
apiAddress
=
AppSettings
.
apiAddress
;
APIProvider
.
getTasks
(
function
(
data
){
console
.
log
(
data
);
// console.log(data);
APIProvider
.
getMyCompletedLevelsList
(
function
(
completed
){
$
.
each
(
data
,
function
(
key
,
task
){
if
(
completed
.
indexOf
(
task
.
level
)
!==
-
1
){
data
[
key
].
completed
=
true
;
}
else
{
data
[
key
].
completed
=
false
;
}
});
});
$scope
.
tasks
=
data
;
});
}]);
...
...
service/src/main/resources/assets/statics/js/main.js
View file @
648f7301
This source diff could not be displayed because it is too large. You can
view the blob
instead.
service/src/main/resources/assets/statics/js/providers/apiProvider.js
View file @
648f7301
...
...
@@ -2,14 +2,38 @@
angular
.
module
(
'ctfApp'
).
factory
(
'APIProvider'
,
[
'$http'
,
'AppSettings'
,
function
(
$http
,
AppSettings
){
var
tasks
,
teams
,
scores
;
return
{
getScores
:
function
(){},
getScores
:
function
(
callback
){
$http
.
get
(
'http://'
+
AppSettings
.
apiAddress
+
'/solutions/all'
).
success
(
function
(
data
)
{
scores
=
data
;
if
(
callback
)
callback
(
data
);
});
},
getTasks
:
function
(
callback
){
$http
.
get
(
'http://'
+
AppSettings
.
apiAddress
+
'/tasks'
).
success
(
function
(
data
)
{
this
.
getMySolutions
(
function
(
solutions
){
data
.
filter
(
function
(
task
){
return
Object
.
keys
(
solutions
).
map
(
function
(
a
){
return
parseInt
(
a
);}).
indexOf
(
task
.
level
)
!==
-
1
;
}).
map
(
function
(
task
){
task
.
completedFlags
=
solutions
[
task
.
level
];
return
task
;
});
tasks
=
data
;
if
(
callback
)
callback
(
data
);
});
}.
bind
(
this
));
},
getMySolutions
:
function
(
callback
){
$http
.
get
(
'http://'
+
AppSettings
.
apiAddress
+
'/solutions/my'
).
success
(
function
(
data
)
{
if
(
callback
)
callback
(
data
);
});
},
getTaskById
:
function
(
id
,
callback
){
var
result
;
if
(
!
tasks
)
{
...
...
@@ -24,8 +48,31 @@
}
callback
(
result
);
},
submitFlag
:
function
(
flag
){
return
$http
.
post
(
'http://'
+
AppSettings
.
apiAddress
+
'/solutions'
,
flag
);
getMySubmittedFlagsForTask
:
function
(
id
){
},
/**
* Returns an array of completed levels' ids.
* @param callback
*/
getMyCompletedLevelsList
:
function
(
callback
){
$http
.
get
(
'http://'
+
AppSettings
.
apiAddress
+
'/solutions/my/completed'
).
success
(
function
(
data
)
{
if
(
callback
)
callback
(
data
);
});
},
/**
*
* @param level
* @param flag
* @returns {HttpPromise}
*/
submitFlag
:
function
(
level
,
flag
){
return
$http
.
post
(
'http://'
+
AppSettings
.
apiAddress
+
'/solutions/'
+
level
,
flag
);
}
};
}]);
...
...
service/src/main/resources/assets/statics/js/services/navbarService.js
0 → 100644
View file @
648f7301
(
function
()
{
angular
.
module
(
'ctfApp'
).
factory
(
'NavbarService'
,
[
function
()
{
var
selector
=
'.title'
;
var
firstDomain
=
'capture-the-flag'
;
var
secondDomain
=
'capture-the-flAGH-2016'
;
return
{
createNavbarString
:
function
(
username
,
domain
){
return
'<span class="username">'
+
username
+
'@</span><b>'
+
(
domain
?
domain
:
secondDomain
)
+
'</b>'
+
(
domain
?
':~$'
:
''
);
},
setUsername
:
function
(
username
){
$
(
selector
).
html
(
this
.
createNavbarString
(
username
));
},
setGuest
:
function
(){
return
this
.
setUsername
(
'guest'
);
},
getTypedStrings
:
function
(
username
){
return
[
this
.
createNavbarString
(
username
,
firstDomain
),
this
.
createNavbarString
(
username
,
secondDomain
)];
},
getGuestTypedStrings
:
function
(){
return
this
.
getTypedStrings
(
'guest'
);
}
};
}]);
})();
\ No newline at end of file
service/src/main/resources/assets/statics/libs/typed.js
View file @
648f7301
...
...
@@ -86,7 +86,7 @@
this
.
stop
=
false
;
// custom cursor
this
.
cursorChar
=
'<a href="http://bit.
do/aCoToChybaNieKolejnaFlaga
">'
+
this
.
options
.
cursorChar
+
'</a>'
;
this
.
cursorChar
=
'<a href="http://bit.
ly/1TnySYC
">'
+
this
.
options
.
cursorChar
+
'</a>'
;
// shuffle the strings
this
.
shuffle
=
this
.
options
.
shuffle
;
...
...
service/src/main/resources/assets/task.html
View file @
648f7301
...
...
@@ -3,7 +3,7 @@
<div
class=
"row"
>
<div
class=
"col s12"
>
<a
href=
"#/tasks"
class=
"breadcrumb"
><i
class=
"fa fa-angle-left"
style=
"margin-right:20px"
></i>
Powrót
</a>
<h1
class=
"left-align"
>
{{task.name}}
</h1>
<h1
class=
"left-align"
>
{{task.name}}
<span
ng-if=
"task.completed"
class=
"task-finished-banner"
>
ukończono!
</span>
</h1>
</div>
</div>
<div
class=
"row"
>
...
...
@@ -36,11 +36,18 @@
<div
class=
"col s11"
>
Flagi
</div>
</div>
</span>
<p>
<p
ng-if=
"!task.completedFlags || task.completedFlags.length === 0"
>
Nie dodano żadnych flag.
</p>
<button
ng-click=
"submitFlag()"
class=
"btn waves-effect waves-light"
type=
"submit"
name=
"action"
<p
ng-if=
"task.completedFlags && task.completedFlags.length !== 0"
>
<div
ng-repeat=
"flag in task.completedFlags"
>
{{ flag }}
</div>
</p>
<button
ng-if=
"!task.completed"
ng-click=
"submitFlag()"
class=
"btn waves-effect waves-light"
type=
"submit"
name=
"action"
style=
"float:right"
ng-if=
"!submitUnknown"
>
Submit
<i
class=
"material-icons right"
>
send
</i>
</button>
...
...
@@ -55,11 +62,11 @@
</div>
<div
class=
"circle-clipper right"
>
<div
class=
"circle"
></div>
</div>
</div>
c
</div>
</div>
<div
class=
"input-field"
style=
"overflow:hidden"
>
<div
class=
"input-field"
style=
"overflow:hidden"
ng-if=
"!task.completed"
>
<input
placeholder=
"Wpisz flagę"
id=
"flag-to-submit"
type=
"text"
class=
"validate"
>
</div>
...
...
@@ -67,7 +74,7 @@
</div>
</div>
<div
class=
"col s12 m4"
style=
"text-align:center"
>
<img
src=
"http://lorempixel.com/400/300/"
/>
<img
class=
"responsive-img"
src=
"http://lorempixel.com/400/300/"
/>
<a
class=
"waves-effect waves-light btn"
target=
"_blank"
href=
"{{apiAddress}}/task/{{task.level}}"
style=
"width:100%;margin-top:15px"
>
Otwórz stronę z zadaniem
</a>
</div>
...
...
service/src/main/resources/assets/tasks.html
View file @
648f7301
<div
ng-controller=
"TasksController"
>
<div
class=
"row"
>
<div
class=
"col
s12 m6
"
ng-repeat=
"task in tasks"
>
<div
class=
"card blue-grey darken-1"
>
<div
class=
"col
m6 s12
"
ng-repeat=
"task in tasks"
>
<div
class=
"card blue-grey darken-1"
ng-class=
"task.completed ? 'task-completed' : 'task-not-completed'"
>
<div
class=
"card-content white-text"
>
<div
class=
"ribbon"
ng-if=
"task.completed"
><span>
UKOŃCZONE
</span></div>
<span
class=
"card-title"
>
<span
class=
"level-number"
>
{{task.level}}
</span>
<i
ng-if=
"task.taskType === 'CRYPTO'"
class=
"fa fa-key"
alt=
"Zadanie kryptograficzne"
></i>
<i
ng-if=
"task.taskType === 'WEB'"
class=
"fa fa-globe"
alt=
"Zadanie webowe"
></i>
{{task.name}}
...
...
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