DeDiHosting – Blog.samp-online.com

9. Oktober 2009

Block Teamspeak Flooder with Arno`s IPTABLES Firewall

Filed under: Linux — DeDi @ 08:10

This small script, reads all banned ips from Teamspeak 2 Anti-Flood Daemon`s Logfile “ts2afd.log” and adds them to “/etc/arnos/blocked-hosts”

#!/bin/bash
READTSFLOOD=`grep banned /home/ts/srv*/af/ts2afd.log | tr '/' ' ' | sed 's/^[ \t]*//' | tr '\t' ' ' | tr -d '",:[' | sed 's/ts2afd.log/ts2afd.log /g' | cut -d" " -f 3,6,7,8,9,11,20`
echo -e "$READTSFLOOD" > /mnt/tmpram/TSFLOOD
diff /mnt/tmpram/TSFLOOD.log /mnt/tmpram/TSFLOOD | grep ">" | tr -d '>' | sed 's/^[ \t]*//' >> /mnt/tmpram/TSFLOOD.log
 
if [ -f /mnt/tmpram/IP.BAN ]
  then
    echo "IP.BAN found, adding IPs..."
    cat /mnt/tmpram/TSFLOOD.log | cut -d" " -f 6 | sort -t '.' -g -k 1,2 -k 2,1 | uniq >> /mnt/tmpram/IP.BAN
  else
    echo "IP.BAN not found, creating new file, adding IPs..."
    cat /mnt/tmpram/TSFLOOD.log | cut -d" " -f 6 | sort -t '.' -g -k 1,2 -k 2,1 | uniq > /mnt/tmpram/IP.BAN
fi
echo "Clear SecureHosts from IP.BAN..., creating final"
cat /mnt/tmpram/IP.BAN | grep -vE '188.40.51.206|188.40.51.242|188.40.51.243|188.40.51.243|127.0.0.1' | sort -t '.' -g -k 1,2 -k 2,1 | uniq > /mnt/tmpram/IP.BAN.final
echo "Adding IP-BANS to blocked hosts"
cat /mnt/tmpram/IP.BAN.final > /etc/arno-iptables-firewall/blocked-hosts
exit

Keine Kommentare »

Noch keine Kommentare

RSS Feed für Kommentare zu diesem Artikel. TrackBack URL

Hinterlasse einen Kommentar

CAPTCHA-Bild

Powered by WordPress

SEO Powered by Platinum SEO from Techblissonline