[Mailman-Users] Regexp for blocking addresses

Matthew Saltzman mjs at clemson.edu
Mon Sep 28 16:46:08 CEST 2015


On Fri, 2015-09-25 at 17:03 +0000, Matthew Saltzman wrote:
> On Fri, 2015-09-25 at 08:23 -0700, Mark Sapiro wrote:
> > On 9/25/15 7:57 AM, Matthew Saltzman wrote:
> > > 
> > > That's still much more aggressive than what I was trying to say.
> > > I
> > > actually want to ban precisely all variants of the one address
> > > 
> > >     joeblow at gmail.com
> > > 
> > > (and about a dozen other addresses) that include embedded periods
> > > anywhere and the suffix, but not other gmail addresses.  grep
> > > finds
> > > them with 
> > > 
> > >     \.\?j\.\?o\.\?e\.\?b\.\?l\.\?o\.\?w\.\    ?+.*@gmail    \.com
> > > 
> > > (I might want \.* instead of \.\?) but adding
> > > 
> > >     ^\.\?j\.\?o\.\?e\.\?b\.\?l\.\?o\.\?w\.\    ?+.*@gmail\.com
> > > 
> > > to the ban list doesn't seem to block them.
> > 
> > 
> > Because in a python RE, \? is a literal '?', not a '0 or 1 of
> > repeat'.
> > For grep you need the \? to give ? its special meaning. a regexp
> > for
> > egrep or grep -E will be closer to what you want for python. You
> > want
> > 
> > ^\.?j\.?o\.?e\.?b\.?l\.?o\.?w xxx \+.*@gmail\.com
> > 
> > where I'm unsure about the ' xxx ' part because I don't understand
> > what
> > '\     ?' is supposed to do?
> 
> Just a formatting mistake.
> 
> > 
> > Or instead of the above and to account for multiple '.' maybe
> > 
> > ^\.*j\.*o\.*e\.*b\.*l\.*o\.*w\.*\+.*@gmail\.com
> > 
> > which says zero or more dots followed by j followed by zero or more
> > dots
> > followed by o, etc., followed by w followed by zero or more dots
> > followed by + followed by anything followed by @gmail.com.
> > 
> > See <
> > https://docs.python.org/2/library/re.html#regular-expression-syntax
> > >;.
> 
> I think that's what my problem is. Will give it a try.
> 
> Thanks very much.

So I used the ban script from 
http://nigelb.me/2015-08-26-mailman-attacks.html to add regexps of the
form

    "^\.*j\.*o\.*e\.*b\.*l\.*o\.*w    \    .*+.*@gmail    \.com"

to the ban list. They show up in the ban_list window looking correct 
(without the quotes) but don't seem to be blocking the intended 
addresses. The same pattern without the \.*'s does block the addresses 
not containing embedded periods.

Not quite sure what I'm missing or where to go here. I'd prefer not to 
actually hack the code in MailList.py if I can avoid it.


-- 
Matthew Saltzman
Clemson University Math Sciences
mjs AT clemson DOT edu


More information about the Mailman-Users mailing list