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:
- value: "sdfg1"
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:
- name: "SQL Injection"
url: "http://google.pl"
......@@ -111,20 +129,3 @@ webTasks:
description: "flaga 22"
- value: "AGH_sdfassfdfgf1"
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;
import com.telephoners.krakyournet.ctf.beans.tasks.Task;
import org.bson.types.ObjectId;
import org.joda.time.Instant;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
......@@ -15,12 +16,14 @@ public class Solution
private Task task;
private Team team;
private Flag flag;
private Instant submitionTime;
public Solution(Team team, Task task, Flag flag)
{
this.team = checkNotNull(team);
this.task = checkNotNull(task);
this.flag = checkNotNull(flag);
this.submitionTime = Instant.now();
}
public Solution()
......@@ -56,4 +59,14 @@ public class Solution
{
this.flag = flag;
}
public Instant getSubmitionTime()
{
return submitionTime;
}
public void setSubmitionTime(Instant submitionTime)
{
this.submitionTime = submitionTime;
}
}
......@@ -21,7 +21,7 @@ import java.util.List;
public class WebTask extends Task
{
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)
{
......@@ -35,7 +35,7 @@ public class WebTask extends Task
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));
}
......
......@@ -34,6 +34,7 @@ public class TasksRepository extends Repository<Task>
public List<Task> getAllPublic()
{
return datastore.createQuery(Task.class)
.order("level")
.retrievedFields(true, DBObjectUtils.getPublicFields(Task.class))
.asList();
}
......
......@@ -70,7 +70,7 @@ public class SolutionsResource
.stream()
.collect(Collectors.toMap(
Team::getName,
team -> solutionsRepository.getCompletedTasks(team)
solutionsRepository::getCompletedTasks
));
}
......@@ -82,7 +82,7 @@ public class SolutionsResource
.stream()
.collect(Collectors.toMap(
Team::getName,
team -> solutionsRepository.getTeamSolutions(team)
solutionsRepository::getTeamSolutions
));
}
......
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.tasks.Task;
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