Some fixes during TF3

This commit is contained in:
Neale Pickett 2011-03-08 23:06:21 -07:00
parent 56d4dcf0d3
commit 774d58eff6
21 changed files with 122 additions and 60 deletions

View File

@ -0,0 +1,2 @@
<dl><dt>Alice<dd> 25 7 49 b 1a 50 27 3d 63 73 3e 4c 1d 17 1b 5b 35 3a 61 7e 7b 53 53 6 b <BR>9 36 37 26 64 7c 42 17 52 c 1d 36 37 26 64 74 45 17 51 5 7 65 72 3f 66 <BR>75 1c 2 4b 3 11 3c 77 38 6a 7f 5b 57 5b 3 f 33 32 29 23 6d 5f 5d 4a 48 <BR>4d 3c 35 2b 21 23 55 5b 4c 1 54 3c 2f 24 21 35 1c 4c 4d 51 5d 79 3e 6d 3e <BR>3b 59 7d 45 55 5e 20 51 65 21 3b 58 25 4c 1 6 78 51 29 79 72 47 71 9 30 <BR>14 67 5 61 55 6d 47 76 e 38 8 2f 19 79 18 7b 5b 6c 14 7a 17 3e 8 34 1b <BR>74 4c 67 47 68 54 38 f 22 48 27 57 63 57 3c 4e 38 d 77 4b 27 4c 65 57 20 <BR>49 23 12 3e 4e 2e 3 65 56 2f 5a 23 c 22 f 2d 42 7f e 2f 59 2a 1a 2e 41 <BR>3c 52 6e e 35 54 20 b 6b 15 23 49 67 7 35 41 2c 47 6f 54 33 48 69 4f 74 <BR>
<dt>Bob<dd> 36 d 5 1e 59 16 68 6c 6a 31 73 1a 4c 1d 50 a 36 6c 6a 35 2a 5b 5 d 5d <BR>5e 7b 64 7e 7d 29 1e 8 12 5d 45 7b 7c 32 29 2d 1e 11 12 42 43 71 66 32 36 <BR>2b 10 12 12 42 43 75 32 7c 27 3b 1 12 8 4f 49 64 77 28 3f 3c 1e d 44 5a <BR>4f 3e 6c 28 36 6f 4b 1f 4d 45 4f 8 5d e 69 6f 6a 28 7a 49 18 3 5c 12 69 <BR>68 71 33 75 1b d 2 40 1c 6d 68 6e 39 3c 0 7 1c 5c 1c 64 6e 7a 3a 75 7 <BR>1b 16 4e 55 64 72 66 26 30 16 52 0 53 5e 75 26 69 3c 30 6 8 49 1c 44 6e <BR>6d 69 6f 35 1b 4 1b 1d 50 77 77 3b 7e 22 18 0 1b 1f 56 38 6e 74 70 38 18 <BR> </dl>

View File

