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
3da031b0
Commit
3da031b0
authored
Mar 05, 2016
by
Antek Grzanka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Submitting flags per task.
parent
7bb44233
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
35 deletions
+74
-35
index.html
service/src/main/resources/assets/index.html
+5
-5
main.css
service/src/main/resources/assets/statics/css/main.css
+12
-0
main.js
service/src/main/resources/assets/statics/js/main.js
+42
-26
task.html
service/src/main/resources/assets/task.html
+15
-4
No files found.
service/src/main/resources/assets/index.html
View file @
3da031b0
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
>
<html
lang=
"en"
ng-app=
"ctfApp"
>
<head>
<head>
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<title>
CTF
</title>
<title>
CTF
</title>
...
@@ -9,22 +9,22 @@
...
@@ -9,22 +9,22 @@
<link
rel=
"stylesheet"
href=
"/page/statics/css/main.css"
>
<link
rel=
"stylesheet"
href=
"/page/statics/css/main.css"
>
</head>
</head>
<nav>
<nav
>
<div
class=
"nav-wrapper container"
>
<div
class=
"nav-wrapper container"
>
<a
href=
"#"
class=
"brand-logo"
>
<a
href=
"#"
class=
"brand-logo"
>
<span
class=
"title"
></span>
<span
class=
"title"
></span>
</a>
</a>
<ul
id=
"nav-mobile"
class=
"right hide-on-med-and-down"
>
<ul
id=
"nav-mobile"
class=
"right hide-on-med-and-down"
>
<li><a
href=
"page#/home"
>
Początek
</a></li>
<li><a
href=
"page#/home"
>
Początek
</a></li>
<li><a
href=
"page#/tasks"
>
Zadania
</a></li>
<li
><a
href=
"page#/tasks"
>
Zadania
</a></li>
<li><a
href=
"page#/scores"
>
Wyniki
</a></li>
<li
><a
href=
"page#/scores"
>
Wyniki
</a></li>
</ul>
</ul>
</div>
</div>
</nav>
</nav>
<body>
<body>
<div
ng-app=
"ctfApp"
class=
"container"
>
<div
class=
"container"
>
<div
ui-view
></div>
<div
ui-view
></div>
</div>
</div>
</body>
</body>
...
...
service/src/main/resources/assets/statics/css/main.css
View file @
3da031b0
...
@@ -78,3 +78,15 @@ p {
...
@@ -78,3 +78,15 @@ p {
-webkit-font-feature-settings
:
'liga'
;
-webkit-font-feature-settings
:
'liga'
;
-webkit-font-smoothing
:
antialiased
;
-webkit-font-smoothing
:
antialiased
;
}
}
.toast-success
{
background-color
:
green
;
color
:
black
;
font-weight
:
bold
;
}
.toast-error
{
background-color
:
red
;
color
:
black
;
font-weight
:
bold
;
}
\ No newline at end of file
service/src/main/resources/assets/statics/js/main.js
View file @
3da031b0
...
@@ -37,22 +37,24 @@
...
@@ -37,22 +37,24 @@
}
}
});
});
app
.
factory
(
'APIProvider'
,
[
'$http'
,
'AppSettings'
,
function
(
$http
,
AppSettings
){
app
.
factory
(
'APIProvider'
,
[
'$http'
,
'AppSettings'
,
function
(
$http
,
AppSettings
){
var
tasks
,
teams
,
scores
;
var
tasks
,
teams
,
scores
;
var
getTasks
=
function
(
callback
){
return
{
getScores
:
function
(){},
getTasks
:
function
(
callback
){
$http
.
get
(
AppSettings
.
apiAddress
+
'/tasks'
).
$http
.
get
(
AppSettings
.
apiAddress
+
'/tasks'
).
success
(
function
(
data
)
{
success
(
function
(
data
)
{
tasks
=
data
;
tasks
=
data
;
if
(
callback
)
callback
(
data
);
if
(
callback
)
callback
(
data
);
});
});
};
},
var
getScores
=
function
(){};
getTaskById
:
function
(
id
,
callback
){
var
getTaskById
=
function
(
id
,
callback
){
var
result
;
var
result
;
if
(
!
tasks
)
{
if
(
!
tasks
)
{
getTasks
(
function
(
data
){
this
.
getTasks
(
function
(
data
){
result
=
getTaskById
(
id
,
callback
)
result
=
this
.
getTaskById
(
id
,
callback
)
}
);
}.
bind
(
this
)
);
}
}
else
{
else
{
result
=
tasks
.
filter
(
function
(
task
){
result
=
tasks
.
filter
(
function
(
task
){
...
@@ -60,14 +62,14 @@
...
@@ -60,14 +62,14 @@
})[
0
];
})[
0
];
}
}
callback
(
result
);
callback
(
result
);
};
},
return
{
submitFlag
:
function
(
flag
){
getScores
:
getScores
,
return
$http
.
post
(
AppSettings
.
apiAddress
+
'/tasks'
,
flag
);
getTasks
:
getTasks
,
}
getTaskById
:
getTaskById
};
};
}]);
}]);
app
.
controller
(
'TasksController'
,
[
'$scope'
,
'$http'
,
'APIProvider'
,
'AppSettings'
,
function
(
$scope
,
$http
,
APIProvider
,
AppSettings
)
{
app
.
controller
(
'TasksController'
,
[
'$scope'
,
'$http'
,
'APIProvider'
,
'AppSettings'
,
function
(
$scope
,
$http
,
APIProvider
,
AppSettings
)
{
$scope
.
apiAddress
=
AppSettings
.
apiAddress
;
$scope
.
apiAddress
=
AppSettings
.
apiAddress
;
APIProvider
.
getTasks
(
function
(
data
){
APIProvider
.
getTasks
(
function
(
data
){
...
@@ -76,7 +78,8 @@
...
@@ -76,7 +78,8 @@
});
});
}]);
}]);
app
.
controller
(
'TaskController'
,
[
'$scope'
,
'$http'
,
'$stateParams'
,
'APIProvider'
,
'AppSettings'
,
function
(
$scope
,
$http
,
$stateParams
,
APIProvider
,
AppSettings
)
{
app
.
controller
(
'TaskController'
,
[
'$scope'
,
'$stateParams'
,
'APIProvider'
,
'AppSettings'
,
function
(
$scope
,
$stateParams
,
APIProvider
,
AppSettings
)
{
$scope
.
submitUnknown
=
false
;
$scope
.
apiAddress
=
AppSettings
.
apiAddress
;
$scope
.
apiAddress
=
AppSettings
.
apiAddress
;
$scope
.
selectedTaskId
=
$stateParams
.
taskLevel
;
$scope
.
selectedTaskId
=
$stateParams
.
taskLevel
;
console
.
log
(
'SELECTED TASK ID'
,
$scope
.
selectedTaskId
);
console
.
log
(
'SELECTED TASK ID'
,
$scope
.
selectedTaskId
);
...
@@ -84,6 +87,19 @@
...
@@ -84,6 +87,19 @@
console
.
log
(
data
);
console
.
log
(
data
);
$scope
.
task
=
data
;
$scope
.
task
=
data
;
});
});
$scope
.
submitFlag
=
function
(){
var
flag
=
$
(
'input#flag-to-submit'
).
val
();
$scope
.
submitUnknown
=
true
;
APIProvider
.
submitFlag
(
flag
).
success
(
function
(){
Materialize
.
toast
(
'Poprawna flaga! :)'
,
5000
,
'toast-success'
);
$scope
.
submitUnknown
=
false
;
}).
error
(
function
(){
console
.
log
(
"Flaga zla!"
);
Materialize
.
toast
(
'Błędna flaga! :('
,
5000
,
'toast-error'
);
$scope
.
submitUnknown
=
false
;
});
};
}]);
}]);
app
.
controller
(
'ScoreboardController'
,
[
'$scope'
,
'$http'
,
'AppSettings'
,
function
(
$scope
,
$http
,
AppSettings
)
{
app
.
controller
(
'ScoreboardController'
,
[
'$scope'
,
'$http'
,
'AppSettings'
,
function
(
$scope
,
$http
,
AppSettings
)
{
...
...
service/src/main/resources/assets/task.html
View file @
3da031b0
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col s12"
>
<div
class=
"col s12"
>
<a
href=
"/page#/tasks"
class=
"breadcrumb"
><i
class=
"fa fa-angle-left"
style=
"margin-right:20px"
></i>
Powrót
</a>
<a
href=
"/page#/tasks"
class=
"breadcrumb"
><i
class=
"fa fa-angle-left"
style=
"margin-right:20px"
></i>
Powrót
</a>
<h1
class=
"left
r
-align"
>
{{task.name}}
</h1>
<h1
class=
"left-align"
>
{{task.name}}
</h1>
</div>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
...
@@ -36,13 +36,24 @@
...
@@ -36,13 +36,24 @@
Nie dodano żadnych flag.
Nie dodano żadnych flag.
</p>
</p>
<button
class=
"btn waves-effect waves-light"
type=
"submit"
name=
"action"
style=
"float:right
"
>
Submit
<button
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>
<i
class=
"material-icons right"
>
send
</i>
</button>
</button>
<div
class=
"input-field"
style=
"overflow:hidden"
>
<div
class=
"preloader-wrapper small active"
style=
"float:right"
ng-if=
"submitUnknown"
>
<input
placeholder=
"Wpisz flagę"
id=
"flag-to-submit"
type=
"text"
class=
"validate"
>
<div
class=
"spinner-layer spinner-green-only"
>
<div
class=
"circle-clipper left"
>
<div
class=
"circle"
></div>
</div><div
class=
"gap-patch"
>
<div
class=
"circle"
></div>
</div><div
class=
"circle-clipper right"
>
<div
class=
"circle"
></div>
</div>
</div>
</div>
<div
class=
"input-field"
style=
"overflow:hidden"
>
<input
placeholder=
"Wpisz flagę"
id=
"flag-to-submit"
type=
"text"
class=
"validate"
>
</div>
</div>
</div>
</div>
...
...
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