moth/mcp/bin/teams.sh

36 lines
565 B
Bash
Raw Normal View History

2010-09-07 17:47:00 -06:00
#! /bin/sh
2010-09-23 23:27:14 -06:00
cd ${CTF_BASE:-/var/lib/ctf}/teams/names
2010-09-23 18:23:00 -06:00
2010-09-07 17:47:00 -06:00
escape () {
sed 's/&/\&amp;/g;s/</\&lt;/g;s/>/\&gt;/g'
}
title='Teams'
cat <<EOF
<!DOCTYPE html>
<html>
<head>
<title>$title</title>
<link rel="stylesheet" href="ctf.css" type="text/css">
</head>
<body>
<h1>$title</h1>
EOF
echo "<table>"
echo "<tr><th>Team Name</th><th>Token</th></tr>"
2010-09-23 23:27:14 -06:00
for i in *; do
2010-09-07 17:47:00 -06:00
echo "<tr><td>"
escape < $i
echo "</td><td><samp>$i</samp></td></tr>"
done
echo "</table>"
cat <<EOF
2010-09-23 18:23:00 -06:00
<p>Use your team's token to claim points.</p>
2010-09-07 17:47:00 -06:00
</body>
</html>
2010-09-23 23:27:14 -06:00
EOF