Go Back   SharingDVB All Tutorials sharing > Emulator Tutorials > CardSharing Tutorials

Reply
 
Thread Tools Display Modes
Old 12-20-2014, 12:23 AM   #1
admin
Administrator
 
admin's Avatar
 
Join Date: Dec 2014
Posts: 219
CCcam iptables script to block deleted users



Requirements
- CCcam Logfile (in this tutorial /var/log/cccam.log)
- root Access
- Cron Daemon
- iptables

Scripts
/root/BanUser.sh

HTML Code:
#!/bin/bash
LOGFILE=/var/log/cccam.log
/sbin/iptables --flush

FILENAME=/root/baduser.db
touch $FILENAME
while read line
do 
 OUTPUT=`cat $LOGFILE | grep $line | awk '{printf "-A INPUT -s %s -j REJECT --reject-with icmp-host-unreachable\n", $10}' | awk 'x[$0]++ == 0' | tail --lines=1`
 /sbin/iptables $OUTPUT
done < $FILENAME

FILENAME=/root/badhost.db
touch $FILENAME
while read line
do 
 OUTPUT="-A INPUT -s $line -j REJECT --reject-with icmp-host-unreachable"
 /sbin/iptables $OUTPUT
done < $FILENAME
Database examples
/root/badhost.db
Code:
81.20.200.170
someremovedhost.dyndns.org
/root/baduser.db
Code:
deletedflineuser
deletedflineuser2
deletedflineuser3
Cronjob
/etc/cron.d/cccam-iptables
Code:
*/15 *     * * *     root   /root/BanUser.sh
Fill into the file baduser.db deleted users, You can also use the badhost.db file to put the hostname or ip address. Already configured iptables rules will be deleted with this script so make attention.
regards
admin is offline   Reply With Quote
Reply

« Previous Thread | Next Thread »
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:35 AM.
SharingDVB@
A vBSkinworks Design