diff --git a/doc/problems.txt b/doc/problems.txt index 3b9b98f..6ad9463 100644 --- a/doc/problems.txt +++ b/doc/problems.txt @@ -1,2 +1,2 @@ * claim.cgi not exiting (maybe fixed?) -* get LAUR for contest + diff --git a/doc/todo.txt b/doc/todo.txt index 79483aa..6380f26 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -1,5 +1,5 @@ Things That Need Fixin' ======================= -* puzzles.cgi really needs to cross out points your team has claimed. -* Make an OpenWRT router image for a FitPC +* Do something about all the symbolic links in the build tree +* Make arc4 global somehow diff --git a/packages/mcp/bin/addteam b/packages/mcp/bin/addteam index 2116259..f2773d1 100755 --- a/packages/mcp/bin/addteam +++ b/packages/mcp/bin/addteam @@ -49,3 +49,7 @@ echo "$1" > $base/teams/names/$hash echo "$color" > $base/teams/colors/$hash echo "Registered with hash: $hash" + +# Create encrypted listing of teams +ls $base/teams/names | KEY="Too much cheese." /opt/mcp/bin/arc4 > $www/teams.txt.$$ +mv $www/teams.txt.$$ $www/teams.txt diff --git a/packages/mcp/bin/scoreboard b/packages/mcp/bin/scoreboard index 0a2e365..b495677 100755 --- a/packages/mcp/bin/scoreboard +++ b/packages/mcp/bin/scoreboard @@ -30,18 +30,18 @@ function escape(s) { return s } -function print_bar(cat, team, n, d) { +function print_bar(cat, teamid, teamname, n, d) { printf("
\n" \ " %s: %s\n" \ "
", - team, + teamid, 100 * n / d, - team, - team, - cat, escape(names_by_team[team]), n) + teamid, + teamid, + cat, escape(name), n) } function output( t, c) { @@ -203,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", teams[team], scores[i], ncats) + print_bar("total", teams[team], name, scores[i], ncats) } } } @@ -232,7 +232,7 @@ BEGIN { points = points_by_cat_team[cat, team] if (l[j] == points) { name = names_by_team[team] - print_bar(cat, teams[team], points, points_by_cat[cat]) + print_bar(cat, teams[team], name, points, points_by_cat[cat]) } } } @@ -242,7 +242,7 @@ BEGIN { print " " print " " - print " " + print " " print "

About scoring

" print " " print "" diff --git a/packages/mcp/mcp.mk b/packages/mcp/mcp.mk index 96c2115..6d068f7 100644 --- a/packages/mcp/mcp.mk +++ b/packages/mcp/mcp.mk @@ -8,6 +8,7 @@ mcp-install: mcp-build cp packages/mcp/src/pointscli $(MCP_PKGDIR)/bin/ cp packages/mcp/src/tokencli $(MCP_PKGDIR)/bin/ cp packages/mcp/src/puzzles.cgi $(MCP_PKGDIR)/bin/ + cp packages/mcp/src/arc4 $(MCP_PKGDIR)/bin/ $(call COPYTREE, packages/mcp/service, $(MCP_PKGDIR)/service) diff --git a/packages/mcp/service/tokend/run b/packages/mcp/service/tokend/run index ba75674..211a9b9 100755 --- a/packages/mcp/service/tokend/run +++ b/packages/mcp/service/tokend/run @@ -4,7 +4,7 @@ exec 2>&1 DB=/var/lib/ctf/tokens.db -if [ ! -f $DB ]; do +if [ ! -f $DB ]; then # Append any package-provided tokens cat /opt/*/tokens >$DB 2>/dev/null chown ctf $DB diff --git a/packages/mcp/src/Makefile b/packages/mcp/src/Makefile index abf9e7d..35fa5c5 100644 --- a/packages/mcp/src/Makefile +++ b/packages/mcp/src/Makefile @@ -1,7 +1,7 @@ CFLAGS = -Wall -Werror TARGETS = in.tokend tokencli claim.cgi TARGETS += puzzler.cgi puzzles.cgi -TARGETS += pointscli mktoken +TARGETS += pointscli mktoken arc4 all: build @@ -11,6 +11,7 @@ in.tokend: in.tokend.o arc4.o common.o tokencli: tokencli.o arc4.o pointscli: pointscli.o common.o mktoken: mktoken.o common.o +arc4: arc4-main.o arc4.o puzzles.cgi: puzzles.cgi.o common.o claim.cgi: claim.cgi.o common.o diff --git a/packages/mcp/src/arc4-main.c b/packages/mcp/src/arc4-main.c new file mode 120000 index 0000000..d91405e --- /dev/null +++ b/packages/mcp/src/arc4-main.c @@ -0,0 +1 @@ +../../tokens/src/arc4-main.c \ No newline at end of file diff --git a/packages/mcp/tokend.keys/tanks b/packages/mcp/tokend.keys/tanks new file mode 100644 index 0000000..15df993 --- /dev/null +++ b/packages/mcp/tokend.keys/tanks @@ -0,0 +1 @@ +U'0mqp \ No newline at end of file diff --git a/packages/mcp/www/ctf.css b/packages/mcp/www/ctf.css index 90fff8a..42e9902 100644 --- a/packages/mcp/www/ctf.css +++ b/packages/mcp/www/ctf.css @@ -37,12 +37,11 @@ a img { a { text-decoration: underline; color: #84b; - font-weight: bold; } a:hover { + color: #2a4; background: #333; - font-weight: bold; } @@ -69,7 +68,11 @@ th { } td { vertical-align: top; - text-align: right; + text-align: left; +} + +dt { + font-weight: bold; } p { @@ -83,42 +86,28 @@ hr { -/*** left side bar ***/ +/*** navigation bar ***/ -#navigation { - position: absolute; - background: HBG; - opacity: 0.9; - top: 80px; - left: 0px; - padding: 0; +nav h2 { + display: none; } -#navigation h3 { - font-size: 100%; - border-bottom: 2px solid #333; +nav ul { + list-style: none; + text-align: center; } -#navigation ul { - list-style: none; - padding: 0; - margin: 0; +nav li { + display: inline; } -#navigation li a { - display: block; - height: 25px; - width: 90px; - padding: 5px; - margin: 5px; - border-right: 4px solid #ddc; +nav li a { text-transform: lowercase; font-size: 0.9em; } -#navigation li a:hover { - background: #333; - border-right-color: #b71; +nav li + li:before { + content: " | "; } /**** special cases ****/ @@ -134,12 +123,12 @@ hr { text-align: center; } -.scoreboard { +#scoreboard { background: #112; } -.scoreboard td { - height: 400px; +#scoreboard td { + height: 300px; } #battlefield { @@ -149,19 +138,3 @@ hr { .solved { text-decoration: line-through; } - -table.pollster { - margin-left: 5em; -} - -table.pollster td { - padding: 2px 1em 2px 5px; -} - -table.pollster thead { - font-weight: bold; -} - -table.scoreboard { - height: 400px; -} diff --git a/packages/mktokendkey b/packages/mktokendkey new file mode 100755 index 0000000..366b5a9 --- /dev/null +++ b/packages/mktokendkey @@ -0,0 +1,19 @@ +#! /bin/sh + +if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + echo "Usage: $0 CATEGORY" + echo + echo "Creates tokend key for CATEGORY." + exit 1 +fi + +puz=$1; shift +cat=${1:-$puz} + +d=$(dirname $0) + +td=$d/mcp/tokend.keys/$cat +echo "Writing new server key to $td" +dd bs=1 count=16 if=/dev/urandom of=$td + +hd $td diff --git a/packages/tanks/html/designer.cgi b/packages/tanks/html/designer.cgi new file mode 100755 index 0000000..7a9800c --- /dev/null +++ b/packages/tanks/html/designer.cgi @@ -0,0 +1,4 @@ +#! /bin/sh + +BASE_PATH=/var/lib/ctf/tanks/players/; export BASE_PATH +exec /opt/tanks/bin/designer.cgi diff --git a/packages/tanks/html/designer.html b/packages/tanks/html/designer.html new file mode 100644 index 0000000..196f249 --- /dev/null +++ b/packages/tanks/html/designer.html @@ -0,0 +1,178 @@ + + + + Tank Designer + + + + + + + +

Tank Designer

+

+ +
+
+ Information + + + + + + + + + + + + + + + + + +
Team hash:
Tank name:
Author: + + (eg. Joe Cool <joe@cool.cc>) +
Color: + + (eg. #c7e148) +
+
+ +
+ Sensors + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#RangeAngleWidthTurret?
0
1
2
3
4
5
6
7
8
9
+
+ +
+ Program + +
+ + +
+ + + + diff --git a/packages/tanks/html/index.html b/packages/tanks/html/index.html new file mode 120000 index 0000000..b1d8680 --- /dev/null +++ b/packages/tanks/html/index.html @@ -0,0 +1 @@ +summary.html \ No newline at end of file diff --git a/packages/tanks/html/summary.html b/packages/tanks/html/summary.html new file mode 100644 index 0000000..72c23ec --- /dev/null +++ b/packages/tanks/html/summary.html @@ -0,0 +1,22 @@ + + + + Tanks + + + +

Tanks

+ +

+ Nothing here yet. You could read the + intro while you're waiting, + or submit a tank to get things + started. +

+ +

+ Hopefully it goes without saying that you'll need to reload + this page to see if anything's happened. +

+ + diff --git a/packages/tanks/service/tanksd/category.key b/packages/tanks/service/tanksd/category.key new file mode 100644 index 0000000..15df993 --- /dev/null +++ b/packages/tanks/service/tanksd/category.key @@ -0,0 +1 @@ +U'0mqp \ No newline at end of file diff --git a/packages/tanks/service/tanksd/log/run b/packages/tanks/service/tanksd/log/run new file mode 100755 index 0000000..c4eff97 --- /dev/null +++ b/packages/tanks/service/tanksd/log/run @@ -0,0 +1,3 @@ +#! /bin/sh + +exec logger -t tanks diff --git a/packages/tanks/service/tanksd/run b/packages/tanks/service/tanksd/run new file mode 100755 index 0000000..a0716de --- /dev/null +++ b/packages/tanks/service/tanksd/run @@ -0,0 +1,10 @@ +#! /bin/sh + +exec 2>&1 + +mkdir -p /var/www/tanks +ln -s /opt/tanks/html/* /var/www/tanks/ +ln -sf summary.html /var/www/tanks/index.html + +install -o ctf -d /var/lib/ctf/tanks/players +exec ./tanksd diff --git a/packages/tanks/service/tanksd/tanksd b/packages/tanks/service/tanksd/tanksd new file mode 100755 index 0000000..6dbb29f --- /dev/null +++ b/packages/tanks/service/tanksd/tanksd @@ -0,0 +1,125 @@ +#! /bin/sh + +d=/var/lib/ctf/tanks +p=$d/players +w=/var/www/tanks + +summary () { + cat < + + + Tanks + + + +

Tanks

+

New here? Start with the introduction.

+

New round every minute.

+

Round results

+