diff --git a/Makefile b/Makefile
index 4b9363b..81e474b 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,11 @@ CACHE = cache
# The end result
BIN = bin
+ifdef ARCH
+export CC = ${ARCH}-cc
+export STRIP = ${ARCH}-strip
+endif
+
all: packages
dist: ctf-install.zip
diff --git a/doc/2012-07-DC20/ideas.txt b/doc/2012-07-DC20/ideas.txt
new file mode 100644
index 0000000..d0186bc
--- /dev/null
+++ b/doc/2012-07-DC20/ideas.txt
@@ -0,0 +1,7 @@
+* foam
+** beat-matching puzzle
+ You have to play an MP3 to beat-match something being broadcast over
+ FM. When you do, the two pieces work together somehow to tell you
+ the key.
+** New recordings of Ginnie
+
diff --git a/doc/openwrt/README b/doc/openwrt/README
index cedb2f9..7e50721 100644
--- a/doc/openwrt/README
+++ b/doc/openwrt/README
@@ -1,57 +1,43 @@
-This directory contains the files used to set up an OpenWRT router.
+Using an OpenWRT router
+=======================
+You can use an off-the-shelf, OpenWRT capable wireless router,
+configuring only through the web interface. The OpenWRT setup is
+intended for smaller contests, wired or non-wired, in which
+participants can be counted on not to launch link level attacks (ARP
+or NDP). Bear in mind that the cheap consumer routers have relatively
+slow CPUs and won't stand up to high volume.
-Bear in mind that the cheap consumer routers have relatively slow CPUs
-and won't stand up to high volume. This same configuration applies to
-OpenWRT running on an x86 PC, or any other target of OpenWRT. For
-larger contests, it would be a good idea to use a faster machine for the
-router. I don't have any specific recommendations at this time (Oct
-2010).
+The CTF repository includes a "router" package, which will boot a DBTL
+device as a IPv6 router complete with multicast forwarding and up to
+24 tagged VLANs (by using a managed switch). This is a better option
+for larger contests, and can better handle high-speed (Gigabit)
+traffic.
-The router comes up as 10.0.0.1/16 on eth0.
+Instructions for setting up OpenWRT
+-----------------------------------
-If the router has a built-in switch, it is brought up without VLAN
-support, since these switches typically only support 16 VLANs, and do
-not support QinQ (double VLAN tags). All 5 ports work like an unmanaged
-switch, which ends up being handy for the contest table.
+After installing OpenWRT:
-Plugging a managed switch into the router enables access to 48 VLANs,
-each configured to a /16 network. The router on VLAN number v comes up
-as 10.v.0.1/16.
+* Change the root password
+* Install the following packages:
+ ip6tables
+ kmod-ip6tables
+ kmod-ipv6
+ libip6tc
+ luci-app-radvd
+ radvd
+* Configure the LAN interface as 10.0.0.1/16 and
+ fd84:b410:3441::1/64
+* Tell DHCP to begin at 257 after the base IP: this will assure
+ all DHCP addresses are after 10.0.1.0
+* Disable router solicitations on LAN
+* Enable WPA2, with the password "correct horse battery staple"
+* Turn on router advertisements (under radvd) on LAN
+* Enable prefix fd84:b410:3441::1/64 under radvd
-If the router has the ability to come up as a wireless access point, it
-will do so with SSID "CTF" and IP 10.254.0.1/16.
-
-All subnets can route to all other subnets, through the router.
-10.0.0.1/16 and 10.254.0.1/16 may have a higher TTL when routed to a
-VLAN (I haven't checked). Keep in mind that anything connected directly
-to the router (ie. not through the managed switch) can do its own VLAN
-tagging. This would be the way to hop on another team's subnet to do
-something like check service availability in such a way as to prevent
-teams from firewalling each other out.
-
-
- SSID "CTF"
- 10.254.0.1/16
- ((Y))
- |
- -------------
- | OpenWRT |
- -0-1-2-3-4---
- /| | | | |
- / | | | | |
- / | | | | |
- / 10.0.0.1/16
- /
- -------------------t---
- | Managed Switch |
- -1-2-3-4-5-...-47-48---
- / | | \
- / | | \
- / | | \
- / | | \
- 10.1.0.1/16 | | 10.48.0.1/16
- | |
- 10.3.0.1/16 |
- |
- 10.47.0.1/16
+This should be sufficient to bring up the router for running the
+contest. If you want to get fancy, you can scp the files in
+www in this directory, into /www on the router. This will give
+users some guidance if they accidentally browse to the router IP,
+and also disables the default redirection to luci.
diff --git a/doc/openwrt/etc/config/dhcp b/doc/openwrt/etc/config/dhcp
deleted file mode 100644
index 91a9742..0000000
--- a/doc/openwrt/etc/config/dhcp
+++ /dev/null
@@ -1,2 +0,0 @@
-config dnsmasq
- option leasefile '/tmp/dhcp.leases'
diff --git a/doc/openwrt/etc/config/network b/doc/openwrt/etc/config/network
deleted file mode 100644
index d2b22cb..0000000
--- a/doc/openwrt/etc/config/network
+++ /dev/null
@@ -1,27 +0,0 @@
-#### Switch configuration
-config switch eth0
- option enable 1
- option enable_vlan 0
-
-#### Loopback configuration
-config interface loopback
- option ifname "lo"
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-#### Administrative network
-config interface admin
- option ifname "eth0"
- option proto static
- option ipaddr 10.0.0.1
- option netmask 255.255.0.0
-
-#### Wireless
-config interface wifi
- option proto static
- option ipaddr 10.254.0.1
- option netmask 255.255.0.0
-
-# OpenWRT's "ifup/ifdown" are horribly slow, so the 48
-# vlans are set up in an init script :)
diff --git a/doc/openwrt/etc/config/wifi b/doc/openwrt/etc/config/wifi
deleted file mode 100644
index eefe021..0000000
--- a/doc/openwrt/etc/config/wifi
+++ /dev/null
@@ -1,9 +0,0 @@
-config wifi-device wl0
- option type broadcom
- option channel 1
-
-config wifi-iface
- option device wl0
- option network wifi
- option mode ap
- option ssid CTF
diff --git a/doc/openwrt/etc/init.d/iptables b/doc/openwrt/etc/init.d/iptables
deleted file mode 100755
index f608ac6..0000000
--- a/doc/openwrt/etc/init.d/iptables
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /bin/sh /etc/rc.common
-
-START=45
-STOP=89
-
-start () {
- stop
-
- iptables -P INPUT ACCEPT
- iptables -P OUTPUT ACCEPT
- iptables -P FORWARD ACCEPT
-
- iptables -A INPUT -p udp --dport 53 -j ACCEPT
- iptables -A INPUT -p udp --dport 67 -j ACCEPT
- iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
- iptables -A INPUT -s 10.0.0.0/16 -j ACCEPT
- iptables -A INPUT -j REJECT
-}
-
-stop () {
- iptables -F INPUT
- iptables -F OUTPUT
- iptables -F FORWARD
-}
-
-
diff --git a/doc/openwrt/etc/init.d/vlan b/doc/openwrt/etc/init.d/vlan
deleted file mode 100755
index 49bbdbd..0000000
--- a/doc/openwrt/etc/init.d/vlan
+++ /dev/null
@@ -1,20 +0,0 @@
-#! /bin/sh /etc/rc.common
-
-START=41
-STOP=89
-
-VLANS=48
-
-start () {
- for i in $(seq 1 $VLANS); do
- vconfig add eth0 $i
- ifconfig eth0.$i 10.$i.0.1 netmask 255.255.0.0
- done
-}
-
-stop () {
- for i in $(seq 1 $VLANS); do
- vconfig rem eth0.$i
- done
-}
-
diff --git a/doc/openwrt/etc/rc.d/K89iptables b/doc/openwrt/etc/rc.d/K89iptables
deleted file mode 120000
index 17013f0..0000000
--- a/doc/openwrt/etc/rc.d/K89iptables
+++ /dev/null
@@ -1 +0,0 @@
-../init.d/iptables
\ No newline at end of file
diff --git a/doc/openwrt/etc/rc.d/K89vlan b/doc/openwrt/etc/rc.d/K89vlan
deleted file mode 120000
index 444d959..0000000
--- a/doc/openwrt/etc/rc.d/K89vlan
+++ /dev/null
@@ -1 +0,0 @@
-../init.d/vlan
\ No newline at end of file
diff --git a/doc/openwrt/etc/rc.d/S41vlan b/doc/openwrt/etc/rc.d/S41vlan
deleted file mode 120000
index 444d959..0000000
--- a/doc/openwrt/etc/rc.d/S41vlan
+++ /dev/null
@@ -1 +0,0 @@
-../init.d/vlan
\ No newline at end of file
diff --git a/doc/openwrt/etc/rc.d/S45iptables b/doc/openwrt/etc/rc.d/S45iptables
deleted file mode 120000
index 17013f0..0000000
--- a/doc/openwrt/etc/rc.d/S45iptables
+++ /dev/null
@@ -1 +0,0 @@
-../init.d/iptables
\ No newline at end of file
diff --git a/doc/openwrt/www/index.html b/doc/openwrt/www/index.html
new file mode 100644
index 0000000..814d688
--- /dev/null
+++ b/doc/openwrt/www/index.html
@@ -0,0 +1,18 @@
+
+
+
+ Router
+
+
+
+ You're in the wrong place. This is the router.
+
Contest chat
+ (IPv4)
carries important announcements, and sometimes clues and
puzzles.
@@ -43,11 +47,13 @@
Rules
- No DoS attacks.
+ No DoS attacks. No link layer (ARP, NDP) attacks.
- Contest servers lie within fd84:b410:3441::/112.
- Do not attack machines outside fd84:b410:3441::/48.
+ Contest servers lie within fd84:b410:3441::/112
+ (or 10.0.0.0/24 for IPv4 contests).
+ Do not attack machines outside fd84:b410:3441::/48
+ (10.0.0.0/16).
Low ports (under 1024) do not run contest categories, don't
waste your time.
+ This page will be updated with any new announcements.
+
+
+
diff --git a/packages/multicaster/service/multicaster/finish b/packages/multicaster/service/multicaster/finish
new file mode 100755
index 0000000..c788d94
--- /dev/null
+++ b/packages/multicaster/service/multicaster/finish
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+/opt/00admin/sbin/fire-ip del
diff --git a/packages/multicaster/service/multicaster/ip.txt b/packages/multicaster/service/multicaster/ip.txt
index 5be068d..98d9bcb 100644
--- a/packages/multicaster/service/multicaster/ip.txt
+++ b/packages/multicaster/service/multicaster/ip.txt
@@ -1 +1 @@
-fd84:b410:3441::4e11/64
+17
diff --git a/packages/multicaster/service/multicaster/run b/packages/multicaster/service/multicaster/run
index 28969dd..b417506 100755
--- a/packages/multicaster/service/multicaster/run
+++ b/packages/multicaster/service/multicaster/run
@@ -2,7 +2,6 @@
exec 2>&1
-IP=$(cat ip.txt)
-ip addr add $IP dev eth0 || true
+IP=$(/opt/00admin/sbin/fire-ip add)
exec setuidgid ctf /opt/multicaster/bin/multicaster ff15::62c 1580 &1
+
+IP=$(/opt/00admin/sbin/fire-ip)
+
sv s octopus >/dev/null || exit 1
exec tcpsvd ${IP%/*} 8888 ./octopus-redirect
diff --git a/packages/octopus/service/octopus/finish b/packages/octopus/service/octopus/finish
new file mode 100755
index 0000000..c788d94
--- /dev/null
+++ b/packages/octopus/service/octopus/finish
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+/opt/00admin/sbin/fire-ip del
diff --git a/packages/octopus/service/octopus/ip.txt b/packages/octopus/service/octopus/ip.txt
index d584470..45a4fb7 100644
--- a/packages/octopus/service/octopus/ip.txt
+++ b/packages/octopus/service/octopus/ip.txt
@@ -1 +1 @@
-fd84:b410:3441::8888/64
+8
diff --git a/packages/octopus/service/octopus/run b/packages/octopus/service/octopus/run
index 66fc4e1..8ab8f28 100755
--- a/packages/octopus/service/octopus/run
+++ b/packages/octopus/service/octopus/run
@@ -2,7 +2,8 @@
exec 2>&1
-IP=$(cat ip.txt)
-ip addr add $IP dev eth0 || true
+IP=$(/opt/00admin/sbin/fire-ip add)
+
+grep -q ipv4 /proc/cmdline && IP=::ffff:$IP
exec /opt/octopus/bin/octopus ${IP%/*} < /opt/octopus/tokens.txt
diff --git a/packages/p2/bin/p2console b/packages/p2/bin/p2console
new file mode 100755
index 0000000..4247a15
--- /dev/null
+++ b/packages/p2/bin/p2console
@@ -0,0 +1,88 @@
+#! /bin/sh
+
+BASE=/tmp/p2
+
+mkdir -p $BASE
+
+if ! [ -f $BASE/nonce ]; then
+ dd if=/dev/urandom count=1 | md5sum - > $BASE/nonce
+fi
+clear
+read nonce < $BASE/nonce
+
+esc () {
+ printf '%s' "$*" | sed 's/[^-0-9A-Za-z ]/_/g; s/ /+/g'
+}
+
+newteam () {
+ echo '== Team Creation =='
+ echo
+ echo -n 'What would you like your team to be called (3-12 chars)? '
+ read -r name
+ echo
+ namelen=$(printf "%s" "$name" | wc -c)
+ if [ $namelen -lt 3 ] || [ $namelen -gt 12 ]; then
+ echo 'Invalid name length'
+ return
+ fi
+ hash=$(printf '%s %s' "$nonce" "$name" | md5sum | cut -b 1-8)
+
+ if [ -d $BASE/$hash ]; then
+ echo "That name is already in use. Try another one."
+ return
+ fi
+
+ mkdir $BASE/$hash
+
+ printf '%s' "$name" > $BASE/$hash/.name
+
+ cat < '
+read -r answer
+match=$(awk -v ans="$answer" '(substr($0, length($1)+2) == ans) { print substr(FILENAME, 6, length(FILENAME)-17) " " $1; }' /opt/*/answers.txt)
+cat=${match% *}
+points=${match#* }
+fn=$BASE/$hash/$cat.$points
+if [ -f $fn ]; then
+ echo "You've already received points for this answer."
+else
+ printf "%s %s\n" $cat $points > $fn
+ echo "You get $points more points in the $cat category."
+ # run puzzles.cgi
+ # update scoreboard
+ echo "Check the puzzles overview for newly-unlocked content!"
+fi
+
+done
+
diff --git a/packages/p2/www/credits.html b/packages/p2/www/credits.html
new file mode 100644
index 0000000..280f2ff
--- /dev/null
+++ b/packages/p2/www/credits.html
@@ -0,0 +1,51 @@
+
+
+
+ The Credits
+
+
+
+
Credits
+
+
Dirtbags Capture the Flag is brought to you by:
+
+
+
The number C
+
The letters ع and ֆ
+
+
+
And by:
+
+
Alex Brugh
+
Paul Ferrell
+
Jeremy Scott
+
Danny Quist
+
Adam Glasgall
+
Curtis Hash
+
Aaron McPhall
+
Patrick Avery
+
Erin Ochoa
+
William Phillips
+
Should your name be here? Please remind me!
+
+
+
Parts of this contest were inspired by:
+
+
DC949
+
Tube Warriors
+
Bad people from around the world (screw you guys, seriously)
+
+
+
Lastly, this contest would not exist were it not for hundreds of
+ thousands of lines of code from free software authors around the
+ world, including:
+ The contest is made up of multiple categories. Each category is
+ worth one point toward the total score; the percentage of the
+ total points held by your team is the percentage of one point your
+ team has for that category.
+
+
+
+ Categories are in the form of
+ multiple puzzles: for each puzzle presented, a
+ case-sensitive answer must be found to receive the amount of
+ points that puzzle is worth. Any team may answer any puzzle
+ question at any time. A new puzzle is revealed when a team
+ correctly answers the highest-valued puzzle in that category.
+
+
+
+
About time
+
+ Many Capture The Flag contests attempt to reward teams who answer
+ quickly, by adding a "quick answer" bonus or by decaying point
+ values over time. Our contest doesn't work this way.
+
+
+ We want to focus on rewarding technical proficiency, allowing
+ skilled contestants to prove their worth independent of their
+ ability to hit F5 quickly. It is our hope that by providing
+ enough things to work on, quick-moving teams will emerge with more
+ points by solving lots of puzzles, while novice teams get a solid
+ benchmark against which to judge their technical skill level: you
+ don't have to make allowances for reaction time in comparing
+ scores. In addition, when the game infrastructure goes down—which
+ seems to happen a lot in anybody's CTF—there's no losing points
+ while the organizers struggle to get things back up.
+
+
+
diff --git a/packages/playfair/service/playfair/finish b/packages/playfair/service/playfair/finish
new file mode 100755
index 0000000..c788d94
--- /dev/null
+++ b/packages/playfair/service/playfair/finish
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+/opt/00admin/sbin/fire-ip del
diff --git a/packages/playfair/service/playfair/ip.txt b/packages/playfair/service/playfair/ip.txt
index f4f0fdd..87523dd 100644
--- a/packages/playfair/service/playfair/ip.txt
+++ b/packages/playfair/service/playfair/ip.txt
@@ -1 +1 @@
-fd84:b410:3441::529/64
+41
diff --git a/packages/playfair/service/playfair/run b/packages/playfair/service/playfair/run
index ced4843..7d15ba5 100755
--- a/packages/playfair/service/playfair/run
+++ b/packages/playfair/service/playfair/run
@@ -2,7 +2,7 @@
exec 2>&1
-IP=$(cat ip.txt)
+IP=$(/opt/00admin/sbin/fire-ip add)
ip addr add $IP dev eth0 || true
exec tcpsvd -u nobody ${IP%/*} 1013 /opt/playfair/bin/playfair
diff --git a/packages/printf/service/printf/finish b/packages/printf/service/printf/finish
index 6317f74..c788d94 100755
--- a/packages/printf/service/printf/finish
+++ b/packages/printf/service/printf/finish
@@ -1,4 +1,3 @@
#! /bin/sh
-IP=$(cat ip.txt)
-ip addr del $IP dev eth0
+/opt/00admin/sbin/fire-ip del
diff --git a/packages/printf/service/printf/ip.txt b/packages/printf/service/printf/ip.txt
index 7adf1f8..492dff0 100644
--- a/packages/printf/service/printf/ip.txt
+++ b/packages/printf/service/printf/ip.txt
@@ -1 +1 @@
-fd84:b410:3441::2329/64
+152
diff --git a/packages/printf/service/printf/run b/packages/printf/service/printf/run
index 3336885..823c8d5 100755
--- a/packages/printf/service/printf/run
+++ b/packages/printf/service/printf/run
@@ -2,9 +2,7 @@
exec 2>&1
-IP=$(cat ip.txt)
-ip addr add $IP dev eth0
-ip monitor | grep -q $IP
+IP=$(/opt/00admin/sbin/fire-ip add)
# So I say to him, "Alex, what's a good high port number for a CTF category?"
# And he says, "6"
diff --git a/packages/revwords/service/revwords/finish b/packages/revwords/service/revwords/finish
new file mode 100755
index 0000000..c788d94
--- /dev/null
+++ b/packages/revwords/service/revwords/finish
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+/opt/00admin/sbin/fire-ip del
diff --git a/packages/revwords/service/revwords/ip.txt b/packages/revwords/service/revwords/ip.txt
index f4846f2..6bb2f98 100644
--- a/packages/revwords/service/revwords/ip.txt
+++ b/packages/revwords/service/revwords/ip.txt
@@ -1 +1 @@
-fd84:b410:3441::c3/64
+195
diff --git a/packages/revwords/service/revwords/run b/packages/revwords/service/revwords/run
index 1358389..833c6e9 100755
--- a/packages/revwords/service/revwords/run
+++ b/packages/revwords/service/revwords/run
@@ -2,8 +2,7 @@
exec 2>&1
-IP=$(cat ip.txt)
-ip addr add $IP dev eth0 || true
+IP=$(/opt/00admin/sbin/fire-ip add)
exec tcpsvd -u nobody ${IP%/*} 1013 ./go
diff --git a/packages/rlyeh/service/rlyeh/finish b/packages/rlyeh/service/rlyeh/finish
index 54ba047..c788d94 100755
--- a/packages/rlyeh/service/rlyeh/finish
+++ b/packages/rlyeh/service/rlyeh/finish
@@ -1,4 +1,3 @@
#! /bin/sh
-read IP < ip.txt
-ip addr del $IP dev eth0
+/opt/00admin/sbin/fire-ip del
diff --git a/packages/rlyeh/service/rlyeh/ip.txt b/packages/rlyeh/service/rlyeh/ip.txt
index 7acd21c..04f9fe4 100644
--- a/packages/rlyeh/service/rlyeh/ip.txt
+++ b/packages/rlyeh/service/rlyeh/ip.txt
@@ -1 +1 @@
-fd84:b410:3441::b33b/64
+59
diff --git a/packages/rlyeh/service/rlyeh/run b/packages/rlyeh/service/rlyeh/run
index 03e2bbf..f11ce62 100755
--- a/packages/rlyeh/service/rlyeh/run
+++ b/packages/rlyeh/service/rlyeh/run
@@ -1,8 +1,8 @@
#! /bin/sh -e
exec 2>&1
-read IP < ip.txt
-ip addr add $IP label eth0:rlyeh dev eth0 || true
+
+IP=$(/opt/00admin/sbin/fire-ip add)
dir=/var/lib/ctf/rlyeh
install -o nobody -d $dir
diff --git a/packages/router/router.mk b/packages/router/router.mk
index c101883..f9e5158 100644
--- a/packages/router/router.mk
+++ b/packages/router/router.mk
@@ -59,7 +59,7 @@ $(ECMH_BUILDDIR): $(ECMH_CACHE)
router-build: $(ROUTER_BUILDDIR)/ecmh-build
$(ROUTER_BUILDDIR)/ecmh-build: $(ECMH_BUILDDIR)
- $(MAKE) -C $(ECMH_BUILDDIR)/src ECMH_VERSION=dbtl-git
+ $(MAKE) -C $(ECMH_BUILDDIR)/src ECMH_VERSION=dbtl-git STRIP=$(STRIP)
$(MAKE) -C $(ECMH_BUILDDIR)/tools/mtrace6
touch $@
diff --git a/packages/router/service/sshd/run b/packages/router/service/sshd/run
index cfe1216..d063d8c 100755
--- a/packages/router/service/sshd/run
+++ b/packages/router/service/sshd/run
@@ -2,6 +2,6 @@
exec 2>&1
-echo 'root:$1$xAJ7KwiU$BeKJjYGs9r/hY9Ag4qv4I1:0:0:root:/tmp:/bin/sh' > /etc/passwd
+echo 'root:$1$xAJ7KwiU$BeKJjYGs9r/hY9Ag4qv4I1:0:0' | chpasswd --encrypted
exec dropbear -r ./rsa.key -E -F
diff --git a/packages/tanks/examples/hard/skirts/author b/packages/tanks/examples/hard/skirts/author
new file mode 100644
index 0000000..902019d
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/author
@@ -0,0 +1 @@
+Neale Pickett
diff --git a/packages/tanks/examples/hard/skirts/color b/packages/tanks/examples/hard/skirts/color
new file mode 100644
index 0000000..10dbfa4
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/color
@@ -0,0 +1 @@
+#d0d054
\ No newline at end of file
diff --git a/packages/tanks/examples/hard/skirts/name b/packages/tanks/examples/hard/skirts/name
new file mode 100644
index 0000000..4a4b9e0
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/name
@@ -0,0 +1 @@
+skirts
\ No newline at end of file
diff --git a/packages/tanks/examples/hard/skirts/program b/packages/tanks/examples/hard/skirts/program
new file mode 100644
index 0000000..7fa896f
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/program
@@ -0,0 +1,58 @@
+15 14 set-speed!
+
+( Front )
+5 sensor? {
+ get-turret 45 + 90 < { 15 15 } { 2 2 } ifelse set-speed!
+ 0 set-turret!
+} if
+
+( Rear )
+6 sensor? {
+ get-turret 45 + 90 < { 2 2 } { -15 -15 } ifelse set-speed!
+ 180 set-turret!
+} if
+7 sensor? {
+ 90 set-turret!
+ 5 -5 set-speed!
+} if
+8 sensor? {
+ -90 set-turret!
+ -5 5 set-speed!
+} if
+
+1 sensor? {
+ get-turret 10 + set-turret!
+} if
+
+2 sensor? {
+ get-turret 10 - set-turret!
+} if
+
+3 sensor? {
+ get-turret 20 + set-turret!
+} if
+
+4 sensor? {
+ get-turret 20 - set-turret!
+} if
+
+0 sensor? {
+ 0 0 set-speed!
+ get-turret set-turret!
+ fire!
+} if
+
+fire-ready? ! {
+ 70 60 10 random +
+ get-turret 90 + 180 > { exch } if
+ set-speed!
+} if
+
+9 sensor? {
+ 5 sensor? {
+ -100 -100
+ } {
+ 100 100
+ } ifelse
+ set-speed!
+} if
\ No newline at end of file
diff --git a/packages/tanks/examples/hard/skirts/sensor0 b/packages/tanks/examples/hard/skirts/sensor0
new file mode 100644
index 0000000..a6ab06f
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/sensor0
@@ -0,0 +1 @@
+50 0 7 1
diff --git a/packages/tanks/examples/hard/skirts/sensor1 b/packages/tanks/examples/hard/skirts/sensor1
new file mode 100644
index 0000000..d9fa05d
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/sensor1
@@ -0,0 +1 @@
+60 10 12 1
diff --git a/packages/tanks/examples/hard/skirts/sensor2 b/packages/tanks/examples/hard/skirts/sensor2
new file mode 100644
index 0000000..bee5d05
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/sensor2
@@ -0,0 +1 @@
+60 -10 12 1
diff --git a/packages/tanks/examples/hard/skirts/sensor3 b/packages/tanks/examples/hard/skirts/sensor3
new file mode 100644
index 0000000..0be47b9
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/sensor3
@@ -0,0 +1 @@
+90 30 40 1
diff --git a/packages/tanks/examples/hard/skirts/sensor4 b/packages/tanks/examples/hard/skirts/sensor4
new file mode 100644
index 0000000..e7609b1
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/sensor4
@@ -0,0 +1 @@
+90 -30 40 1
diff --git a/packages/tanks/examples/hard/skirts/sensor5 b/packages/tanks/examples/hard/skirts/sensor5
new file mode 100644
index 0000000..26b41ae
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/sensor5
@@ -0,0 +1 @@
+60 0 90 0
diff --git a/packages/tanks/examples/hard/skirts/sensor6 b/packages/tanks/examples/hard/skirts/sensor6
new file mode 100644
index 0000000..b69dc3a
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/sensor6
@@ -0,0 +1 @@
+60 180 90 0
diff --git a/packages/tanks/examples/hard/skirts/sensor7 b/packages/tanks/examples/hard/skirts/sensor7
new file mode 100644
index 0000000..db4c883
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/sensor7
@@ -0,0 +1 @@
+80 90 90 0
diff --git a/packages/tanks/examples/hard/skirts/sensor8 b/packages/tanks/examples/hard/skirts/sensor8
new file mode 100644
index 0000000..ddfc64e
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/sensor8
@@ -0,0 +1 @@
+80 270 90 0
diff --git a/packages/tanks/examples/hard/skirts/sensor9 b/packages/tanks/examples/hard/skirts/sensor9
new file mode 100644
index 0000000..9c9b4e8
--- /dev/null
+++ b/packages/tanks/examples/hard/skirts/sensor9
@@ -0,0 +1 @@
+30 180 345 0
diff --git a/packages/tanks/service/tanksd/run b/packages/tanks/service/tanksd/run
index c13e10f..06e7540 100755
--- a/packages/tanks/service/tanksd/run
+++ b/packages/tanks/service/tanksd/run
@@ -1,12 +1,14 @@
-#! /bin/sh
+#! /bin/sh -e
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
+ln -s /opt/tanks/html/* /var/www/tanks/ || true
+ln -s summary.html /var/www/tanks/index.html || true
-install -o ctf -d /var/lib/ctf/tanks/players
+mkdir -p /var/lib/ctf/tanks/players
+chown ctf /var/lib/ctf/tanks
+chown ctf /var/lib/ctf/tanks/players
PATH=/bin:/opt/ctfbase/bin:/opt/tanks/bin; export PATH
exec ./tanksd
diff --git a/packages/tanks/service/tanksd/tanksd b/packages/tanks/service/tanksd/tanksd
index a540e37..6e7ac4e 100755
--- a/packages/tanks/service/tanksd/tanksd
+++ b/packages/tanks/service/tanksd/tanksd
@@ -41,7 +41,7 @@ EOF
}
while true; do
- for dn in /var/lib/ctf/teams/names/*; do
+ find /var/lib/ctf/teams/names -type f | while read dn; do
hash=${dn##*/}
install -o ctf -d $p/$hash
done
@@ -92,24 +92,19 @@ window.onload = go;