1#!/bin/sh 2 3# 4# JKF 27/06/2002 (C) Julian Field 5# 6# This script will create an "mbox" format file called "spam.<dirname>" 7# in the current directory for each of the directories which are passed 8# on the command-line to this script. So you can do 9# cd /var/spool/MailScanner/quarantine 10# ms-df2mbox * 11# and it will create a "spam.<dirname>" file in the current directory, 12# where each <dirname> is one of the directory names passed on the 13# command line. This file will contain all the messages that were 14# quarantined in their entirety. 15# So if you have 16# Quarantine Whole Message = no 17# the only thing in these directories will be spam, not viruses (but 18# it will include spam that contained viruses, so be careful!). 19# 20# Version 1.1 Include date format fix 21# Version 1.2 Supports quarantine directory layour in MailScanner V4 22# 23 24parentdir=`pwd` 25export parentdir 26 27while [ -n "$1" ] 28do 29 dir="$1" 30 shift 31 32 echo -n "Processing directory $dir..." 33 if [ \! -d $dir ]; then 34 echo $dir is not a directory 35 exit 1 36 fi 37 38 cd $dir/spam 39 40 for qf in qf* 41 do 42 id=`echo $qf | sed 's/^qf//'` 43 44 from=`grep '^S' $qf | sed 's/^S//'` 45 46 echo From $from `date "+%a %b %d %T %Y"` 47 # Note that the gap in the next line is a tab character! 48 egrep '(^H\?[^\?]*\?)|(^ )' $qf | sed 's/^H?[^?]*?//' 49 # Version 1.1: get the recipient addresses into the headers too 50 egrep '^R[A-Z]*:' $qf | sed 's/^R[A-Z]*:/X-MailScanner-Recipient:/' 51 echo 52 cat df$id 53 echo 54 done > mbox.$dir 55 56 cd $parentdir 57 mv $dir/spam/mbox.$dir spam.$dir 58 echo 59done 60