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
e13e5810
Commit
e13e5810
authored
Mar 20, 2016
by
Grzegorz Pietrusza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checking if not already subbmited flag - fixed
parent
2b5924d5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
Solution.java
.../java/com/telephoners/krakyournet/ctf/beans/Solution.java
+13
-1
SolutionsRepository.java
...ers/krakyournet/ctf/repositories/SolutionsRepository.java
+1
-0
TasksRepository.java
...phoners/krakyournet/ctf/repositories/TasksRepository.java
+2
-1
No files found.
service/src/main/java/com/telephoners/krakyournet/ctf/beans/Solution.java
View file @
e13e5810
...
...
@@ -13,12 +13,14 @@ public class Solution
private
Task
task
;
private
Team
team
;
private
Flag
flag
;
private
String
hashValue
;
public
Solution
(
Team
team
,
Task
task
,
Flag
flag
)
public
Solution
(
Team
team
,
Task
task
,
Flag
flag
,
String
hashValue
)
{
this
.
team
=
team
;
this
.
task
=
task
;
this
.
flag
=
flag
;
this
.
hashValue
=
hashValue
;
}
public
Solution
()
...
...
@@ -54,4 +56,14 @@ public class Solution
{
this
.
flag
=
flag
;
}
public
String
getHashValue
()
{
return
hashValue
;
}
public
void
setHashValue
(
String
hashValue
)
{
this
.
hashValue
=
hashValue
;
}
}
service/src/main/java/com/telephoners/krakyournet/ctf/repositories/SolutionsRepository.java
View file @
e13e5810
...
...
@@ -77,6 +77,7 @@ public class SolutionsRepository implements Repository
@Override
public
boolean
test
(
Solution
solution
)
{
//todo: compare flags, not flag values
return
solution
.
getFlag
().
getValue
().
equals
(
value
);
}
})
...
...
service/src/main/java/com/telephoners/krakyournet/ctf/repositories/TasksRepository.java
View file @
e13e5810
...
...
@@ -166,10 +166,11 @@ public class TasksRepository implements Repository
Pair
<
Task
,
Flag
>
taskFlagPair
=
taskFlagPairOptional
.
get
();
Task
task
=
taskFlagPair
.
getKey
();
Flag
flag
=
taskFlagPair
.
getValue
();
Optional
<
Team
>
team
=
teamsRepository
.
getTeamByUser
(
user
);
if
(
team
.
isPresent
())
{
//todo: combine ifs
Solution
solution
=
new
Solution
(
team
.
get
(),
task
,
hashValue
);
//todo: conflict, solution stores task flag, should store hashValue!!
Solution
solution
=
new
Solution
(
team
.
get
(),
task
,
flag
,
hashValue
);
if
(!
isAlreadySubmittedSolution
(
solution
))
{
solutionsRepository
.
add
(
solution
);
return
true
;
...
...
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