in reply to Email anti-harvester code
And another tip I just recently learned was to 'encode' the html email link by using HTML Ascii encodings (like A or some such).. Does anybody have some handy code to perform some translations in perl?
This part you can do with HTML::Entities.
As for the auto-image-generation stuff, I've never done that, so some other monk will have to answer that part. Though, if it were me, I'd just do an image for each major TLD and use the entity encoding for the rest of the address.
my %tldgif = ( '.com' => ['commercetld.gif', $comwidth], '.org' => ['organisationtld.gif', $orgwidth], '.net' => ['telcotld.gif', $netwidth], '.us' => ['usatld.gif', $uswidth], '.uk' => ['gbtld.gif', $ukwidth], '.au' => ['aussietld.gif', $auwidth], ); sub encode_email_address { my ($addy) = @_; my $tld = ""; for (keys %tldgif) { if ($addy =~ /$_$/) { $tld = "<img src=\"$tldgif{$_}[0]\" alt=\"[$tldgif{$_}[0]]\" height=\"$tldheight\" width=\"$tldgif{$_}[1]\""; $addy =~ s/$_$//; } } use HTML::Entities; my $charstoencode = join '', ('A'..'Z','a'..'z','<>"&@',0..9); return (encode_entities($input, $charstoencode).$tld); }
That's untested, and I get tired in the evening, so it may need a slight fixup or two, but it should give you the idea. Once again, if you want to generate the images on the fly for each address, you'll need to wait for another monk to answer, who has more experience with such things.
As Zaxo says, spammers can easily use HTML::Entities if they decide it's worth their while, which they will if all the email addresses on the web are encoded with entities. The image helps more, because OCR is imperfect and takes more time than entity decoding; there are no known documented cases yet of spammers using OCR to harvest email addresses from images. This doesn't mean they can't or won't, or even that they haven't, but it's not currently a common practice. There are other tricks, like putting swirley colors in the background of the image and stretching and distorting the text, to make it harder for OCR software to read, hopefully without making it too hard for a seeing person. If you want to pursue that sort of shenaneghans, do a web search for CAPTCHA.
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
|
|---|