crime to Level
This commit is contained in:
78
Dockerfile
78
Dockerfile
@@ -15,28 +15,28 @@ RUN apt-get update \
|
|||||||
|
|
||||||
RUN mkdir -p /var/run/sshd
|
RUN mkdir -p /var/run/sshd
|
||||||
RUN rm -fr /bin/su
|
RUN rm -fr /bin/su
|
||||||
RUN useradd -m -s /bin/bash crime1
|
RUN useradd -m -s /bin/bash level1
|
||||||
RUN useradd -m -s /bin/bash crime2
|
RUN useradd -m -s /bin/bash level2
|
||||||
RUN useradd -m -s /bin/bash crime3
|
RUN useradd -m -s /bin/bash level3
|
||||||
RUN useradd -m -s /bin/bash crime4
|
RUN useradd -m -s /bin/bash level4
|
||||||
RUN useradd -m -s /bin/bash crime5
|
RUN useradd -m -s /bin/bash level5
|
||||||
|
|
||||||
RUN mkdir -p /home/crime1
|
RUN mkdir -p /home/level1
|
||||||
RUN chown -R crime1:crime1 /home/crime1
|
RUN chown -R level1:level1 /home/level1
|
||||||
RUN mkdir -p /home/crime2
|
RUN mkdir -p /home/level2
|
||||||
RUN chown -R crime2:crime2 /home/crime2
|
RUN chown -R level2:level2 /home/level2
|
||||||
RUN mkdir -p /home/crime3
|
RUN mkdir -p /home/level3
|
||||||
RUN chown -R crime3:crime3 /home/crime3
|
RUN chown -R level3:level3 /home/level3
|
||||||
RUN mkdir -p /home/crime4
|
RUN mkdir -p /home/level4
|
||||||
RUN chown -R crime4:crime4 /home/crime4
|
RUN chown -R level4:level4 /home/level4
|
||||||
RUN mkdir -p /home/crime5
|
RUN mkdir -p /home/level5
|
||||||
RUN chown -R crime5:crime5 /home/crime5
|
RUN chown -R level5:level5 /home/level5
|
||||||
|
|
||||||
RUN echo "crime1:crime1" | chpasswd
|
RUN echo "level1:level1" | chpasswd
|
||||||
RUN echo "crime2:&Vs@gSfdC+SPh!{BkBSt=~9{" | chpasswd
|
RUN echo "level2:&Vs@gSfdC+SPh!{BkBSt=~9{" | chpasswd
|
||||||
RUN echo "crime3:CX1bjEG5Hj2bYmFBKe4hfLYFpXBFi2Dv" | chpasswd
|
RUN echo "level3:CX1bjEG5Hj2bYmFBKe4hfLYFpXBFi2Dv" | chpasswd
|
||||||
RUN echo "crime4:vG7kLp9xQ2zW4eR6tY8uI0" | chpasswd
|
RUN echo "level4:vG7kLp9xQ2zW4eR6tY8uI0" | chpasswd
|
||||||
RUN echo "crime5:Qw2e3r4T5z6U7i8O9p0AsD" | chpasswd
|
RUN echo "level5:Qw2e3r4T5z6U7i8O9p0AsD" | chpasswd
|
||||||
|
|
||||||
# SSH
|
# SSH
|
||||||
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
||||||
@@ -46,21 +46,21 @@ RUN sed -i 's/^session.*pam_lastlog.so/#&/' /etc/pam.d/sshd \
|
|||||||
&& sed -i 's/^session.*pam_lastlog.so/#&/' /etc/pam.d/login
|
&& sed -i 's/^session.*pam_lastlog.so/#&/' /etc/pam.d/login
|
||||||
|
|
||||||
# Level1
|
# Level1
|
||||||
COPY /Level/Level1/Chat.txt /home/crime1/.Chats/Chat.txt
|
COPY /Level/Level1/Chat.txt /home/level1/.Chats/Chat.txt
|
||||||
RUN chown crime1:crime1 /home/crime1/.Chats/Chat.txt && chmod 600 /home/crime1/.Chats/Chat.txt
|
RUN chown level1:level1 /home/level1/.Chats/Chat.txt && chmod 600 /home/level1/.Chats/Chat.txt
|
||||||
|
|
||||||
# Level2
|
# Level2
|
||||||
COPY /Level/Level2/data.txt /home/crime2/data.txt
|
COPY /Level/Level2/data.txt /home/level2/data.txt
|
||||||
RUN chown crime2:crime2 /home/crime2/data.txt && chmod 600 /home/crime2/data.txt
|
RUN chown level2:level2 /home/level2/data.txt && chmod 600 /home/level2/data.txt
|
||||||
|
|
||||||
# Level3
|
# Level3
|
||||||
COPY Level/Level3/ /home/crime3/
|
COPY Level/Level3/ /home/level3/
|
||||||
RUN chown -R crime3:crime3 /home/crime3/ && chmod -R 777 /home/crime3/
|
RUN chown -R level3:level3 /home/level3/ && chmod -R 777 /home/level3/
|
||||||
|
|
||||||
|
|
||||||
# Level4
|
# Level4
|
||||||
COPY Level/Level4/ /home/crime4/
|
COPY Level/Level4/ /home/level4/
|
||||||
RUN chown crime4:crime4 /home/crime4/ && chmod -R 777 /home/crime4/
|
RUN chown level4:level4 /home/level4/ && chmod -R 777 /home/level4/
|
||||||
|
|
||||||
# Level5
|
# Level5
|
||||||
COPY Level/Level5/systemd-hdtob.py /usr/local/bin/systemd-hdtob.py
|
COPY Level/Level5/systemd-hdtob.py /usr/local/bin/systemd-hdtob.py
|
||||||
@@ -69,10 +69,10 @@ RUN chmod +x /usr/local/bin/systemd-hdtob.py
|
|||||||
COPY Level/Level5/watchdog.py /root/watchdog.py
|
COPY Level/Level5/watchdog.py /root/watchdog.py
|
||||||
RUN chmod 700 /root/watchdog.py
|
RUN chmod 700 /root/watchdog.py
|
||||||
|
|
||||||
RUN mkdir -p /home/crime5/.timer \
|
RUN mkdir -p /home/level5/.timer \
|
||||||
&& chown crime5:crime5 /home/crime5/.timer
|
&& chown level5:level5 /home/level5/.timer
|
||||||
|
|
||||||
COPY guide/crime5/win-message.sh /usr/local/bin/win-message.sh
|
COPY guide/level5/win-message.sh /usr/local/bin/win-message.sh
|
||||||
RUN chmod +x /usr/local/bin/win-message.sh
|
RUN chmod +x /usr/local/bin/win-message.sh
|
||||||
|
|
||||||
COPY Level/Level5/start_level5.sh /usr/local/bin/start_level5.sh
|
COPY Level/Level5/start_level5.sh /usr/local/bin/start_level5.sh
|
||||||
@@ -81,7 +81,7 @@ RUN chmod +x /usr/local/bin/start_level5.sh
|
|||||||
COPY Level/Level5/login_wrapper.sh /usr/local/bin/login_wrapper.sh
|
COPY Level/Level5/login_wrapper.sh /usr/local/bin/login_wrapper.sh
|
||||||
RUN chmod +x /usr/local/bin/login_wrapper.sh
|
RUN chmod +x /usr/local/bin/login_wrapper.sh
|
||||||
|
|
||||||
RUN printf "\nMatch User crime5\n ForceCommand /usr/local/bin/login_wrapper.sh\n" >> /etc/ssh/sshd_config
|
RUN printf "\nMatch User level5\n ForceCommand /usr/local/bin/login_wrapper.sh\n" >> /etc/ssh/sshd_config
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y bash psmisc
|
RUN apt-get update && apt-get install -y bash psmisc
|
||||||
|
|
||||||
@@ -89,18 +89,18 @@ RUN apt-get update && apt-get install -y bash psmisc
|
|||||||
RUN rm -fr /etc/update-motd.d/*
|
RUN rm -fr /etc/update-motd.d/*
|
||||||
RUN mkdir -p /guide
|
RUN mkdir -p /guide
|
||||||
|
|
||||||
COPY guide/crime1.txt /guide/crime1.txt
|
COPY guide/level1.txt /guide/level1.txt
|
||||||
COPY guide/crime2.txt /guide/crime2.txt
|
COPY guide/level2.txt /guide/level2.txt
|
||||||
COPY guide/crime3.txt /guide/crime3.txt
|
COPY guide/level3.txt /guide/level3.txt
|
||||||
COPY guide/crime4.txt /guide/crime4.txt
|
COPY guide/level4.txt /guide/level4.txt
|
||||||
|
|
||||||
RUN echo 'if [ -f "/guide/$(whoami).txt" ]; then cat "/guide/$(whoami).txt"; fi' >> /etc/bash.bashrc
|
RUN echo 'if [ -f "/guide/$(whoami).txt" ]; then cat "/guide/$(whoami).txt"; fi' >> /etc/bash.bashrc
|
||||||
|
|
||||||
# Level 5 typewriter effect
|
# Level 5 typewriter effect
|
||||||
COPY guide/crime5/typewrite.sh /usr/local/bin/typewrite.sh
|
COPY guide/level5/typewrite.sh /usr/local/bin/typewrite.sh
|
||||||
RUN chmod +x /usr/local/bin/typewrite.sh
|
RUN chmod +x /usr/local/bin/typewrite.sh
|
||||||
RUN echo 'if [ "$(whoami)" = "crime5" ]; then /usr/local/bin/typewrite.sh; fi' >> /home/crime5/.bashrc \
|
RUN echo 'if [ "$(whoami)" = "level5" ]; then /usr/local/bin/typewrite.sh; fi' >> /home/level5/.bashrc \
|
||||||
&& chown crime5:crime5 /home/crime5/.bashrc
|
&& chown level5:level5 /home/level5/.bashrc
|
||||||
|
|
||||||
RUN echo 'export PS1="\u@$(hostname):\\$ "' >> /etc/profile
|
RUN echo 'export PS1="\u@$(hostname):\\$ "' >> /etc/profile
|
||||||
|
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ User1: das geht nicht.
|
|||||||
User2: Ups das war das falsche.
|
User2: Ups das war das falsche.
|
||||||
User2: &Vs@gSfdC+SPh!{BkBSt=~9{
|
User2: &Vs@gSfdC+SPh!{BkBSt=~9{
|
||||||
User1: und was war der Username noch mal?
|
User1: und was war der Username noch mal?
|
||||||
User2: crime2
|
User2: level2
|
||||||
User1: Perfekt! Danke!
|
User1: Perfekt! Danke!
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ ! -f /home/crime5/.timer/started ]; then
|
if [ ! -f /home/level5/.timer/started ]; then
|
||||||
touch /home/crime5/.timer/started
|
touch /home/level5/.timer/started
|
||||||
nohup python3 /usr/local/bin/systemd-hdtob.py >/tmp/timer.log 2>&1 &
|
nohup python3 /usr/local/bin/systemd-hdtob.py >/tmp/timer.log 2>&1 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tty > /home/crime5/.timer/current_tty 2>/dev/null || echo "/dev/pts/0" > /home/crime5/.timer/current_tty
|
tty > /home/level5/.timer/current_tty 2>/dev/null || echo "/dev/pts/0" > /home/level5/.timer/current_tty
|
||||||
chmod 644 /home/crime5/.timer/current_tty
|
chmod 644 /home/level5/.timer/current_tty
|
||||||
|
|
||||||
exec /bin/bash
|
exec /bin/bash
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
USER=$(whoami)
|
USER=$(whoami)
|
||||||
if [ "$USER" = "crime5" ]; then
|
if [ "$USER" = "level5" ]; then
|
||||||
if [ ! -f /home/crime5/.timer/started ]; then
|
if [ ! -f /home/level5/.timer/started ]; then
|
||||||
touch /home/crime5/.timer/started
|
touch /home/level5/.timer/started
|
||||||
nohup python3 /usr/local/bin/systemd-hdtob.py >/tmp/timer.log 2>&1 &
|
nohup python3 /usr/local/bin/systemd-hdtob.py >/tmp/timer.log 2>&1 &
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import os
|
|||||||
import time
|
import time
|
||||||
import pwd
|
import pwd
|
||||||
|
|
||||||
STATE_FILE = "/home/crime5/.timer/timer_state.txt"
|
STATE_FILE = "/home/level5/.timer/timer_state.txt"
|
||||||
END_STATE = "/home/crime5/.timer/end_state.txt"
|
END_STATE = "/home/level5/.timer/end_state.txt"
|
||||||
|
|
||||||
|
|
||||||
def drop_privileges(user):
|
def drop_privileges(user):
|
||||||
@@ -21,7 +21,7 @@ def countdown(seconds):
|
|||||||
f.write(str(remaining))
|
f.write(str(remaining))
|
||||||
|
|
||||||
mins, secs = divmod(remaining, 60)
|
mins, secs = divmod(remaining, 60)
|
||||||
with open("/home/crime5/timer.txt", "w") as f:
|
with open("/home/level5/timer.txt", "w") as f:
|
||||||
f.write(f"{mins:02d}:{secs:02d}")
|
f.write(f"{mins:02d}:{secs:02d}")
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@@ -36,5 +36,5 @@ def countdown(seconds):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
drop_privileges("crime5")
|
drop_privileges("level5")
|
||||||
countdown(600)
|
countdown(600)
|
||||||
|
|||||||
@@ -22,24 +22,24 @@ type_text() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Win message für crime5 mit Typewriter-Effekt
|
# Win message für level5 mit Typewriter-Effekt
|
||||||
WIN_MSG="$(echo -e "\033[1;38;2;255;255;0mHerzlichen Glückwunsch! Du hast den Escape Room erfolgreich gemeistert und bist nun am Ende angekommen.\033[0m")"
|
WIN_MSG="$(echo -e "\033[1;38;2;255;255;0mHerzlichen Glückwunsch! Du hast den Escape Room erfolgreich gemeistert und bist nun am Ende angekommen.\033[0m")"
|
||||||
WIN_MSG2="$(echo -e "\n\033[1;38;2;255;255;128mVielen Dank fürs Spielen!\033[0m")"
|
WIN_MSG2="$(echo -e "\n\033[1;38;2;255;255;128mVielen Dank fürs Spielen!\033[0m")"
|
||||||
|
|
||||||
# TTY von crime5 aus gespeicherter Datei lesen (vom login_wrapper.sh gesetzt)
|
# TTY von level5 aus gespeicherter Datei lesen (vom login_wrapper.sh gesetzt)
|
||||||
CRIME5_TTY=""
|
level5_TTY=""
|
||||||
if [ -f /home/crime5/.timer/current_tty ]; then
|
if [ -f /home/level5/.timer/current_tty ]; then
|
||||||
CRIME5_TTY=$(cat /home/crime5/.timer/current_tty 2>/dev/null | tr -d '\n')
|
level5_TTY=$(cat /home/level5/.timer/current_tty 2>/dev/null | tr -d '\n')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "DEBUG: Gefundenes TTY aus Datei: $CRIME5_TTY" >> /tmp/win-debug.log
|
echo "DEBUG: Gefundenes TTY aus Datei: $level5_TTY" >> /tmp/win-debug.log
|
||||||
|
|
||||||
# Prüfe ob TTY existiert und schreibbar ist
|
# Prüfe ob TTY existiert und schreibbar ist
|
||||||
if [ -n "$CRIME5_TTY" ] && [ -e "$CRIME5_TTY" ] && [ -w "$CRIME5_TTY" ]; then
|
if [ -n "$level5_TTY" ] && [ -e "$level5_TTY" ] && [ -w "$level5_TTY" ]; then
|
||||||
echo "DEBUG: Schreibe an TTY: $CRIME5_TTY" >> /tmp/win-debug.log
|
echo "DEBUG: Schreibe an TTY: $level5_TTY" >> /tmp/win-debug.log
|
||||||
# Typewriter-Effekt direkt an crime5's Terminal
|
# Typewriter-Effekt direkt an level5's Terminal
|
||||||
type_text "$WIN_MSG" 0.02 "$CRIME5_TTY"
|
type_text "$WIN_MSG" 0.02 "$level5_TTY"
|
||||||
type_text "$WIN_MSG2" 0.04 "$CRIME5_TTY"
|
type_text "$WIN_MSG2" 0.04 "$level5_TTY"
|
||||||
else
|
else
|
||||||
echo "DEBUG: TTY nicht gefunden oder nicht schreibbar, versuche Fallback" >> /tmp/win-debug.log
|
echo "DEBUG: TTY nicht gefunden oder nicht schreibbar, versuche Fallback" >> /tmp/win-debug.log
|
||||||
# Fallback: An alle pts schreiben
|
# Fallback: An alle pts schreiben
|
||||||
@@ -53,7 +53,7 @@ else
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Zusätzlich für crime5 in eine Datei schreiben
|
# Zusätzlich für level5 in eine Datei schreiben
|
||||||
echo "$WIN_MSG" > /home/crime5/gewonnen.txt
|
echo "$WIN_MSG" > /home/level5/gewonnen.txt
|
||||||
echo "$WIN_MSG2" >> /home/crime5/gewonnen.txt
|
echo "$WIN_MSG2" >> /home/level5/gewonnen.txt
|
||||||
chown crime5:crime5 /home/crime5/gewonnen.txt 2>/dev/null
|
chown level5:level5 /home/level5/gewonnen.txt 2>/dev/null
|
||||||
Reference in New Issue
Block a user