mirror of https://github.com/dirtbags/moth.git
Verified claim.cgi, puzzled, scoreboard. Looking good.
This commit is contained in:
parent
ffa1ce9271
commit
f021ffd092
|
@ -1,4 +1,4 @@
|
|||
#! /usr/bin/awk -f
|
||||
#! /bin/awk -f
|
||||
|
||||
##
|
||||
##
|
||||
|
|
|
@ -1,28 +1,14 @@
|
|||
#! /bin/sh
|
||||
|
||||
# First argument is seconds between running everything
|
||||
period=${1:-60}
|
||||
|
||||
NEWPOINTS=/var/lib/ctf/points.new
|
||||
fn=$2/$3
|
||||
POINTS=/var/lib/ctf/points.log
|
||||
SCOREBOARD=/var/www/scoreboard.html
|
||||
|
||||
if ! [ -f $SCOREBOARD ]; then
|
||||
/opt/mcp/bin/scoreboard < $POINTS > $SCOREBOARD
|
||||
fi
|
||||
|
||||
while true; do
|
||||
# Collect any new points
|
||||
for fn in $NEWPOINTS/*; do
|
||||
[ -f $fn ] || continue
|
||||
cat $fn >> $POINTS || break
|
||||
rm $fn
|
||||
done
|
||||
|
||||
# Render scoreboard
|
||||
if [ $POINTS -nt $SCOREBOARD ]; then
|
||||
/opt/mcp/bin/scoreboard < $POINTS > $SCOREBOARD.new && mv $SCOREBOARD.new $SCOREBOARD
|
||||
fi
|
||||
|
||||
sleep $period
|
||||
done
|
||||
|
|
|
@ -1,13 +1,37 @@
|
|||
#! /bin/sh
|
||||
#! /bin/sh -e
|
||||
|
||||
exec 2>&1
|
||||
|
||||
install -o ctf -m 0755 -d /var/lib/ctf/points.new
|
||||
install -d /var/lib/ctf
|
||||
|
||||
# Create CTF user
|
||||
touch /etc/group /etc/passwd
|
||||
addgroup -g 56634 nogroup || true
|
||||
adduser -D -S -h /var/lib/ctf -H ctf || true
|
||||
|
||||
NEWDIR=/var/lib/ctf/points.new
|
||||
|
||||
install -d /var/www
|
||||
install -o ctf -m 0755 -d $NEWDIR
|
||||
install -o ctf -m 0755 -d /var/lib/ctf/points.tmp
|
||||
touch /var/lib/ctf/points.log
|
||||
|
||||
# Re-populate teams list for tanks
|
||||
ls $base/teams/names | KEY="Too much cheese." /opt/mcp/bin/arc4 > $www/teams.txt.$$
|
||||
mv $www/teams.txt.$$ $www/teams.txt
|
||||
# Generate preliminary scoreboard
|
||||
if ! [ -f /var/www/scoreboard.html ]; then
|
||||
/opt/mcp/bin/scoreboard < /dev/null > /var/www/scoreboard.html
|
||||
fi
|
||||
|
||||
exec ./pointsd
|
||||
|
||||
if [ -x /sbin/inotifyd ]; then
|
||||
exec /sbin/inotifyd ./pointsd $NEWDIR:y
|
||||
fi
|
||||
|
||||
# Simulate inotifyd
|
||||
cd $NEWDIR
|
||||
while true; do
|
||||
for fn in *; do
|
||||
[ -f "$fn" ] || continue
|
||||
./pointsd m $NEWDIR $fn
|
||||
done
|
||||
sleep 7
|
||||
done
|
||||
|
|
|
@ -2,14 +2,10 @@
|
|||
|
||||
exec 2>&1
|
||||
|
||||
install -d /var/www
|
||||
|
||||
# Install truncates files
|
||||
DB=/var/lib/ctf/puzzles.db
|
||||
|
||||
# Create CTF user
|
||||
touch /etc/group /etc/passwd
|
||||
addgroup -g 56634 nogroup || true
|
||||
adduser -D -S -h /var/lib/ctf -H ctf || true
|
||||
|
||||
mkdir -p /var/lib/ctf /var/www
|
||||
touch $DB
|
||||
chown ctf $DB
|
||||
|
||||
|
|
Loading…
Reference in New Issue