@ -1,34 +0,0 @@
SUBDIRS = src
PKGDIR = pkg
PACKAGE = mcp.pkg
all: package
package: $(PACKAGE)
$(PACKAGE): build
mkdir -p $(PKGDIR)
cp setup $(PKGDIR)
find bin -not -name '*~' | cpio -p $(PKGDIR)
cp src/in.tokend $(PKGDIR)/bin
cp src/tokencli src/pointscli $(PKGDIR)/bin
cp src/puzzles.cgi $(PKGDIR)/bin
find service -not -name '*~' -not -name '#*' | cpio -p $(PKGDIR)
find www -not -name '*~' -not -name '#*' | cpio -p $(PKGDIR)
cp src/puzzler.cgi src/claim.cgi $(PKGDIR)/www
mksquashfs $(PKGDIR) $(PACKAGE) -all-root -noappend
include $(addsuffix /*.mk, $(SUBDIRS))
test: build
./test.sh
build: $(addsuffix -build, $(SUBDIRS))
clean: $(addsuffix -clean, $(SUBDIRS))
rm -rf $(PKGDIR) $(PACKAGE)

15
packages/mcp/fnord.patch Normal file
View File

@ -0,0 +1,15 @@
diff -Naur fnord-1.10-orig//httpd.c fnord-1.10/httpd.c
--- fnord-1.10-orig//httpd.c 2011-03-08 22:28:18.000000000 -0700
+++ fnord-1.10/httpd.c 2011-03-08 22:31:12.000000000 -0700
@@ -663,8 +663,9 @@
static char* mimetype="text/plain";
static struct mimeentry { const char* name, *type; } mimetab[] = {
- { "html", "text/html" },
- { "htm", "text/html" },
+ { "html", "text/html; charset=utf-8" },
+ { "htm", "text/html; charset=utf-8" },
+ { "txt", "text/plain; charset=utf-8" },
{ "css", "text/css" },
{ "dvi", "application/x-dvi" },
{ "ps", "application/postscript" },

View File

@ -1,6 +1,30 @@
MCP_PKGDIR = $(TARGET)/mcp MCP_PKGDIR = $(TARGET)/mcp
MCP_BUILDDIR = $(BUILD)/mcp
mcp-install: mcp-build MCP_FNORD_VERSION = 1.10
MCP_FNORD_TARBALL = fnord-$(MCP_FNORD_VERSION).tar.bz2
MCP_FNORD_TARCACHE = $(CACHE)/$(MCP_FNORD_TARBALL)
MCP_FNORD_URL = http://www.fefe.de/fnord/$(MCP_FNORD_TARBALL)
MCP_FNORD_SRCDIR = $(MCP_BUILDDIR)/fnord-$(MCP_FNORD_VERSION)
$(MCP_FNORD_TARCACHE):
@ mkdir -p $(@D)
wget -O $@ $(MCP_FNORD_URL)
mcp-source: $(MCP_BUILDDIR)/source
$(MCP_BUILDDIR)/source: $(MCP_FNORD_TARCACHE)
mkdir -p $(@D)
bzcat $< | (cd $(@D) && tar xf -)
(cd $(@D)/fnord-$(MCP_FNORD_VERSION) && patch -p 1) < packages/mcp/fnord.patch
touch $@
mcp-build: $(MCP_BUILDDIR)/build
$(MCP_BUILDDIR)/build: $(MCP_BUILDDIR)/source
$(MAKE) -C packages/mcp/src build
$(MAKE) -C $(MCP_BUILDDIR)/fnord-$(MCP_FNORD_VERSION) DIET= CC=$(CC) fnord-cgi
mcp-install: $(MCP_BUILDDIR)/build
mkdir -p $(MCP_PKGDIR) mkdir -p $(MCP_PKGDIR)
$(call COPYTREE, packages/mcp/bin, $(MCP_PKGDIR)/bin) $(call COPYTREE, packages/mcp/bin, $(MCP_PKGDIR)/bin)
@ -8,6 +32,8 @@ mcp-install: mcp-build
cp packages/mcp/src/pointscli $(MCP_PKGDIR)/bin/ cp packages/mcp/src/pointscli $(MCP_PKGDIR)/bin/
cp packages/mcp/src/puzzles.cgi $(MCP_PKGDIR)/bin/ cp packages/mcp/src/puzzles.cgi $(MCP_PKGDIR)/bin/
cp $(MCP_BUILDDIR)/fnord-$(MCP_FNORD_VERSION)/fnord-cgi $(MCP_PKGDIR)/bin/
$(call COPYTREE, packages/mcp/service, $(MCP_PKGDIR)/service) $(call COPYTREE, packages/mcp/service, $(MCP_PKGDIR)/service)
$(call COPYTREE, packages/mcp/tokend.keys, $(MCP_PKGDIR)/tokend.keys) $(call COPYTREE, packages/mcp/tokend.keys, $(MCP_PKGDIR)/tokend.keys)
@ -20,10 +46,7 @@ mcp-test: mcp-build
packages/mcp/test.sh packages/mcp/test.sh
mcp-clean: mcp-clean:
rm -rf $(MCP_PKGDIR) rm -rf $(MCP_PKGDIR) $(MCP_BUILDDIR)
$(MAKE) -C packages/mcp/src clean $(MAKE) -C packages/mcp/src clean
mcp-build:
$(MAKE) -C packages/mcp/src build
PACKAGES += mcp PACKAGES += mcp

View File

@ -14,11 +14,8 @@ for d in /opt/*; do
fi fi
done done
cd /var/www
exec thttpd -D \ mkdir -p sites
-h 10.0.0.2 \ cd sites
-c "**.cgi" \ ln -sf /var/www default
-u ctf \ exec tcpsvd -u ctf 10.0.0.2 80 /opt/mcp/bin/fnord-cgi
-l /proc/self/fd/1 \
-T UTF-8 \
-nos

View File

@ -2,7 +2,7 @@
exec 2>&1 exec 2>&1
ip addr add 10.0.0.2/24 label eth0:mcp dev eth0 ip addr add 10.0.0.2/16 label eth0:mcp dev eth0
DB=/var/lib/ctf/tokens.db DB=/var/lib/ctf/tokens.db

View File

@ -156,7 +156,7 @@ main(int argc, char *argv[])
printf(" <dt>%s</dt>\n", cat); printf(" <dt>%s</dt>\n", cat);
printf(" <dd>\n"); printf(" <dd>\n");
for (i = 0; i < ncatpoints; i += 1) { for (i = 0; i < ncatpoints; i += 1) {
printf(" <a href=\"/%s/%ld\">%ld</a>\n", printf(" <a href=\"/%s/%ld/\">%ld</a>\n",
cat, catpoints[i], catpoints[i]); cat, catpoints[i], catpoints[i]);
if (catpoints[i] > maxpoints) break; if (catpoints[i] > maxpoints) break;
} }

34
packages/mcp/www/register.cgi Executable file
View File

@ -0,0 +1,34 @@
#! /bin/sh -e
team=$(echo "$QUERY_STRING" | sed -n s'/.*team=\([^&]*\).*/\1/p')
team=$(busybox httpd -d "$team" || echo "$team")
cat <<EOF
Content-type: text/html
<!DOCTYPE html>
<html>
<head>
<title>Team Registration</title>
<link rel="stylesheet" href="ctf.css" type="text/css">
</head>
<body>
<h1>Team Registration</h1>
EOF
if [ ! -w /var/www ] || [ ! -w /var/lib/ctf/teams ]; then
echo "<p>It looks like the server isn't set up for self-registrations."
echo "Go talk to someone at the head table to register your team.</p>"
else
echo "<p>Team name: $team</p>"
echo -n "<pre>"
if /opt/mcp/bin/addteam "$team"; then
echo "</pre><p>Write this hash down. You will use it to claim points.</p>"
else
echo "Oops, something broke. Better call Neale.</pre>"
fi
fi
cat <<EOF
</body>
</html>
EOF

View File

@ -6,9 +6,14 @@
</head> </head>
<body> <body>
<h1>Team Registration</h1> <h1>Team Registration</h1>
<form method="post" action="register.cgi"> <p>
Please register a team for yourself during this training. This
team is just for the training portion; it will not be the team you
play on during the exercise.
</p>
<form method="get" action="register.cgi">
<label>Team Name:</label> <label>Team Name:</label>
<input type="text" name="t"> <input type="text" name="team">
<input type="submit" value="Register"> <input type="submit" value="Register">
</form> </form>

View File

@ -1,3 +0,0 @@
This is a 16-byte xor key. Lots of spaces (0x20).
[55, 56, 59, 64, 71, 80, 91, 104, 119, 136, 155, 176, 199, 224, 251, 24]

View File

@ -0,0 +1 @@
PNG transmitted in ICMP payloads

View File

@ -1 +1 @@
ICMP tunnel, with xor Horrendously inefficient compression algorithm

View File

@ -1,10 +1,14 @@
RLYEH_PKGDIR = $(TARGET)/rlyeh RLYEH_PKGDIR = $(TARGET)/rlyeh
RLYEH_BUILDDIR = $(BUILD)/rlyeh RLYEH_BUILDDIR = $(BUILD)/rlyeh
RLYEH_CACHE = $(CACHE)/rlyeh.git
RLYEH_URL = "http://woozle.org/~neale/projects/rlyeh" RLYEH_URL = "http://woozle.org/~neale/projects/rlyeh"
$(RLYEH_CACHE):
git clone --bare $(RLYEH_URL) $@
rlyeh-source: $(RLYEH_BUILDDIR) rlyeh-source: $(RLYEH_BUILDDIR)
$(RLYEH_BUILDDIR): $(RLYEH_BUILDDIR): $(RLYEH_CACHE)
git clone $(RLYEH_URL) $@ git clone $< $@
rlyeh-build: rlyeh-source rlyeh-build: rlyeh-source
$(MAKE) -C $(RLYEH_BUILDDIR) $(MAKE) -C $(RLYEH_BUILDDIR)

View File

@ -0,0 +1,3 @@
#! /bin/sh
exec svlogd -tt $PWD

View File

@ -0,0 +1 @@
rlyeh

View File

@ -0,0 +1 @@
qð°VA.SF´Ö¨,.}²

