Hi
I have Dreambox 500 HD,ICVS,GP3.
After the latest kernel upgrades a script which worked with E1 and E2 does not work.
Checks if CCcam is running and restarts if needed,bans illegal users.
Need help with the input of the script.
The script consists of 3 files:emustarter,statistics,illegal
(don't mind the turkish words inside)
Appreciate if somebody can help "which lines do not comply with the latest E2 upgrades"
Emustarter CCCam:
#! /bin/sh
while true; do
if cat /tmp/cam.name | grep -v grep | grep -c 6089 >/dev/null
then
killall -9 Emustarter_CCcam.sh &
exit 0
fi
if ps | grep -v grep | grep -c CCcam_2.3.0 >/dev/null
then
/usr/script/illegal.sh &
else
date=`date '+TARIH:%d/%m/%y SAAT:%H:%M:%S'`
echo "$date :: ***** CCcam RESETLENDI!! ***** " >> /tmp/reset.log
sleep 5
/usr/bin/CCcam_2.3.0 -dv >> /tmp/debug.txt &
fi
strHour="23"
strMin="58"
DateSTR=`date +%H%M%S`
if [ '$DateSTR' -ge '$strHour$strMin'00 ] && [ '$DateSTR' -le '$strHour$strMin'10 ]; then
rm -rf /tmp/*.log
sleep 1
/usr/script/istatistik.sh 2>/dev/null
else
killall -9 istatistik.sh 2>/dev/null
sleep 60
fi
done
Illegal:
#!/bin/sh
########################################
## ATTACK IP BAN SCRİPT FOR DREAMBOX ##
## BY CEREMY ##
## Thanks to Unlocker-AL ##
########################################
cat /tmp/debug.txt|grep illegal > /tmp/illegaluser.log
grep 'illegal' /tmp/illegaluser.log | awk -F " " '{print $7}' | grep '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' > /tmp/badIP.out
awk '
{s[$0]++}
END {
for(i in s) {
if(s[i]>1) {
print i
}
}
}' /tmp/badIP.out > /tmp/badIP.block
while IFS= read -r EachLine
do
`which route` add -host $EachLine reject
echo " $EachLine :: ***** IP ENGELLENDI!! ***** " >> /tmp/checkcccam.log
echo " $EachLine :: ***** IP ENGELLENDI! ***** " >> /tmp/ban.log
done < /tmp/badIP.block
rm -f /tmp/badIP.block
> /tmp/debug.txt
exit 0
Statistics:
#! /bin/sh
echo "*************** LOG GECMISI TEMIZLENDI ****************" >> /tmp/checkcccam.log
echo "#######GUNLUK BAN & RESET ISTATISTIKLERI#######" >> /tmp/checkcccam.log
sb=`cat tmp/ban.log | wc -l |awk '{print $1;}'`
echo "<<<<<<<<<<<ENGELLENEN (Toplam:$sb IP)>>>>>>>>>>>>>>>" >> /tmp/checkcccam.log
if [ -s /tmp/ban.log ] ; then
grep 'ENGELLENEN' /tmp/ban.log >> /tmp/checkcccam.log
> /tmp/ban.log
else
echo "**** HICBIR IP ENGELLENMEDI! *****" >> /tmp/checkcccam.log
fi
sr=`cat tmp/reset.log | wc -l |awk '{print $1;}'`
echo "<<<<<<<<<<<RESET ZAMANLARI(Toplam: $sr KEZ)>>>>>>>>>>>>" >> /tmp/checkcccam.log
if [ -s /tmp/reset.log ] ; then
grep 'Resetliyorum' /tmp/reset.log >> /tmp/checkcccam.log
> /tmp/reset.log
else
echo "**** CCCam HIC RESETLENMEDI *****" >> /tmp/checkcccam.log
fi
echo "****************** ISTASTISTIK SONU *******************" >> /tmp/checkcccam.log
sleep 2
############## Kota Gösterim Kismi ##########################
RX=$(ifconfig eth0|grep "RX bytes"|awk '{print $2;}'|awk 'BEGIN { FS=":" }; {print $2;}')
RXMB=$(echo $RX 1048576 | awk '{print int($1 / $2);}')
UP=$(cat /proc/uptime|awk '{print $1;}')
UPDAY=$(echo $UP 86400 | awk '{print int($1 / $2);}')
UPR=$(echo $UP 2592000 | awk '{print $1 / $2;}')
TOTMB=$(echo $RX 1048576 $UPR | awk '{print int(($1 / $2) / $3);}')
echo "############### CCcam KOTA KULLANIMINI #################" >> /tmp/checkcccam.log
echo $UPDAY | awk '{printf("Calisma Süresi : %5s Gün\n", $1)}' >> /tmp/checkcccam.log
echo $RXMB | awk '{printf("Kullanilan Kota : %5s MB\n", $1)}' >> /tmp/checkcccam.log
echo $TOTMB | awk '{printf("Tahmini Aylik Kota : %5s MB\n", $1)}' >> /tmp/checkcccam.log
echo "########################################################" >> /tmp/checkcccam.log