[ SEA-GHOST MINI SHELL]
#!/bin/bash
USER=$1
PASS=$2
FILE='/tmp/krb_tmp'
# Usage: SCRIPT_FILENAME [LDAP_USER] [LDAP_PASS] [OPTION]"
# OPTION can be -d or can`t be used for more detailed output
function general_use() {
err=`echo $PASS | kinit -c $FILE $USER 2>&1`
if [ $? -eq 0 ]; then
echo OK
else
echo "CRITICAL Getting Kerberos ticket: `echo $err | head -n 1`"
fi
kdestroy -c $FILE >/dev/null 2>/dev/null
}
function for_zabbix() {
err=`echo $PASS | kinit -c $FILE $USER 2>&1`
if [ $? -eq 0 ]; then
echo 0
else
echo 1
fi
kdestroy -c $FILE >/dev/null 2>/dev/null
}
if [[ $# -eq 3 ]];then
case "$3" in
-d|--display)
general_use
;;
*)
# Do whatever you want with extra options
echo "Wrong key, please use -d as a third argument for an extended output"
;;
esac
shift
else
for_zabbix
fi
SEA-GHOST - SHELL CODING BY SEA-GHOST