mirror of https://github.com/dirtbags/moth.git
Fix more known problems
This commit is contained in:
parent
13c16e369b
commit
d6b5689183
|
@ -1,4 +1,3 @@
|
||||||
* claim.cgi not exiting
|
* claim.cgi not exiting (maybe fixed?)
|
||||||
* someone managed to get a point in no category. that broke the scoreboard.
|
|
||||||
* get LAUR for contest
|
* get LAUR for contest
|
||||||
* steg point values
|
* steg point values
|
||||||
|
|
|
@ -18,25 +18,21 @@ www=${CTF_BASE:-/var/www}
|
||||||
mkdir -p $base/teams/names
|
mkdir -p $base/teams/names
|
||||||
mkdir -p $base/teams/colors
|
mkdir -p $base/teams/colors
|
||||||
|
|
||||||
# Assign a color. I spent two days selecting this color pallette for
|
# Assign a color. I spent weeks selecting a color pallette that
|
||||||
# people with protanopia. Please don't change these colors.
|
# wouldn't be hell on people with protanopia. Please don't change these
|
||||||
|
# colors.
|
||||||
nteams=$(ls $base/teams/names/ | wc -l)
|
nteams=$(ls $base/teams/names/ | wc -l)
|
||||||
case $(expr $nteams % 15) in
|
case $(expr $nteams % 10) in
|
||||||
0) color=8c7a69 ;;
|
0) color=a6cee3;;
|
||||||
1) color=7f7062 ;;
|
1) color=1f78b4;;
|
||||||
2) color=79614b ;;
|
2) color=b2df8a;;
|
||||||
3) color=a59281 ;;
|
3) color=33a02c;;
|
||||||
4) color=a59485 ;;
|
4) color=fb9a99;;
|
||||||
5) color=4a4f5e ;;
|
5) color=e31a1c;;
|
||||||
6) color=454955 ;;
|
6) color=fdbf6f;;
|
||||||
7) color=343c52 ;;
|
7) color=ff7f00;;
|
||||||
8) color=696f82 ;;
|
8) color=cab2d6;;
|
||||||
9) color=6b7182 ;;
|
9) color=6a3d9a;;
|
||||||
10) color=516b55 ;;
|
|
||||||
11) color=4b614f ;;
|
|
||||||
12) color=395d3f ;;
|
|
||||||
13) color=6d8c72 ;;
|
|
||||||
14) color=708c75 ;;
|
|
||||||
*)
|
*)
|
||||||
echo 'ERROR ERROR' 1>&2
|
echo 'ERROR ERROR' 1>&2
|
||||||
echo 'DOES NOT COMPUTE' 1>&2
|
echo 'DOES NOT COMPUTE' 1>&2
|
||||||
|
@ -47,12 +43,9 @@ esac
|
||||||
# Compute hash of team name; they'll use this for everything in the
|
# Compute hash of team name; they'll use this for everything in the
|
||||||
# contest instead of their team name, which makes stuff much easier on
|
# contest instead of their team name, which makes stuff much easier on
|
||||||
# me since all team hashes are in the set /[0-9a-f]{8}/.
|
# me since all team hashes are in the set /[0-9a-f]{8}/.
|
||||||
hash=$(echo "$1" | md5sum | cut -b 1-8)
|
hash=$(echo "not a nonce:::$1" | md5sum | cut -b 1-8)
|
||||||
|
|
||||||
echo "$1" > $base/teams/names/$hash
|
echo "$1" > $base/teams/names/$hash
|
||||||
echo "$color" > $base/teams/colors/$hash
|
echo "$color" > $base/teams/colors/$hash
|
||||||
|
|
||||||
echo "Registered with hash: $hash"
|
echo "Registered with hash: $hash"
|
||||||
|
|
||||||
# Write teams.html if it's an actual contest
|
|
||||||
$(dirname $0)/teams.sh > $www/teams.html.new && mv $www/teams.html.new $www/teams.html
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ BEGIN {
|
||||||
interval = 150
|
interval = 150
|
||||||
tslen = 0
|
tslen = 0
|
||||||
|
|
||||||
|
nteams = 0;
|
||||||
while (1 == getline) {
|
while (1 == getline) {
|
||||||
time = $1
|
time = $1
|
||||||
team = $2
|
team = $2
|
||||||
|
@ -92,7 +93,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
lasttime = time
|
lasttime = time
|
||||||
|
|
||||||
teams[team] = team
|
teams[team] = nteams++
|
||||||
points_by_cat[cat] += points
|
points_by_cat[cat] += points
|
||||||
points_by_cat_team[cat, team] += points
|
points_by_cat_team[cat, team] += points
|
||||||
}
|
}
|
||||||
|
@ -111,7 +112,7 @@ BEGIN {
|
||||||
|
|
||||||
cmd = sprintf("cat %s/teams/names/%s", base, team)
|
cmd = sprintf("cat %s/teams/names/%s", base, team)
|
||||||
cmd | getline name
|
cmd | getline name
|
||||||
if (! name) name = team
|
if (! name) name = "Avengers"
|
||||||
names_by_team[team] = name
|
names_by_team[team] = name
|
||||||
close(cmd)
|
close(cmd)
|
||||||
}
|
}
|
||||||
|
@ -146,7 +147,7 @@ BEGIN {
|
||||||
c = 0
|
c = 0
|
||||||
for (team in teams) {
|
for (team in teams) {
|
||||||
if (maxscores_by_team[team] / maxscore < 0.01) continue
|
if (maxscores_by_team[team] / maxscore < 0.01) continue
|
||||||
printf(" \"%s\": [\"#%s\",[", team, colors_by_team[team])
|
printf(" \"%s\": [\"#%s\",[", teams[team], colors_by_team[team])
|
||||||
for (i = 1; i < tslen; i += 1) {
|
for (i = 1; i < tslen; i += 1) {
|
||||||
time = timestamps[i]
|
time = timestamps[i]
|
||||||
printf("[%d,%.2f],",
|
printf("[%d,%.2f],",
|
||||||
|
@ -172,7 +173,7 @@ BEGIN {
|
||||||
print " .score { overflow: hidden; color: black; }"
|
print " .score { overflow: hidden; color: black; }"
|
||||||
for (team in teams) {
|
for (team in teams) {
|
||||||
printf(" .t%s { background-color: #%s; }\n",
|
printf(" .t%s { background-color: #%s; }\n",
|
||||||
team, colors_by_team[team])
|
teams[team], colors_by_team[team])
|
||||||
}
|
}
|
||||||
print " </style>"
|
print " </style>"
|
||||||
|
|
||||||
|
@ -202,7 +203,7 @@ BEGIN {
|
||||||
for (team in teams) {
|
for (team in teams) {
|
||||||
if (scores[i] == scores_by_team_time[team, lasttime]) {
|
if (scores[i] == scores_by_team_time[team, lasttime]) {
|
||||||
name = names_by_team[team]
|
name = names_by_team[team]
|
||||||
print_bar("total", team, scores[i], ncats)
|
print_bar("total", teams[team], scores[i], ncats)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +232,7 @@ BEGIN {
|
||||||
points = points_by_cat_team[cat, team]
|
points = points_by_cat_team[cat, team]
|
||||||
if (l[j] == points) {
|
if (l[j] == points) {
|
||||||
name = names_by_team[team]
|
name = names_by_team[team]
|
||||||
print_bar(cat, team, points, points_by_cat[cat])
|
print_bar(cat, teams[team], points, points_by_cat[cat])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,6 +243,7 @@ BEGIN {
|
||||||
|
|
||||||
print " </table>"
|
print " </table>"
|
||||||
print " <canvas id=\"chart\" width=\"800\" height=\"400\"></canvas>"
|
print " <canvas id=\"chart\" width=\"800\" height=\"400\"></canvas>"
|
||||||
|
print " <p><a href=\"scoring.html\">About scoring</a></p>"
|
||||||
print " </body>"
|
print " </body>"
|
||||||
print "</html>"
|
print "</html>"
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,9 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
if ('\0' == token[0]) {
|
||||||
|
cgi_page("Invalid token", "");
|
||||||
|
}
|
||||||
for (p = token; *p; p += 1) {
|
for (p = token; *p; p += 1) {
|
||||||
if ((! isalnum(*p)) &&
|
if ((! isalnum(*p)) &&
|
||||||
(*p != '-') &&
|
(*p != '-') &&
|
||||||
|
|
|
@ -15,9 +15,6 @@
|
||||||
<li>
|
<li>
|
||||||
<a href="puzzles.html">Puzzles</a>
|
<a href="puzzles.html">Puzzles</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<a href="teams.html">Teams</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href="irc://10.0.0.2/ctf"
|
<a href="irc://10.0.0.2/ctf"
|
||||||
title="IRC on 10.0.0.2, channel #ctf">Contest chat</a>
|
title="IRC on 10.0.0.2, channel #ctf">Contest chat</a>
|
||||||
|
|
|
@ -37,4 +37,4 @@ $(foreach p, $(PACKAGES), $(eval $p-clean: $p-pkgclean))
|
||||||
|
|
||||||
$(BIN)/%.pkg: %-install
|
$(BIN)/%.pkg: %-install
|
||||||
@ mkdir -p $(@D)
|
@ mkdir -p $(@D)
|
||||||
mksquashfs $(BUILD)/$* $@ -all-root -noappend
|
mksquashfs $(BUILD)/$* $@ -all-root -noappend -no-progress
|
||||||
|
|
Loading…
Reference in New Issue