Skip to content

Commit

Permalink
Ajout de Joutes, Arches, Vallées & Arbalètes
Browse files Browse the repository at this point in the history
  • Loading branch information
SmylerMC committed Jun 13, 2022
1 parent a520529 commit 68c453d
Show file tree
Hide file tree
Showing 182 changed files with 8,063 additions and 0 deletions.
29 changes: 29 additions & 0 deletions JoutesArchesJavaArbaletes/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ghcr.io/google/nsjail/nsjail@sha256:1fa97d29c55f8cecedd03b85d2b42c88cb9c1d5666da66e2058c66a01da85f58

RUN apt-get -y update && apt-get install -y \
openjdk-17-jre-headless \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir /app
WORKDIR /app
COPY challenge/ /app/

EXPOSE 1337

# We need to change rlimit_as (max virtual mem) as the default is not enough for java to start
ENTRYPOINT nsjail -Ml \
--port 1337 \
--user nobody:nobody \
--group nogroup:nogroup \
--cwd /app \
--rlimit_as 7000 \
--hostname localhost \
--max_conns_per_ip 1 \
-R /app \
-R /lib \
-R /lib64 \
-R /usr/lib \
-T /tmp \
--disable_clone_newnet \
--time_limit 600 \
-- /usr/lib/jvm/java-17-openjdk-amd64/bin/java -Dctf404.flag.cjgJF4GCxj2QD5Lg=404CTF{j4v4_3s7_c00l_m41s_zes7_m1euX_Qu4nd_c3z7_z4f3} -jar /app/server.jar
17 changes: 17 additions & 0 deletions JoutesArchesJavaArbaletes/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Joutes, Arches, Vallées & Arbalètes
> Divers, Extrême (1000 points, 5 validations)
## Intitulé
Bonjour agent.

Le groupe Hallebarde semble avoir lancé une campagne de recrutement et vise des scientifiques.

Nous sommes parvenus à identifier une de leur méthodes : ils ont mis au point un jeu vidéo multijoueur en ligne de commande leur permettant de sélectionner les meilleurs éléments. Peut-être sont-ils nostalgiques des années 80. Nous avons identifié une adresse hébergeant une instance de ce serveur de jeu, vous pouvez vous y connecter à l'aide des informations ci-dessous.<br>
Par ailleurs, les renseignements humains ont réussi à mettre la main sur une clef USB contenant de la documentation de ce programme, nous vous la mettons à disposition.

Pouvez-vous investiguer ce service et voir s'il est possible de le compromettre et d'en tirer des informations sensibles ?

Auteur : `Smyler#7078`

