1# junkfilter
2# a junk email filter system for procmail
3# Copyright 1997-2002 Gregory Sutter <gsutter@zer0.org>
4#
5# $Id: junkfilter.bodychk,v 2.21 2002/10/04 22:04:33 gsutter Exp $
6#
7# Please read the file "README" and the page
8# http://junkfilter.zer0.org/ before using junkfilter.
9
10# Is there a listed phrase in the body of the message?
11
12JFSEC="bodychk"
13
14JFBADJ="(best|(bigg?|hott?|low|new)(est)?)"
15JFBAPOL="(pardon|excuse|app?ologize|sorry)( for| about)?"
16JFBCARD="(Visa|Mastercard|Master Card|Master Charge|Mastercharge|M/C|MC|AMEX|American Express|Discover)"
17JFBMAIL="((e-? ?)?mail(ing)?|messag(e|ing)|distr(o|ib(ution)?)|info(rmation)?)(ed|s)?"
18JFBPOSS="(a(ll)?|any|future|my|y?our|the|this|este|la|el|nuestra)"
19JFBLIST="($JFBPOSS )?($JFBMAIL )?lista?"
20JFBPNUM="((\+?1)?[-( ]?[0-9][0-9][0-9][-) ]?[0-9][0-9][0-9][- ]?[0-9][0-9][0-9][0-9])"
21#JFBRM="([\'\"? ]|&quot;)*((d ?e ?l ?e ?t ?|r ?e ?m ?[o0] ?v ?)(e ?|a ?l|e ?[dr]))([\'\"?, ]|&quot;)*"
22JFBRM="([\'\"? ])*((d ?e ?l ?e ?t ?|r ?e ?m ?[o0] ?v ?)(e ?|a ?l|e ?[dr]))([\'\"?, ])*"
23#JFBREMV="(to|to be|for) [\'\"? ]*((delet|rem[o0]v)(e|al|ed))[\'\"? ]*"
24JFBREMV="(to|to be|for)${JFBRM}"
25#JFBRLIST="((global|universal) )?[\'\"? ]*((delet|rem[o0]v)(e|al|ed))[\'\"? ]*lista?"
26JFBRLIST="((global|universal) )?${JFBRM}lista?"
27JFBVIA="(against|avec|through|to|using|with|via)"
28JFBYOU="you( have|ve|\'ve)?"
29JFBOBFUSC="%[0-9a-f][0-9a-f]"
30
31# XXX JFBODYCHK must be assigned before JFDOMLIST.  Bug in procmail?
32
33JFBODYCHK=`cat $JFDIR/jf-bodychk`
34JFADDRLIST=`cat $JFDIR/jf-addresses`
35
36# Set up the list of domains to be checked, if enabled.
37:0
38* $ $JF_OPT_BODYDOMAIN^0
39{
40	JFDOMLIST=`cat $JFDIR/jf-domains`
41}
42
43# The following lines containing $JFBODYCHK are expanded twice, with the
44# two $ at the beginning of each line.  This is to allow the variables in
45# the jf-bodychk to be expanded.  This is not done for the user bodychk
46# because the extra variable escape can make the regexps rather complex.
47# To enable it, though, add an extra "$" and "\" to this line:
48# 	* $ ()\/${JFUSERBODYCHK:-$JFNOMATCH}
49# so that it appears as
50# 	* $ $ ()\/${JFUSERBODYCHK:-\$JFNOMATCH}
51
52# check the body for catchwords
53:0 B
54* < 60000
55* $ $ ()\/${JFBODYCHK:-\$JFNOMATCH}
56{ JFMATCH="$JFSEC: $MATCH" INCLUDERC=$JFDIR/junkfilter.match }
57
58# if that didn't get 'em, check the domains file
59:0 BE
60* < 60000
61* $ (^|[^-a-z0-9])\/(${JFDOMLIST:-\$JFNOMATCH})([^-a-z0-9]|$)
62{ JFMATCH="$JFSEC-domains: $MATCH" INCLUDERC=$JFDIR/junkfilter.match }
63
64JFDOMLIST
65JFBODYCHK
66
67:0
68* $ $JF_BODYCHK_USER^0
69{
70	JFUSERBODYCHK=(`cat $JF_BODYCHK_USER_LOC`)
71
72	:0 B
73	* < 60000
74	* $ ()\/${JFUSERBODYCHK:-$JFNOMATCH}
75	{ JFMATCH="${JFSEC}-User: $MATCH" INCLUDERC=$JFDIR/junkfilter.match }
76
77	JFUSERBODYCHK
78}
79
80JFSEC
81
82# EOF junkfilter.bodychk
83