This is a quick hack I whipped together to obsfucate my email address for posting on my homenode. Not content with just rearranging the bits of the address I decided I'd do some stuff to make things difficult for web scrapers.
The color blending is adapted from the node HTML color blend, much thanks to the author. If you have any ideas to make things even more difficult for those nasty spamming scumbags then please post a follow up. Also if you have ideas about making the color blending more sophis im all ears. :-)
The blender() subroutine takes three mandatory args and an optional one. They are: a color to start at, a color to finish at, the string to obfuscate (more on that later), and optionally a switch to control whether semicolons are suffixed to the color, which for some bizzarre reason that I don't understand at all changes the look (at least on IE.) (Update: injunjoel informs me that this looks the same on Konqueror, which makes me think IE is as usual doing its own thing.)
The string will be interpreted somewhat unusally. Any newlines (\n) will be treated as plain <br />'s, \b's will be treated as a <b> and \e's will be treated as </b>. The whole thing will be wrapped in <p> tags with centering turned on.
Here is the output of the code as posted: (view source to see how obfuscated it is)
This is an example of what
it will do
Why do the semicolons in the colors below make it look different to the above? Its the only difference in the two, and I can't work it out. /msg me with the answer if you can explain the difference! Cheers.
This is an example of what
it will do
# HTML Email obfuscator and colorizer # derived from a posting by Anatoli Radulov at [id://217611] use warnings; use strict; sub blender { my ($color1,$color2,$string,$semi)=@_; $semi=$semi ? ";" : ""; my @chars=split //,$string; my (@range, @color1, @color2); #hex2dec; @color1 = ( $color1 =~ /\#([0-9A-Fa-f][0-9A-Fa-f]) ([0-9A-Fa-f][0-9A-Fa-f]) ([0-9A-Fa-f][0-9A-Fa-f])/x ); @color2 = ( $color2 =~ /\#([0-9A-Fa-f][0-9A-Fa-f]) ([0-9A-Fa-f][0-9A-Fa-f]) ([0-9A-Fa-f][0-9A-Fa-f])/x ); $_ = hex($_) foreach @color1,@color2; #calculate blend ranges $range[$_] = ($color2[$_] - $color1[$_])/@chars for (0..2); @chars=map { s/ / / || /[\n\b\e]/ ? $_ : rand(2)>1 ? "&#".ord($_).";" : $_ } @chars; my @insults=map {">$_<"} qw(spamsucks screwyouspammer scrapethis ihatespammers) +; my @res; for (0..$#chars) { push(@res,'<br />') and next if $chars[$_] eq "\n"; push(@res,'<b>') and next if $chars[$_] eq "\b"; push(@res,'</b>') and next if $chars[$_] eq "\e"; push @res, sprintf '<font color="#%02x%02x%02x%s">%s</font>', int ($color1[0]+$range[0]*$_), int ($color1[1]+$range[1]*$_), int ($color1[2]+$range[2]*$_), $semi, $chars[$_]; $res[-1]=qq'<span class="@{[$insults[rand @insults]]}">$res[-1 +]</span>' if rand(5)>1; push @res,"<!-- -->@{[$insults[rand @insults]]}\n". "@{[$insults[rand @insults]]}<!-- -->" if rand(5)>1; } return '<p align="center">'. join("<!-- -->\n:-) <!-- -->",@res). '</p>'; } my $string="This is an \bexample\e of what\nit will do"; print blender("#FF0000","#FFFF00",$string); print "<p>Why do the semicolons in the colors below make it look diffe +rent to the above?\n", "Its the only difference in the two, and I can't work it out.\n" +, "/msg me with the answer if you can explain the difference!\n", "Cheers.</p>\n"; print blender("#FF0000","#FFFF00",$string,1);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Email obsfucator for HTML posting (and color blender)
by mojotoad (Monsignor) on Jun 28, 2004 at 19:23 UTC | |
by chanio (Priest) on Sep 25, 2004 at 04:22 UTC | |
|
Re: Email obsfucator for HTML posting (and color blender)
by Anonymous Monk on Nov 14, 2005 at 08:17 UTC | |
|
Re: Email obsfucator for HTML posting (and color blender)
by Anonymous Monk on Jun 28, 2004 at 10:23 UTC | |
by demerphq (Chancellor) on Jun 28, 2004 at 10:25 UTC |