[ SEA-GHOST MINI SHELL]
#!/bin/bash
#Parameters: rblblist|msblist mailips|loopbackips
RBLSCAN="/var/lib/zabbix/rblscan.sh"
MSSCAN="/var/lib/zabbix/msscan.sh"
blacklist=$1
ipSource=$2
ipMail=$(cut -d: -f2 /etc/mailips)
ipLoop=$(cat /usr/local/etc/loopback_ips)
if [ $ipSource == "mailips" ]; then
ipList=$ipMail
elif [ $ipSource == "loopbackips" ]; then
ipList=$ipLoop
fi
#rbllist check
if [ $blacklist == "rblblist" ]; then
while read -r ipAddress; do
rblList=$($RBLSCAN $ipAddress | grep "^Listed.*" | awk '{$1=$2="";print $0}' | sed 's/^[ \t]*//')
if [ ! -z "$rblList" ]; then
statusText+="$ipAddress: $rblList; "
fi
done <<< "$ipList"
if [ ! -z "$statusText" ]; then
echo "WARN: $statusText"|tr -s '\r\n' ' '>/var/lib/zabbix/blacklisted_rbl_"$ipSource".data
else
echo "OK: None of our $ipSource are in the scanned $blacklist" >/var/lib/zabbix/blacklisted_rbl_"$ipSource".data
fi
#msblist check
elif [ $blacklist == "msblist" ]; then
while read -r ipAddress; do
MSList=$($MSSCAN $ipAddress | grep "^Listed.*" | awk '{$1=$2="";print $0}' | sed 's/^[ \t]*//')
if [ ! -z "$MSList" ]; then
statusText+="$ipAddress: $MSList; "
fi
done <<< "$ipList"
if [ ! -z "$statusText" ]; then
echo "WARN: $statusText"|tr -s '\r\n' ' '>/var/lib/zabbix/blacklisted_ms_"$ipSource".data
else
echo "OK: None of our $ipSource are in the scanned $blacklist" >/var/lib/zabbix/blacklisted_ms_"$ipSource".data
fi
fi
SEA-GHOST - SHELL CODING BY SEA-GHOST