View File

@ -0,0 +1 @@
7X<EFBFBD>)<29>><3E><19><> !r|!

View File

@ -1,10 +1,14 @@
TANKS_PKGDIR = $(TARGET)/tanks TANKS_PKGDIR = $(TARGET)/tanks
TANKS_CACHE = $(CACHE)/tanks.git
TANKS_BUILDDIR = $(BUILD)/tanks TANKS_BUILDDIR = $(BUILD)/tanks
TANKS_URL = "http://woozle.org/~neale/projects/ctanks" TANKS_URL = "http://woozle.org/~neale/projects/ctanks"
$(TANKS_CACHE):
git clone --bare $(TANKS_URL) $@
tanks-source: $(TANKS_BUILDDIR) tanks-source: $(TANKS_BUILDDIR)
$(TANKS_BUILDDIR): $(TANKS_BUILDDIR): $(TANKS_CACHE)
git clone $(TANKS_URL) $@ git clone $< $@
tanks-build: tanks-source tanks-build: tanks-source
$(MAKE) -C $(TANKS_BUILDDIR) $(MAKE) -C $(TANKS_BUILDDIR)

7
packages/wopr/service/wopr/run Executable file
View File

@ -0,0 +1,7 @@
#! /bin/sh
# Work around busybox bug
chmod a+r /dev/urandom
mkdir -p /var/tmp/wopr
chown ctf /var/tmp/wopr

View File

@ -8,6 +8,7 @@ wopr-install: packages/wopr/tokens.txt
cp packages/wopr/tokens.txt $(WOPR_PKGDIR)/ cp packages/wopr/tokens.txt $(WOPR_PKGDIR)/
$(call COPYTREE, packages/wopr/www, $(WOPR_PKGDIR)/www) $(call COPYTREE, packages/wopr/www, $(WOPR_PKGDIR)/www)
$(call COPYTREE, packages/wopr/service, $(WOPR_PKGDIR)/service)
wopr-clean: wopr-clean:

View File

@ -94,7 +94,7 @@ do
for i = 1, 4 do for i = 1, 4 do
seed = seed*256 + string.byte(r:read(1)) seed = seed*256 + string.byte(r:read(1))
end end
r:close() io.close(r)
math.randomseed(seed) math.randomseed(seed)
end end