mirror of https://github.com/dirtbags/moth.git
31 lines
748 B
Bash
Executable File
31 lines
748 B
Bash
Executable File
#! /bin/sh -e
|
|
|
|
PATH=/bin:/opt/ctfbase/bin; export PATH
|
|
|
|
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 tokencli $category $dn/category.key 3>&1 | \
|
|
arc4 $dn/enc.key > /var/lib/ctf/tokens/$puzzle
|
|
done
|
|
|
|
# Fetch list of teams
|
|
teams=/var/lib/ctf/teams.txt
|
|
rm -f $teams.tmp
|
|
wget -q -O $teams.tmp http://10.0.0.2/teams.txt && \
|
|
mv $teams.tmp $teams
|
|
|
|
# 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
|