#!/bin/sh

getrec() {
	REC=${1%\"}
	case $REC in
	ip4:*)
		echo ${REC#ip4:}
		;;
	include:*)
		for INC in $(host -t TXT ${REC#include:})
			do
				getrec ${INC}
			done
		;;
	'redirect='*)
		for INC in $(host -t TXT ${REC#redirect=})
			do
				getrec ${INC}
			done
		;;
	esac
}	

FILE=/var/db/override.txt

rm -f ${FILE}
touch ${FILE}

for DOMAIN in \
	apple.com \
        amazon.com \
	gmx.net \
        google.com \
        hotmail.com \
	outlook.com \
	yahoo.com \
	ebay.com \
	twitter.com \
	live.com \
	virgin.net \
	aliexpress.com \
	notice.aliexpress.com \
	ovh.com \
	messagelabs.com \
	bt.com \
	digitalocean.com \
	forumactif.com \
	linkedin.com \
	cerberusapp.com \
	fedex.com \
	proximus.com \
	openbsd.org \
	bt.com \
	spf.protection.outlook.com \
	campaigns.thalys.com \
	basecompany.be \
	telenet.be \
	ldlc.com \
	steampowered.com \
	wcpropre.be \
	dhl.com \
	ups.com \
	minfin.be \
	partenamut.be \
	cisco.com
do   
	echo \#${DOMAIN} >> ${FILE}
	getrec include:${DOMAIN} >> ${FILE}
done

pfctl -t dwl-no-greylist -T flush
pfctl -t dwl-no-greylist -T add $(grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}/?[0-9]{1,2}' ${FILE})
