#!/bin/sh
#
# Socka-login v1.21
#
# Asks question after valid l/p to gain acces
# to the shell. Some BOFH-like security :)
#
# put the script to the /etc/profile and 
# /etc/csh.cshrc to make it works
#
# script written by DanGer <danger@wilbury.sk>

trap '' 2	# to disable ^C and similar

otazka="Si socka?"		# question
answer="ano, som socka"		# answer
log="/var/log/socka-login.log"	# file, where the
				# logs are stored

# welcome messege
echo ""
echo "-= Pokusas sa dostat do privatneho boxu =-"
echo "Na to, aby si ho mohol pouzivat, potrebujes"
echo "si priznat, ze si socka. Takze, podme na to."
echo ""

# the rest of the script

while :
do
  echo "${otazka}"		# Asks question
  read odpoved			# reads $odpoved

# Logging

if [ "${odpoved}" != "${answer}" ]
then
	echo "${odpoved}" >> "${log}"
fi

# conditions
	case $odpoved in
		"${answer}") # if answer is correct
			echo "Muhaha, socka, si socka! :)))"
			echo ""
			break
			;;
		ano) 	# if answer is "ano"
			echo "Socka! nauc sa odpovedat celou vetou :)"
			echo ""
			;;
		nie)	# if answer is "nie"
			echo "Ale no, priznaj si, ze si socka!"
			echo ""
			;;
		som)	# if answer is "som"
			echo "HA! nauc sa odpovedat celou vetou, ty socka! :)"
			echo ""
			;;
		"ano som")	# if answer is "ano som"
			echo "To uz je lepsie, len ti tam nieco chyba :)"
			echo ""
			;;
		"nie som")	# if answer is "nie som"
			echo "Ty zasrana socka, priznaj si to! :)"
			echo ""
			;;
		*)	# everything else (default catch-all condition)
			echo "Tak tomuto nerozumiem, ty socka :)"
			echo ""
			;;
	esac
done
