#!/bin/sh # Copyright (C) 2007, Dinko Korunic, InfoMAR d.o.o. # Bleeding Edge Threats BlackHole cleaner for Squid ACL # # Description: # Squid uses Splay tree structure which doesn't do good (ie. troubles # with tree search) with situations where multiple subdomains exist in a # single ACL file. This parser will ensure that in ACL there are only # most specific subdomains. awk -F\. '/^[^#]/ { line = "" for (i = NF; i > 2; --i) { line = "." $i line lines[line] = "x" } if (lines[$0] != "x") lines[$0] = "y" } END { for (line in lines) if (lines[line] == "y") print line }' spyware-squid-acl.include