[Mailman-Users] extracting banned/rejected/discarded email addresses for exim blacklist

Patrick Bogen pdbogen at gmail.com
Wed Sep 20 16:39:16 CEST 2006


On 9/20/06, Bretton Vine <bretton at hivemind.net> wrote:
> Is there an easy way to extract all the addresses which have been marked as
> follows in a mailman list setup - but for all lists?
>
>  i.e. extract all addresses which are listed in:
>       - banned from subscribing to the list
>       - automatically reject posts from $these_addresses
>       - automatically discard posts from $these_addresses
>
bin/dumpdb <list path>/config.pck will give you access to all the
pickled data inside a config, which includes ban_list,
discard_these_nonmembers, and reject_these_nonmembers.

Here's a bash hack using grep, tr, and cut to do it:

#!/bin/bash
DUMPDB=/usr/lib/mailman/bin/dumpdb
LISTPATH=/var/lib/mailman/lists/
PCK=`$DUMPDB $LISTPATH/$1/config.pck | tr "\n" " " | tr -s " "`

{ for i in ban_list discard_these_nonmembers reject_these_nonmembers
do
    echo $PCK | grep -Eo "'$i': \[[^]]*\]" | cut -d ':' -f 2 | tr -d
"[][' ]" # | tr "," "\n"
done; } | tr "," "\n" | tr -s "\n" | sort | uniq

Put that in a file, e.g. 'script', and run: ./script <listname>.
You'll probably need to fix DUMPDB= and LISTPATH=.

You can wrap this in something like: for i in `list_lists -b` to
automate over all lists.

-- 
- Patrick Bogen



More information about the Mailman-Users mailing list