diff --git a/doc/problems.txt b/doc/problems.txt index a06f8c6..80b9167 100644 --- a/doc/problems.txt +++ b/doc/problems.txt @@ -1,4 +1,3 @@ -* claim.cgi not exiting -* someone managed to get a point in no category. that broke the scoreboard. +* claim.cgi not exiting (maybe fixed?) * get LAUR for contest * steg point values diff --git a/packages/mcp/bin/addteam b/packages/mcp/bin/addteam index 0ee3b6f..2116259 100755 --- a/packages/mcp/bin/addteam +++ b/packages/mcp/bin/addteam @@ -18,25 +18,21 @@ www=${CTF_BASE:-/var/www} mkdir -p $base/teams/names mkdir -p $base/teams/colors -# Assign a color. I spent two days selecting this color pallette for -# people with protanopia. Please don't change these colors. +# Assign a color. I spent weeks selecting a color pallette that +# wouldn't be hell on people with protanopia. Please don't change these +# colors. nteams=$(ls $base/teams/names/ | wc -l) -case $(expr $nteams % 15) in - 0) color=8c7a69 ;; - 1) color=7f7062 ;; - 2) color=79614b ;; - 3) color=a59281 ;; - 4) color=a59485 ;; - 5) color=4a4f5e ;; - 6) color=454955 ;; - 7) color=343c52 ;; - 8) color=696f82 ;; - 9) color=6b7182 ;; - 10) color=516b55 ;; - 11) color=4b614f ;; - 12) color=395d3f ;; - 13) color=6d8c72 ;; - 14) color=708c75 ;; +case $(expr $nteams % 10) in + 0) color=a6cee3;; + 1) color=1f78b4;; + 2) color=b2df8a;; + 3) color=33a02c;; + 4) color=fb9a99;; + 5) color=e31a1c;; + 6) color=fdbf6f;; + 7) color=ff7f00;; + 8) color=cab2d6;; + 9) color=6a3d9a;; *) echo 'ERROR ERROR' 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 # 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}/. -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 "$color" > $base/teams/colors/$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 diff --git a/packages/mcp/bin/scoreboard b/packages/mcp/bin/scoreboard index bacb3cf..0a2e365 100755 --- a/packages/mcp/bin/scoreboard +++ b/packages/mcp/bin/scoreboard @@ -76,6 +76,7 @@ BEGIN { interval = 150 tslen = 0 + nteams = 0; while (1 == getline) { time = $1 team = $2 @@ -92,7 +93,7 @@ BEGIN { } lasttime = time - teams[team] = team + teams[team] = nteams++ points_by_cat[cat] += points points_by_cat_team[cat, team] += points } @@ -111,7 +112,7 @@ BEGIN { cmd = sprintf("cat %s/teams/names/%s", base, team) cmd | getline name - if (! name) name = team + if (! name) name = "Avengers" names_by_team[team] = name close(cmd) } @@ -146,7 +147,7 @@ BEGIN { c = 0 for (team in teams) { 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) { time = timestamps[i] printf("[%d,%.2f],", @@ -172,7 +173,7 @@ BEGIN { print " .score { overflow: hidden; color: black; }" for (team in teams) { printf(" .t%s { background-color: #%s; }\n", - team, colors_by_team[team]) + teams[team], colors_by_team[team]) } print " " @@ -202,7 +203,7 @@ BEGIN { for (team in teams) { if (scores[i] == scores_by_team_time[team, lasttime]) { 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] if (l[j] == points) { 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 " " print " " + print "

About scoring

" print " " print "" } diff --git a/packages/mcp/src/claim.cgi.c b/packages/mcp/src/claim.cgi.c index 0fe73f3..a2a45b8 100644 --- a/packages/mcp/src/claim.cgi.c +++ b/packages/mcp/src/claim.cgi.c @@ -37,6 +37,9 @@ main(int argc, char *argv[]) { char *p; + if ('\0' == token[0]) { + cgi_page("Invalid token", ""); + } for (p = token; *p; p += 1) { if ((! isalnum(*p)) && (*p != '-') && diff --git a/packages/mcp/www/index.html b/packages/mcp/www/index.html index 1f8f7de..70cc348 100644 --- a/packages/mcp/www/index.html +++ b/packages/mcp/www/index.html @@ -15,9 +15,6 @@
  • Puzzles
  • -
  • - Teams -
  • Contest chat diff --git a/packages/packages.mk b/packages/packages.mk index 3a9ce69..e9c7bb0 100644 --- a/packages/packages.mk +++ b/packages/packages.mk @@ -37,4 +37,4 @@ $(foreach p, $(PACKAGES), $(eval $p-clean: $p-pkgclean)) $(BIN)/%.pkg: %-install @ mkdir -p $(@D) - mksquashfs $(BUILD)/$* $@ -all-root -noappend + mksquashfs $(BUILD)/$* $@ -all-root -noappend -no-progress