#!/bin/sh
# Generate a random hex string and rename the flag file
RANDOM_NAME=$(cat /proc/sys/kernel/random/uuid | tr -d '-')
mv /chroot/home/ctf/flag.txt "/chroot/home/ctf/${RANDOM_NAME}.txt"

exec nsjail --port 1337 \
  --chroot /chroot/ \
  --user 1337 \
  --group 1337 \
  --cwd /home/ctf/ \
  --tmpfsmount /tmp \
  --bindmount_ro /etc/resolv.conf:/etc/resolv.conf \
  --rlimit_as inf \
  /usr/bin/python3 /home/ctf/run.py