Joined: 29 Jan 2008 Posts: 150 Location: Lancashire,U.K.
Posted: Mon 01 Mar 2010, 10:37 Post subject:
Script to block tracking from omniture etc. Subject description: blocking ip's of scripts in webpages that track you
this script was posted by a colleague on the Badphorm Forum. It is his work and I am posting it here for wider use. Cut and paste this using your favourite editor.
#! /bin/sh -e
# Shell script to read a file of IP addresses (in CIDR notation),
# one per line and terminated with a last line of "eof" and to
# update iptables to REJECT (with reason icmp-admin-prohibited) any outbound traffic
# to these addresses. Will output a message to your syslog for each block.
# 1) You must have iptables installed (I think most distros will have it installed already).
# 2) You must run this script as root (I use crontab to run it once a day and on reboot)
# 3) Don't forget to make this script exexcutable!
# 4) You can make your blocklist file editable by a trusted non-root user if you wish.
# ***** EDIT LINE BELOW with location of your blocklist file *****
# Clear existing iptables
# Configure iptables with addresses we block from going out
while read line
/sbin/iptables -A OUTPUT -d $line -j LOG --log-prefix "BLOCKED TRACKING SITE: "
/sbin/iptables -A OUTPUT -d $line -j REJECT --reject-with icmp-admin-prohibited
done < $IPLIST
# Display new iptables
#end of blocktracker
save the above as blocktracker make it executable and put it in /usr/local/bin
the data file copy this list of ip numbers including the eof at the end and save as 'tracking_list_ip.data', put this in /
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum