#!/bin/sh # # @(#)procmail_mindspring 1999/07/14 Anne Bennett # # Download Mindspring's list of bad senders for blocking spam, # reformat it for our site, and compare it to what # we've got. Report if different, and prepare new file. # # Last modified: 2000/02/18 Anne Bennett # (removed entries with no "@" sign or ".") PATH=/local/paths:/usr/bin:/sbin:/usr/sbin export PATH thisprog=procmail_mindspring logger="logger -p mail.info ${thisprog}:" url="http://cgi.mindspring.com/cgi-bin/spamlist.pl" cur_rc=/local/etc/procmail/spam/tag-mindspring new_rc=/local/etc/procmail/spam/NEW.tag-mindspring mailto="anne" tmp_new=/tmp/${thisprog}.$$.tmp_new tmp_old=/tmp/${thisprog}.$$.tmp_old tmp_diff=/tmp/${thisprog}.$$.tmp_diff tmp_raw=/tmp/${thisprog}.$$.tmp_raw all_tmp="${tmp_new} ${tmp_old} ${tmp_diff} ${tmp_raw}" # Start. # ${logger} starting. # Download Mindspring material; note the date and time. # lynx -dump -source ${url} > ${tmp_raw} down_date=`date '+%Y/%m/%d %H:%M:%S %Z'` # If we got nothing, stop now. # if [ ! -s ${tmp_raw} ] then echo "Empty or failed download" | \ mailx -s "New Mindspring procmail data FAILURE" ${mailto} rm -f ${all_tmp} ${logger} end of run, failed. exit fi # Format the material. # touch ${tmp_new} # (Pick out envelope senders.) < ${tmp_raw} sed -n '/

Envelope Senders<\/h3>/,/<\/pre>/p' \ | sed -e '/^\n| formail -b -f -A \"$trash_header siteban per-mindspring envelope sender\"\n\n",$1)}' \ >> ${tmp_new} # (Pick out header senders.) < ${tmp_raw} sed -n '/

Header Senders<\/h3>/,/<\/pre>/p' \ | sed -e '/^\n| formail -b -f -A \"$trash_header siteban per-mindspring header sender\"\n\n",$1)}' \ >> ${tmp_new} # If the result is empty, report the problem and stop. # if [ ! -s ${tmp_new} ] then echo "Empty after formatting" | \ mailx -s "New Mindspring procmail data FAILURE" ${mailto} rm -f ${all_tmp} ${logger} end of run, failed. exit fi # Isolate our current MindSpring-derived material. # cat ${cur_rc} \ | sed -n '/^# ========== MindSpring-derived material below ==========$/,$p' \ | tail +2 \ >> ${tmp_old} # Are they different? If not, clean up and exit quietly. # diff ${tmp_old} ${tmp_new} > ${tmp_diff} if [ ! -s ${tmp_diff} ]; then # No changes. ${logger} no change. rm -f ${all_tmp} ${logger} end of run. exit fi # There were changes! Prepare a new file and notify maintainer. # ${logger} changes found. cat ${cur_rc} \ | sed -n '1,/^# ========== MindSpring-derived material below ==========$/p' \ | sed -e "s%^# Last download on .*%# Last download on ${down_date}%" \ > ${new_rc} cat ${tmp_new} >> ${new_rc} ${logger} notifying maintainer. ( echo "" echo "New Mindspring procmail data is in ${new_rc}" echo "" echo "Differences follow:" echo "" echo "====================================" echo "" cat ${tmp_diff} ) | mailx -s "New Mindspring procmail data ready" ${mailto} # Clean up and leave rm -f ${all_tmp} ${logger} end of run. exit