From f95605f3e6f960626fe09bcbc5784b8a986d9142 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 16 Aug 2012 19:47:19 -0600 Subject: [PATCH] Fail startup of points if packages are not online yet --- packages/00common/service/pointsd/mkpage | 1 + packages/mcp/service/httpd/run | 2 +- packages/p2/bin/p2console | 36 +++++++++++++++--------- packages/p2/bin/scoreboard | 29 +++++-------------- packages/p2/service/p2console/ip.txt | 2 +- packages/p2client/service/eth0/run | 8 ++---- qemu-ifup | 2 +- 7 files changed, 35 insertions(+), 45 deletions(-) diff --git a/packages/00common/service/pointsd/mkpage b/packages/00common/service/pointsd/mkpage index d15e62f..ac98d83 100755 --- a/packages/00common/service/pointsd/mkpage +++ b/packages/00common/service/pointsd/mkpage @@ -19,3 +19,4 @@ cat < EOD +exit 1 diff --git a/packages/mcp/service/httpd/run b/packages/mcp/service/httpd/run index 142b1de..df2a5c7 100755 --- a/packages/mcp/service/httpd/run +++ b/packages/mcp/service/httpd/run @@ -17,5 +17,5 @@ for d in /packages/*; do fi done -cd /var/www +cd $CTF_BASE/www exec tcpsvd -u ctf ${IP%/*} 80 $CTF_BASE/packages/mcp/bin/eris -c. diff --git a/packages/p2/bin/p2console b/packages/p2/bin/p2console index c58dd08..59d4a49 100755 --- a/packages/p2/bin/p2console +++ b/packages/p2/bin/p2console @@ -104,21 +104,29 @@ EOD ;; esac - match=$(awk -v ans="$answer" '(substr($0, length($1)+2) == ans) { print substr(FILENAME, 6, length(FILENAME)-17) " " $1; }' $CTF_BASE/packages/*/answers.txt) - if [ -z "$match" ]; then - echo 'That is not a correct answer. Type "help" for help.' - continue - fi + clear + matches=0 + for fn in /opt/*/answers.txt; do + cat=$(basename ${fn%/answers.txt}) + while read points ans; do + if [ "$ans" = "$answer" ]; then + if log $hash | grep -wq "$cat $points"; then + echo "You've already received points for this answer." + elif /opt/p2/bin/pointscli $hash $cat $points p2console; then + echo "You get $points more points in the $cat category." + matches=$(expr $matches + 1) + else + echo "Error recording points. Tell the officials!" + fi + fi + done < $fn + done - cat=${match% *} - points=${match#* } - fn=$BASE/$hash/$cat.$points - if log $hash | grep -Fxq "$cat $points"; then - echo "You've already received points for this answer." - elif $CTF_BASE/packages/p2/bin/pointscli $hash $cat $points p2console; then - echo "You get $points more points in the $cat category." - else - echo "Error recording points. Tell the officials!" + if [ "$matches" -eq 0 ]; then + echo 'That is not a correct answer. Type "help" for help.' + fi + if [ "$matches" -gt 1 ]; then + echo "Holy shit! Double word score!" fi done diff --git a/packages/p2/bin/scoreboard b/packages/p2/bin/scoreboard index c3b0de4..a44b6f3 100755 --- a/packages/p2/bin/scoreboard +++ b/packages/p2/bin/scoreboard @@ -61,28 +61,13 @@ function foot() { print " " - print "
"
-    print "    What is it?"
-    print "      It is a hacker/forensic/puzzle game... are you up for a challenge"
-    print ""      
-    print "    How do I play?"
-    print "      Sit at the terminal and make yourself a team."
-    print "      Follow instructions from there (involves visiting a website)"
-    print ""
-    print "    FAQ:"
-    print "    Q - What is the picture being projected?"
-    print "    A - It is the scoreboard and the image is for you to figure out"
-    print "    "
-    print "    Q - Are there any hints?"
-    print "    A - NO"
-    print "    "
-    print "    Q - Can I connect remotely and play?"
-    print "    A - Sure, connect to our Access Point \"Verizon MiFi A6AD Secure\""
-    print "    "
-    print "    Q - How do I track my points?"
-    print "    A - See first FAQ.  The points are based off of how many"
-    print "        puzzles you've solved in each category"
+    print "    
"
+    print "Project 2
" + print "

A CTF for people with limited time/patience/self-confidence.

" + print "

Plug in ethernet at this table, download puzzles, go think.

" + print "

http://10.0.0.2/

" + print "

Use the terminal to claim points when you've figured something out.

" print "
" print " " print "" diff --git a/packages/p2/service/p2console/ip.txt b/packages/p2/service/p2console/ip.txt index 23123a6..668b729 100644 --- a/packages/p2/service/p2console/ip.txt +++ b/packages/p2/service/p2console/ip.txt @@ -1 +1 @@ -10.0.0.2/24 +10.0.1.2/24 diff --git a/packages/p2client/service/eth0/run b/packages/p2client/service/eth0/run index 537a8cd..fe2a337 100755 --- a/packages/p2client/service/eth0/run +++ b/packages/p2client/service/eth0/run @@ -4,9 +4,5 @@ exec 2>&1 ip link set dev eth0 up -if grep 'debug' /proc/cmdline; then - ip addr add dev eth0 10.0.0.110/24 - exec sleep 8d -else - exec udhcpc -f eth0 -fi +ip addr add dev eth0 10.0.0.110/24 +exec sleep 8d diff --git a/qemu-ifup b/qemu-ifup index 6708fed..70774c2 100755 --- a/qemu-ifup +++ b/qemu-ifup @@ -1,5 +1,5 @@ #! /bin/sh ip addr add fd84:b410:3441::ffff/64 dev $1 -ip addr add 10.0.0.254/24 dev $1 +ip addr add 10.0.1.254/24 dev $1