diff --git a/packages/p2/bin/p2console b/packages/p2/bin/p2console index 6b82bfa..ca177f8 100755 --- a/packages/p2/bin/p2console +++ b/packages/p2/bin/p2console @@ -105,21 +105,30 @@ EOD ;; esac - match=$(awk -v ans="$answer" '(substr($0, length($1)+2) == ans) { print substr(FILENAME, 6, length(FILENAME)-17) " " $1; }' /opt/*/answers.txt) - if [ -z "$match" ]; then - echo 'That is not a correct answer. Type "[1mhelp[0m" 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 [1m$points[0m more points in the [1m$cat[0m category." + matches=$(expr $matches + 1) + else + echo "[1mError recording points. Tell the officials![0m" + 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 /opt/p2/bin/pointscli $hash $cat $points p2console; then - echo "You get [1m$points[0m more points in the [1m$cat[0m category." - else - echo "[1mError recording points. Tell the officials![0m" + 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 "
" + 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 "