Re: (HOWTO) Deleting Microsoft spams on POP3 server
From: William Park (opengeometry_at_yahoo.ca)
Date: 12/29/03
- Next message: Ian: "Do command when tail -f some_file | grep some_exp, matches?"
- Previous message: Heiner Steven: "Top 10 subjects comp.unix.shell"
- In reply to: Chris F.A. Johnson: "Re: (HOWTO) Deleting Microsoft spams on POP3 server"
- Next in thread: Chris F.A. Johnson: "Re: (HOWTO) Deleting Microsoft spams on POP3 server"
- Reply: Chris F.A. Johnson: "Re: (HOWTO) Deleting Microsoft spams on POP3 server"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Dec 2003 23:29:11 GMT
In <comp.mail.misc> Chris F.A. Johnson <c.fa.johnson@rogers.com> wrote:
> > exec 3<>/dev/tcp/$SERVER/pop3 0<&3 1>&3
> > read code
> > send user $USER
> > send pass $PASS
> > send stat
> > read ok n size <<< "$code" # +OK 11 1504321\r\n
> > if [ $n -gt 0 ]; then
> > for i in `seq 1 $n`; do
> > delete='no'
> > send top $i 0
> > while read line; do # ...\r\n
> > line=${line%$'\r'} # ...\r
> > egrep -q 'boundary="[a-z]+"' <<< "$line" && delete='yes'
> > [ "$line" = . ] && break
> > done
> > [ "$delete" = yes ] && send dele $i
> > done
>
> No need for seq; no need for egrep (and the -q option is not
> portable):
I need Egrep regular expression, because I must match all lowercase
letter delimited by double-quotes, ie.
"[a-z]+"
This is straight cut/paste of my ~/.procmailrc. If you've got Egrep,
then you've got '-q' option.
> i=0
> while [ $i -lt $n ]; do
> i=$(( $i + 1 ))
> send top $i 0
> case ${line%$'\r'} in
> .) break ;;
> *boundary=\"[a-z]*) send dele $i ;;
> esac
> done
Hmm, it can be further reduced to
for (( i=1; i<=n; i++ )); do
send top $i 0
...
done
Saves 2 lines.
>
> > fi
> > send quit
>
> Unfortunately, that string will also match some legitimate e-mails.
Which string? mine or yours?
> I've been using a shell script to filter and download my e-mail
> since the SWEN virus hit in September. It's at:
> <http://cfaj.freeshell.org/shell/scripts/mfilter>
I've seen it before, and I simply don't understand it. :-)
-- William Park, Open Geometry Consulting, <opengeometry@yahoo.ca> Linux solution for data management and processing.
- Next message: Ian: "Do command when tail -f some_file | grep some_exp, matches?"
- Previous message: Heiner Steven: "Top 10 subjects comp.unix.shell"
- In reply to: Chris F.A. Johnson: "Re: (HOWTO) Deleting Microsoft spams on POP3 server"
- Next in thread: Chris F.A. Johnson: "Re: (HOWTO) Deleting Microsoft spams on POP3 server"
- Reply: Chris F.A. Johnson: "Re: (HOWTO) Deleting Microsoft spams on POP3 server"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]