Antispam measures circumventing

J

Jugurtha Hadjar

Hello,

# I posted this on the tutor list, but my message wasn't displayed


I shared some assembly code (microcontrollers) and I had a comment wit
my e-mail address for contact purposes.

Supposing my name is John Doe and the e-mail is (e-mail address removed), my
e-mail was written like this:

(e-mail address removed)'

With a note saying to remove the capital letters.

Now, I wrote this :

for character in my_string:
.... if (character == character.upper()) and (character !='@') and
(character != '.'):
.... my_string = my_string.replace(character,'')


And the end result was (e-mail address removed).

Is there a better way to do that ? Without using regular expressions
(Looked *really* ugly and it doesn't really make sense, unlike the few
lines I've written, which are obvious even to a beginner like me).

I obviously don't like SPAM, but I just thought "If I were a spammer,
how would I go about it".

Eventually, some algorithm of detecting the
john<dot>doe<at>hotmail<dot>com must exist.


Also, what would in your opinion make it *harder* for a non-human to
retrieve the original e-mail address? Maybe a function with no inverse
function ? Generating an image that can't be converted back to text, etc..

If this is off-topic, you can just answer the "what is a better way to
do that" part.

Thanks,
 
J

Jussi Piitulainen

Jugurtha said:
Supposing my name is John Doe and the e-mail is (e-mail address removed),
my e-mail was written like this:

(e-mail address removed)'

With a note saying to remove the capital letters.

Now, I wrote this :

for character in my_string:
... if (character == character.upper()) and (character !='@') and
(character != '.'):
... my_string = my_string.replace(character,'')

That does a lot of needless work, but I'll suggest other things
instead of expanding on this remark.

First, there's character.isupper() that will replace your entire
condition.

Second, there's ''.join(c for c in my_string if not c.isupper()).
And the end result was (e-mail address removed).

Is there a better way to do that ? Without using regular expressions
(Looked *really* ugly and it doesn't really make sense, unlike the few
lines I've written, which are obvious even to a beginner like me).

I don't see how you get to consider '[A-Z]' ugly. (Python doesn't seem
to have the named character classes like '[[:upper:]]' that would do
more than ASCII in some regexp systems. I only looked very briefly.)

Third, here's a way - try help(str.translate) and help(str.maketrans)
or python.org for some details:
'oh, amelase!'
I obviously don't like SPAM, but I just thought "If I were a spammer,
how would I go about it".

Eventually, some algorithm of detecting the
john<dot>doe<at>hotmail<dot>com must exist.

Also, what would in your opinion make it *harder* for a non-human to
retrieve the original e-mail address? Maybe a function with no
inverse function ? Generating an image that can't be converted back
to text, etc..

Something meaningful: make it (e-mail address removed) with a note to
"remove the female deer" for (e-mail address removed), or "remove the drop
of golden sun" for "(e-mail address removed)". You may get a cease and
desist letter - much uglier than a simple regex - if you do literally
this, but you get the idea. I've seen people using "remove the animal"
or "remove the roman numeral".

(Put .invalid at the end, maybe. But I wish spam was against the law,
effectively.)
 
C

Chris Angelico

(Put .invalid at the end, maybe. But I wish spam was against the law,
effectively.)

Against what law, exactly? In what jurisdiction will you seek to
charge spammers? And who will track them down?

ChrisA
 
C

Chris Angelico

Something meaningful: make it (e-mail address removed) with a note to
"remove the female deer" for (e-mail address removed), or "remove the drop
of golden sun" for "(e-mail address removed)".

This method can be quite effective. In fact, of all the suggestions
made so far, I'd say these are a few of my favorite techniques...

*ducks the rotten tomatoes*

ChrisA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top