Might as well store colors in a separate file:Bruce B wrote:An Intrusion Prevention Script
save "colors" in $PATH
Code: Select all
#!/bin/sh
### example: echo -e $RED"Hello"
## Black background
export RED='\E[31;40m'
export WHITE='\E[37;40m'
export GREEN='\E[32;40m'
export YELLOW='\E[33;40m'
export MAGENTA='\E[35;40m'
export CYAN='\E[36;40m'
export BLACK='\E[30;40m'
## White background
# export RED='\E[31;47m'
# export WHITE='\E[37;47m'
# export GREEN='\E[32;47m'
# export YELLOW='\E[33;47m'
# export MAGENTA='\E[35;47m'
# export CYAN='\E[36;47m'
# export BLACK='\E[30;47m'
Code: Select all
#!/bin/bash
. colors
KEYWORD=foobar
SAFEFILE=/var/log/safe~
trap caught 1 2 3 4 5 6
function caught() {
echo date >>$SAFEFILE # remove this echo
echo -e $RED"-- System has been compromised, shutting down now --"
echo -e $WHITE"poweroff" # remove this echo
}
if [ -f $SAFEFILE ] ; then
echo date >>$SAFEFILE # remove this echo
echo -e $RED"-- System has been compromised, shutting down now --"
echo -e $WHITE"poweroff" # remove this echo
fi
echo -n "Login: "
read a
if [ x$a != x$KEYWORD ] ; then
echo date >>$SAFEFILE # remove this echo
echo -e $RED"-- Unauthorized Access Attempt --"
echo -e $WHITE"poweroff" # remove this echo
fi