Obscufated email ?

Little hack to make a bit harder for spammers to parse email address on the web.

def cryptEmailAddress(addr):
r = []
for l in addr:
r.append('&#%d;' % ord(l))
return string.join(r,'')

>>>cryptEmailAddress('jkx@larsen-b.com')
'jkx@larse....'

And simply put this in a href mailto: and enjoy :) Check the article’s pages on this website for a example.



Related Posts

12 thoughts on “Obscufated email ?

  1. Yeah it’s shorter, in fact the topic is ‘Obscufated email’ not Obscufated Python :) .. But your version is easy to read too ..

    – Happy obscufated ? :)

  2. Ofcourse you could also do:

    def cryptEmailAddress(addr):

        return reduce(lambda a, b: “%s&#%d;”%(a, ord(b)), addr,”)

    :)

  3. Ofcourse you could also do:

    def cryptEmailAddress(addr):
    return reduce(lambda a, b: "%s&#%d;"%(a, ord(b)), addr,”)

    sorry about the raw crap ;)

  4. In fact, i’m working in a school, so I avoid this kind of stuf :)

    – /join #perl-golf

  5. and ofcourse if you look from the spamers point of view:

    def decryptEmailAddress(obf):
    return reduce(lambda a, b: a+chr(int(b)), obf[2:-1].split(‘;&#’), ”)

    :D

  6. this is a very old trick, and i’m sure all email address harvesters can already cope with this – it’s almost as simple as the AT/DOT crap

  7. Oh, is it so easy to get on Python Daily? :-)

    I’ve been using this hack (in its one-liner form) for a long time. ;)

    So here’s another scrambler so that I get famous: :D

    def nojs_scramble(address):

        r = ”

        for x in xrange(len(address)):

            if x % 2 == 0:

              r += address[x]

            else:

              r += ‘&#%d;’ % ord(address[x])

        return r

    def js_scramble(address):

        r = “var s=”; “;

        for x in xrange(0,len(address),2):

            r += “s += ‘%s’; ” % address[x:x+2]

        r += “document.write(s);”

        return r

    def scramble(address):

        import random

        v = {}

        v['nojs'] = nojs_scramble(address)

        v['js'] = js_scramble(address)

        result = “”"

       

       

        “”" % v

        return result

    print scramble(‘test@domain.com’)

    This gives:

        <script>

          var s=”; s += ‘te’; s += ‘st’; s += ‘@d’; s += ‘om’; s += ‘ai’; s += ‘n.’; s += ‘co’; s += ‘m’; document.write(s);

        </script>

        <noscript>

          test@domain.com

        </noscript>

       

  8. Oops, trouble with posting..

        result = “”"

        <script>

          %(js)s

        </script>

        <noscript>

          %(nojs)s

        </noscript>

        “”" % v

  9. Hum .. little trick from Christian .. simply crypt the ‘mailto:’ too. This isn’t catholic, but it works too.

    – Really enjoy this little hack

  10. I put my e-mail address on the Web only in the form of a bitmap graphic. Humans can read it easily. In order to use it, they have to retype it; but my address is short and they’ll have to do much more typing if they want to send me any worthwhile message.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>