#! /bin/sh -e param () { ret=$(echo "$QUERY_STRING" | tr '=&' ' \n' | awk -v "k=$1" '($1==k) {print $2;}') ret=$(busybox httpd -d "$ret" || echo "$ret") echo "$ret" } team=$(param n) hash=$(param h | tr -dc 0-9a-f) cat < Team Registration

Team Registration

EOF if [ -z "$hash" ] || [ -z "$team" ]; then echo "

Empty field, cannot complete request

" elif ! grep -q " $hash$" $CTF_BASE/state/teams/assigned.txt; then echo "

That hash has not been assigned.

" elif [ -f $CTF_BASE/state/teams/names/$hash ]; then echo "

That hash has already been registered.

" else printf "%s" "$team" > $CTF_BASE/state/teams/names/$hash echo "

Okay, your team has been named and you may begin using your hash!

" fi cat < EOF