## Write-ups
- [Par remy_o](https://remyoudompheng.github.io/ctf/404ctf/java.html)
11 changes: 11 additions & 0 deletions JoutesArchesJavaArbaletes/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Intellij
*.iml
.idea
out

# Maven
target

# Gradle
.gradle
build
17 changes: 17 additions & 0 deletions JoutesArchesJavaArbaletes/api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version = '0.17.2'
description = 'CoolGame API'

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives javadocJar
archives sourcesJar
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.hallebarde.recrutement.api;

import org.hallebarde.recrutement.api.annotations.DoNotImplement;
import org.hallebarde.recrutement.api.commands.CommandExecutor;

/**
* An administration console.
* Usually, this is just the terminal that started the game.
*/
@DoNotImplement
public interface Console extends CommandExecutor {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.hallebarde.recrutement.api;

import org.hallebarde.recrutement.api.annotations.FreeToFire;
import org.hallebarde.recrutement.api.events.CancelableEvent;

@FreeToFire
public class ConsoleInputEvent extends CancelableEvent {

private String text;

public ConsoleInputEvent(String text) {
this.text = text;
}

public String getText() {
return text;
}

public void setText(String text) {
this.text = text;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
package org.hallebarde.recrutement.api;

import org.hallebarde.recrutement.api.annotations.DoNotImplement;
import org.hallebarde.recrutement.api.commands.Command;
import org.hallebarde.recrutement.api.events.Event;
import org.hallebarde.recrutement.api.events.SubscribeEvent;
import org.hallebarde.recrutement.api.gameplay.Item;
import org.hallebarde.recrutement.api.gameplay.Activity;
import org.hallebarde.recrutement.api.gameplay.user.User;
import org.hallebarde.recrutement.api.gameplay.world.RoomInteraction;
import org.hallebarde.recrutement.api.gameplay.world.World;
import org.hallebarde.recrutement.api.storage.Registry;

import java.util.Map;

/**
* The game you will be interacting with.
*/
@DoNotImplement
public interface Game {

/**
* @see #getUsers()
* @see #getUser(String)
*
* @return the number of active users.
*/
int getUserCount();

/**
* Gives access to logged-in users by name.
*
* @see #getUserCount()
* @see #getUsers()
*
* @param name the name of the user to find.
* @return the user, or null if it is not found.
*/
User getUser(String name);

/**
* @see #getUserCount()
* @see #getUser(String)
*
* @return all logged-in users.
*/
User[] getUsers();

/**
* Sends a message to all logged-in players.
*
* @param message a message to send.
*/
void broadcast(String message);

/**
* Registers a command the server can respond to.
*
* @param prefix the prefix this command should be invoked with.
* @param command a command to register.
*
* @throws IllegalStateException in case a command with the same prefix has been registered already.
* @throws NullPointerException if either the command prefix or the command executor is null.
*/
void registerCommand(String prefix, Command command, String description) throws IllegalStateException;

/**
* @return this game's config.
*/
GameConfig getConfig();

/**
* Schedules a task to be run on the main game thread.
* @param task a task to run
*/
void runOnGameLoop(Runnable task);

/**
* Stops the server.
*
* @param message a message to broadcast to players to inform them, or null to send nothing
*/
void stop(String message);

/**
* @return the world this game is running
*/
World getWorld();

/**
* Starts the given activity.
* If any of the users of the given activity already has an activity going, it will be stopped.
*
* @see #startActivityWhenPossible(Activity)
* @see #stopActivity(Activity)
*
* @param activity the activity to start
*
* @throws NullPointerException if activity is null
*/
void startActivityNow(Activity activity);

/**
* Starts the given activity.
* Waits for all users involved to not have an activity in-going.
*
* @see #startActivityNow(Activity)
* @see #stopActivity(Activity)
*
* @param activity the activity to start
*
* @throws NullPointerException if activity is null
*/
void startActivityWhenPossible(Activity activity);

/**
* Stops the given activity.
*
* @see #startActivityNow(Activity)
* @see #startActivityWhenPossible(Activity)
*
* @param activity the activity to stop
*
* @throws NullPointerException if activity is null
* @throws IllegalStateException if the activity is not ongoing
*/
void stopActivity(Activity activity);

/**
* Provides access to the plugins which have been loaded into this game server.
*
* @return an unmodifiable map which associate plugin ids with their instances
*/
Map<String, Plugin> getPlugins();

/**
* Provides access to a plugin's metadata.
*
* @param pluginId the id of the plugin you need the metadata for
* @return the plugin's metadata
*/
PluginMetadata getPluginMetadata(String pluginId);

/**
* Registers an event handler.
* An event handler is an object with at least one method annotated with {@link SubscribeEvent}.
* Such methods are void and consume a single {@link Event} argument.
* They are called when an event of the corresponding type is fired using {@link #fireEvent(Event)}.
*
* @param object the object to register as an event handler
*
* @see Event
* @see #fireEvent(Event)
* @see SubscribeEvent
*/
void registerEventHandler(Object object);

/**
* Fires an {@link Event} that will be propagated to the relevant event subscribing methods.
*
* @param event the event to fire
*
* @return the event that was fired
*
* @see #registerEventHandler(Object)
* @see Event
* @see SubscribeEvent
*/
<E extends Event> E fireEvent(E event);

/**
* @return the state the game is currently in
*/
GameState getState();

/**
* @return the game server console
*/
Console getConsole();

/**
* @return the registry that contains all item types known to this server
*/
Registry<Item> getItemRegistry();

/**
* @return the registry that contains all room interactions known to this server
*/
Registry<RoomInteraction> getRoomInteractionRegistry();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package org.hallebarde.recrutement.api;

import org.hallebarde.recrutement.api.annotations.DoNotImplement;

import java.io.IOException;

/**
* The game's configuration.
*/
@DoNotImplement
public interface GameConfig {

/**
* @return the IP address the game is configured to bind to
*/
String hostname();

/**
* @return the TCP port the game is configured to bind to
*/
int port();

/**
* @return the "message of the day" this game should great users with when they connect
*/
String motd();

/**
* @return the name of the directory the game loads plugins from
*/
String pluginDirectory();

/**
* @return the name of the directory from which to load the world
*/
String worldDirectory();

/**
* @return whether the game runs in debug mode of not
*/
boolean debug();

/**
* Reloads the game's config.
* Beware that some config value are only read when the game starts,
* and changing them afterwards will have no effect.
*
* @throws IOException if reading the configuration failed
*/
void reload() throws IOException;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.hallebarde.recrutement.api;

/**
* The different states the game server can be in.
*/
public enum GameState {
STARTING, RUNNING, STOPPING
}
Loading

0 comments on commit 68c453d

Please sign in to comment.