#!/bin/bash
########################################
## ATTACK IP BAN SCRIPT FOR DREAMBOX ##
## BY CEREMY ##
## Thanks to Unlocker-AL ##
########################################
RouteBIN="/sbin/route"
CCcamLog="/tmp/cccam.debug.txt"
cat $CCcamLog | grep illegal >/tmp/cccam.illegaluser.log
grep 'illegal' /tmp/cccam.illegaluser.log | awk -F " " '{print $7}' | grep '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' >/tmp/cccam.badIP.out
awk '
{s[$0]++}
END {
for(i in s) {
if(s[i]>1) {
print i
}
}
}' /tmp/cccam.badIP.out >/tmp/cccam.badIP.block
while IFS= read -r EachLine; do
$RouteBIN add -host $EachLine reject
echo " $EachLine : ***** IP BANNED! ***** " >> /tmp/cccam.ban.log
done </tmp/cccam.badIP.block
rm -f /tmp/cccam.badIP.*
> /tmp/cccam.debug.txt
exit 0