moth/packages/ctfbase/service/ctfd/ctfd

26 lines
651 B
Bash
Executable File

#! /bin/sh
while true; do
# Get new tokens
for dn in /opt/*/tokens/*; do
[ -d $dn ] || continue
puzzle=$(basename $dn)
category=$(cat $dn/category)
busybox nc 10.0.0.2 1 \
-e /opt/tokens/bin/tokencli $category $dn/category.key 3>&1 | \
/opt/tokens/bin/arc4 $dn/enc.key > /var/lib/ctf/tokens/$puzzle
done
# Fetch list of teams
wget -q -P /var/lib/ctf http://10.0.0.2/teams.txt &
# Archive state
state=/var/www/state.tar.gz.rc4
tar cf - /var/lib/ctf | \
gzip -c | \
KEY='crashmaster' arc4 > $state.tmp
mv $state.tmp $state
sleep 60
done