poll results

ravi gadfly at exitleft.org
Tue Mar 19 20:38:27 PST 2002


Michael Pollak wrote:
> On Tue, 19 Mar 2002, ravi wrote:
>
>>yes, but it is trivially easy to set the archive up so only those users
>>who want their email addresses obscured will have that happen.
>
> Is it trivially easy to do that retroactively, to documents that have
> already been archived?
>

yes, that too. lets take a random shot (which will definitely not run without mods and is probably not written too well either):

#!/opt/perl/bin/perl # substitute location of perl above # # perl script to obscure email addresses in archives # assumes each message is stored in a separate file # de-obfuscated for readability #

#--- configurable stuff ---

$archivedir="..."; # place where hypermail archives are $invisiblefile="..."; # list of email addresses to anonymize

#--- end configurab stuff ---

open(INV, "$invisiblefile")

|| die "Could not open inv members file: $invisiblefile.\n";

while( <INV> ) {

chop;

$inv{$_} = 1; } close(INV);

opendir(ARCHIVES, "$archivedir")

|| die "Could not open archivedir: $archivedir.\n";

# who needs . and .. readdir(ARCHIVES); readdir(ARCHIVES);

while( $file = readdir(ARCHIVES) ) {

# there are much better ways to do the below! but as we know

# there is no one right way to do anything in perl ;-)

open(MSG, "$file")

|| die "Could not open: $file.\n";

open(TMP, "> /tmp/inv.$$")

|| die "Could not open tmp file: /tmp/inv.$$\n";

while( <MSG> )

{

# rather than be clever and look for hypermail HTML

# tags for email addresses, lets just do brute force.

# regexp below to get email address needs some work.

# also email address should be replaced with something

# more interesting than just "obscured"

s/$1/ email obscured /g

if( /([\w_\-\.]+\@[\w\-]+(\.[\w\-]+)+)/

&& $inv{"$1"} );

print TMP;

}

close(MSG);

close(TMP);

# definitely can do this a better way

system("mv /tmp/inv.$$ $archivedir/$file"); }

closedir(ARCHIVES);

---------------------------

--ravi



More information about the lbo-talk mailing list