-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# The basic dockerfile that is loaded for each console. | ||
# should take ~1MB per open console. | ||
FROM ubuntu:22.04 | ||
|
||
COPY SETUP.sh SETUP.sh | ||
RUN bash SETUP.sh | ||
RUN rm SETUP.sh | ||
|
||
CMD ["/bin/bash"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
apt update && apt upgrade -y && apt install tmux htop vim -y # install generally helpful packages | ||
cat << EOF > /etc/motd | ||
Hi! You're currently running Ubuntu Linux version 22.04. | ||
Run 'help' for help. | ||
We recommend using the mouse to select, copy, and paste text. | ||
This terminal will close after 5 minutes to save resources. | ||
EOF | ||
printf "\ncat /etc/motd\n# hello!\n" >> /root/.bashrc | ||
|
||
cat << "EOF" >> /root/.bashrc | ||
# custom prompt | ||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | ||
cd "$HOME" | ||
EOF | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# This script is loaded by gotty, and is in charge of starting a jailed and virtualized console. | ||
# This script is loaded by "Dockerfile" | ||
# This script depends on "ChallengeDockerfile" | ||
|
||
CONTAINER_NAME="challenge-shell-$RANDOM" | ||
CONTAINER_TAG="webshell" | ||
TIMEOUT="300" # 300 seconds = 5 minutes | ||
|
||
TIMEOUT="600" # 600 seconds = 10 minutes | ||
# Build image from ChallengeDockerfile | ||
docker build --tag "$CONTAINER_TAG" . | ||
|
||
(sleep "$TIMEOUT" ; echo "Out of time after $TIMEOUT seconds! Refresh to try again." ; docker stop $CONTAINER_NAME)& | ||
clear # clear output | ||
|
||
docker run -m 15M --cpu-quota 3000 --name "$CONTAINER_NAME" -it --rm busybox | ||
(sleep "$TIMEOUT" ; echo "Out of time after $TIMEOUT seconds! Refresh to try again." ; docker stop $CONTAINER_NAME)& | ||
|
||
docker run -m 15M --cpu-quota 3000 --name "$CONTAINER_NAME" -it --rm "$CONTAINER_TAG" | ||
|