Commit e13d69bf authored by Antek Grzanka's avatar Antek Grzanka

Merge branch 'master' of gitlab.telemabk.pl:jifwin/CTF

parents ee2a5221 17ce4407
...@@ -89,6 +89,24 @@ textTasks: ...@@ -89,6 +89,24 @@ textTasks:
- value: "sdfg1" - value: "sdfg1"
description: "flaga 2" description: "flaga 2"
- name: "UI"
text: "Znajdz flagi w jułaju"
level: 5
flags:
- value: "KYN2016_TervetullutKotisivuilleni"
description: "Tytuł"
- value: "KYN2016_ToNieprawda"
description: "Poezja"
- value: "KYN2016_EmacsemPrzezSendmaila"
description: "Konsola"
- value: "KYN2016_SzukajDalejAZnajdzieszWiecej"
description: "QR"
- value: "KYN2016_BROWAR"
description: "Rebus"
- value: "KYN2016_RUAHACKER?"
description: "Tunel"
webTasks: webTasks:
- name: "SQL Injection" - name: "SQL Injection"
url: "http://google.pl" url: "http://google.pl"
...@@ -110,21 +128,4 @@ webTasks: ...@@ -110,21 +128,4 @@ webTasks:
- value: "AGH_sffdfdg1f" - value: "AGH_sffdfdg1f"
description: "flaga 22" description: "flaga 22"
- value: "AGH_sdfassfdfgf1" - value: "AGH_sdfassfdfgf1"
description: "flaga 33" description: "flaga 33"
\ No newline at end of file
- name: "UI"
url: "..."
level: 5
flags:
- value: "KYN2016_TervetullutKotisivuilleni"
description: "Tytuł"
- value: "KYN2016_ToNieprawda"
description: "Poezja"
- value: "KYN2016_EmacsemPrzezSendmaila"
description: "Konsola"
- value: "KYN2016_SzukajDalejAZnajdzieszWiecej"
description: "QR"
- value: "KYN2016_BROWAR"
description: "Rebus"
- value: "KYN2016_RUAHACKER?"
description: "Tunel"
...@@ -2,6 +2,7 @@ package com.telephoners.krakyournet.ctf.beans; ...@@ -2,6 +2,7 @@ package com.telephoners.krakyournet.ctf.beans;
import com.telephoners.krakyournet.ctf.beans.tasks.Task; import com.telephoners.krakyournet.ctf.beans.tasks.Task;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.joda.time.Instant;
import org.mongodb.morphia.annotations.Entity; import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id; import org.mongodb.morphia.annotations.Id;
...@@ -15,12 +16,14 @@ public class Solution ...@@ -15,12 +16,14 @@ public class Solution
private Task task; private Task task;
private Team team; private Team team;
private Flag flag; private Flag flag;
private Instant submitionTime;
public Solution(Team team, Task task, Flag flag) public Solution(Team team, Task task, Flag flag)
{ {
this.team = checkNotNull(team); this.team = checkNotNull(team);
this.task = checkNotNull(task); this.task = checkNotNull(task);
this.flag = checkNotNull(flag); this.flag = checkNotNull(flag);
this.submitionTime = Instant.now();
} }
public Solution() public Solution()
...@@ -56,4 +59,14 @@ public class Solution ...@@ -56,4 +59,14 @@ public class Solution
{ {
this.flag = flag; this.flag = flag;
} }
public Instant getSubmitionTime()
{
return submitionTime;
}
public void setSubmitionTime(Instant submitionTime)
{
this.submitionTime = submitionTime;
}
} }
...@@ -21,7 +21,7 @@ import java.util.List; ...@@ -21,7 +21,7 @@ import java.util.List;
public class WebTask extends Task public class WebTask extends Task
{ {
private String url; private String url;
private final Joiner urlJoiner = Joiner.on("/"); private static final Joiner URL_JOINER = Joiner.on("/");
public WebTask(String name, int level, List<Flag> flags, String url) public WebTask(String name, int level, List<Flag> flags, String url)
{ {
...@@ -35,7 +35,7 @@ public class WebTask extends Task ...@@ -35,7 +35,7 @@ public class WebTask extends Task
public String getTextForUser(User user, String path) throws IOException public String getTextForUser(User user, String path) throws IOException
{ {
String url = urlJoiner.join(getUrl(), path); String url = URL_JOINER.join(getUrl(), path);
return StreamUtils.readStream(proxyRequest(url, user)); return StreamUtils.readStream(proxyRequest(url, user));
} }
......
...@@ -34,6 +34,7 @@ public class TasksRepository extends Repository<Task> ...@@ -34,6 +34,7 @@ public class TasksRepository extends Repository<Task>
public List<Task> getAllPublic() public List<Task> getAllPublic()
{ {
return datastore.createQuery(Task.class) return datastore.createQuery(Task.class)
.order("level")
.retrievedFields(true, DBObjectUtils.getPublicFields(Task.class)) .retrievedFields(true, DBObjectUtils.getPublicFields(Task.class))
.asList(); .asList();
} }
......
...@@ -70,7 +70,7 @@ public class SolutionsResource ...@@ -70,7 +70,7 @@ public class SolutionsResource
.stream() .stream()
.collect(Collectors.toMap( .collect(Collectors.toMap(
Team::getName, Team::getName,
team -> solutionsRepository.getCompletedTasks(team) solutionsRepository::getCompletedTasks
)); ));
} }
...@@ -82,7 +82,7 @@ public class SolutionsResource ...@@ -82,7 +82,7 @@ public class SolutionsResource
.stream() .stream()
.collect(Collectors.toMap( .collect(Collectors.toMap(
Team::getName, Team::getName,
team -> solutionsRepository.getTeamSolutions(team) solutionsRepository::getTeamSolutions
)); ));
} }
......
package com.telephoners.krakyournet.ctf.resources; package com.telephoners.krakyournet.ctf.resources;
import com.google.common.base.Joiner;
import com.telephoners.krakyournet.ctf.beans.User; import com.telephoners.krakyournet.ctf.beans.User;
import com.telephoners.krakyournet.ctf.beans.tasks.Task; import com.telephoners.krakyournet.ctf.beans.tasks.Task;
import com.telephoners.krakyournet.ctf.repositories.TasksRepository; import com.telephoners.krakyournet.ctf.repositories.TasksRepository;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment