Add service scripts for rlyeh

This commit is contained in:
Neale Pickett 2011-02-07 22:38:13 -07:00
parent f11ff7f1d6
commit 33d6e8b322
4 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,4 @@
#! /bin/sh
read IP < ip.txt
ip addr del $IP dev eth0

View File

@ -0,0 +1 @@
10.0.0.28/24

View File

@ -0,0 +1,42 @@
#! /bin/sh
base=${CTF_BASE:-/var/lib/ctf}
read -p "Team password: " -r teamhash
if ! KEY='Too much cheese.' arc4 < $base/teams.txt | grep -q -F -e "$teamhash"; then
echo 'No such team.'
exit
fi
cd $base/rlyeh
if [ -f $teamhash ]; then
now=$(date +%s)
ts=$(stat -c %Y $teamhash)
d=$(expr $now - $ts)
if [ $d -lt 60 ]; then
echo 'You are trying to connect too fast.'
exit
fi
else
echo 0 > $teamhash
fi
read level < $teamhash
(
if ! flock -n 8; then
echo 'Your team is already logged in.'
exit
fi
echo "Your team is on level $level."
echo
if ./rlyeh $level; then
echo "10 points for Gryffindor!"
expr $level + 1 > $teamhash
else
touch $teamhash
fi
) 8<$teamhash

View File

@ -0,0 +1,10 @@
#! /bin/sh -e
exec 2>&1
read IP < ip.txt
ip addr add $IP label eth0:rlyeh dev eth0
dir=/var/lib/ctf/rlyeh
install -o nobody -d $dir
exec setuidgid nobody tcpsvd ${IP#/*} 1928 ./rlyeh-ctf