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 :

admin October 6th, 2004


12 Responses to “Obscufated email ?”

  1. Jkxon 06 Oct 2004 at 6:32 pm

    This is a sample post to show my email :=)

  2. Daguron 07 Oct 2004 at 11:01 am

    For even shorter code:

    address="some@address.com"
    print ”.join(["&#%d;" % ord(x) for x in address])

  3. Jkxon 07 Oct 2004 at 11:57 am

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

    – Happy obscufated ? :)

  4. Pedroon 08 Oct 2004 at 1:32 pm

    Ofcourse you could also do:

    def cryptEmailAddress(addr):

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

    :)

  5. Pedroon 08 Oct 2004 at 1:34 pm

    Ofcourse you could also do:

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

    sorry about the raw crap ;)

  6. Jkxon 08 Oct 2004 at 1:36 pm

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

    – /join #perl-golf

  7. Pedroon 08 Oct 2004 at 2:04 pm

    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

  8. Anonymouson 08 Oct 2004 at 8:57 pm

    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

  9. Priszon 08 Oct 2004 at 10:23 pm

    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>

       

  10. Priszon 08 Oct 2004 at 10:26 pm

    Oops, trouble with posting..

        result = “”"

        <script>

          %(js)s

        </script>

        <noscript>

          %(nojs)s

        </noscript>

        “”" % v

  11. Jkxon 09 Oct 2004 at 10:48 pm

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

    – Really enjoy this little hack

  12. Jonathanon 11 Oct 2004 at 5:24 pm

    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.

Comments RSS

Leave a Reply