I wrote my own script in the meantime. It was written for FreeBSD to be used with the FreeBSD port, however, the modifications to work on any UNIX system should be very easy (i.e. use wget -nv on Linux in place of fetch). This seems to be very fast too. It will only diff against what you currently have for filters (so if you don't have warez/URLLIST, it won't update that). It is based completely on the blacklist.tar.gz download. Please, feedback and constructive criticism is appreciated. Tom Veldhouse [EMAIL PROTECTED] On Tue, 21 Aug 2001, Morris Maynard wrote: > I want to acknowledge that M. Desjardin's script is far superior to this > one; but this one is simpler:) > --------------------------------------------------------------- > #!/bin/sh > > echo squidguard Blacklist Download > USER=anonymous > [EMAIL PROTECTED] > # this may be proxy, or nobody, depending... > RUNAS=squid > > cd /usr/local/squidguard/db/ > # save old blacklists > [ -f oldlists.tar.gz ] && rm -f oldlists.tar.gz > tar -czf oldlists.tar.gz * > echo "Running ftp....." > > echo "open ftp.ost.eltele.no > user $USER $UPASSWD > > cd /pub/www/proxy/squidGuard/contrib > bin > mget blacklists.tar.gz* > close > quit" | ftp -i -n > > gzip -dc blacklists.tar.gz~ | tar xvf - > > echo "Blacklists updated" > > echo "Changing Ownership" > > chown -R $RUNAS:$RUNAS /usr/local/squidguard/db/blacklists > > /etc/rc.d/init.d/squid reload > > ------------------------------------------------------------ > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Thomas T. > Veldhouse > Sent: Monday, August 20, 2001 1:52 PM > To: [EMAIL PROTECTED] > Subject: Script to update blacklists? > > > Does anybody have a decent script to update blacklists periodically? > > I am running FreeBSD 4.3-STABLE, Squid 2.4 and the latest stable version of > SquidGuard (x.x?). I would like to update my lists weekly or even more > often if possible. This is to protect my child from the evil world of the > Internet available from my home DSL connected LAN. > > I am looking for a perl script or some such to download, diff and apply > changes to the blacklists on my machine. > > Thanks in advance, > > Tom Veldhouse > [EMAIL PROTECTED] >
#!/bin/sh # # Author : Thomas T. Veldhouse <[EMAIL PROTECTED]> # Date : August 21 2001 # Version: 1.0 # # blacklist location BLLOC="http://ftp.ost.eltele.no/pub/www/proxy/squidGuard/contrib/" BLARCH="blacklists.tar.gz" BLDIR="blacklists" # squidguard configuration DBDIR=/var/db/squidGuard LOGDIR=/var/log/squidGuard CONFIG=/usr/local/etc/squid/squidguard.conf LISTS="ads adult aggressive audio-video drugs forums gambling hacking mail publicite redirector violence warez" SUBS="domains urls expressions" # program locations FETCH=/usr/bin/fetch SQUIDGUARD=/usr/local/bin/squidGuard DIFF=/usr/bin/diff PATCH=/usr/bin/patch # temporary work area TMP=/tmp #### # Begin main update #### cd ${TMP} echo "Downloading blacklists ... " ${FETCH} ${BLLOC}${BLARCH} echo "Expanding archive ... " tar xzf ${BLARCH} rm -f ${BLARCH} # difference the lists for list in ${LISTS}; do if [ -d ${TMP}/${BLDIR}/${list} ]; then cd ${TMP}/${BLDIR}/${list} for sub in ${SUBS}; do echo "Differencing ${list}/${sub} ... " difffile="${DBDIR}/${list}/${sub}.diff" if [ -f ${sub} ]; then if [ -f ${DBDIR}/${list}/${sub} ]; then echo "Differencing ${list}/${sub} ... " ${DIFF} -uN ${DBDIR}/${list}/${sub} ${sub} > ${difffile} cd ${DBDIR}/${list} ${PATCH} -E -s < ${difffile} > /dev/null 2>&1 fi fi done fi done # update the squidGuard database echo "Updating the SquidGuard database ... " ${SQUIDGUARD} -u # clean up if [ -d ${TMP}/${BLDIR} ]; then rm -rf ${TMP}/${BLDIR} fi # clean up the diffs for list in ${LISTS}; do if [ -d ${DBDIR}/${list} ]; then cd ${DBDIR}/${list} for sub in ${SUBS}; do difffile="${DBDIR}/${list}/${sub}.diff" origfile="${DBDIR}/${list}/${sub}.orig" if [ -f ${difffile} ]; then rm -f ${difffile} fi if [ -f ${origfile} ]; then rm -f ${origfile} fi done fi done echo "SquidGuard update complete."
