- 论坛徽章:
- 0
|
其中很多无用代码..本是为了练手..希望高手.能高抬一下贵手..
#!/bin/sh
#==============================================
#
# The scripts will lock the TERM
# Author :Ecore
# DAte : 2007-11-07
# http://www.ishacker.org
#
#============================================
DATE=`date "+%Y-%m-%d"`
SAVEDSTTY=`stty -g`
trap "unlock" 2 3 15
unlock()
{
tput clear
tput sgr0
tput cnorm
trap "unlock" 2 3 15
echo -n "Enter your password to unlock:"
read UNPASSWORD
if [ "${UNPASSWORD}" == "${PASSWORD}" ]; then
echo -e "\nunlocked..."
stty echo
stty $SAVEDSTTY
tput clear
break
else
logger -p notice "exit lock term scripts has error password."
fi
}
xy()
{
#_R=row, _C=colums
_R=$1
_C=$2
_TEXT=$3
tput cup $_R $_C
echo "$_TEXT"
}
center()
{
# _STR=string
_STR=$1
LEN=`echo $_STR|wc -c`
COLS=`tput cols`
HOLD_COL=`expr $COLS - $LEN`
CENTERCOLS=`expr $HOLD_COL / 2`
}
colour()
{
case $1 in
black_green)
echo -e "[40;32m"
;;
black_yellow)
echo '[40;33m'
;;
black_white)
echo '[40;37m'
;;
black_cyan)
echo '[40;36m'
;;
black_red)
echo '[40;31m'
;;
black_blue)
echo '[40;34m'
;;
*)
echo "Unknow colour."
esac
}
tput init
tput clear
echo -n "Enter your password to local $TTY:"
stty -echo
read PASSWORD
tput clear
center "==========================================="
while :
do
colour black_red
tput clear
tput civis
xy 5 $CENTERCOLS "==========================================="
xy 6 $CENTERCOLS " "
xy 7 $CENTERCOLS " The Current date is DATE "
xy 8 $CENTERCOLS " You must has The password to unlock "
xy 9 $CENTERCOLS " http://www.ishacker.org "
xy 10 $CENTERCOLS " "
xy 11 $CENTERCOLS "==========================================="
sleep 600
done
[ 本帖最后由 Ecore 于 2007-11-8 14:13 编辑 ] |
|