How to prevent spammers bot?
By Romain Wednesday, January 31 2007 - 21:00 UTC - Tech - Permalink
By Romain Wednesday, January 31 2007 - 21:00 UTC - Tech - Permalink
There is many ways to prevent spam from the bayesian tests (statistical tests) to the basic captcha
... But we all know that pictures captcha can be bypassed by OCR
even if it can be quite tough, there is some sofwtare and articles (example here).
Well, let's talk about 2 other ways:
Assuming that robots do not interpret JavaScript (which is probably true for most of the bots) it would be nice to have a hidden field filled by JavaScript. It's quite simple to make such a script:
var W3CDOM = (document.createElement);
var inputInserted = false;
function addInput() {
if (!W3CDOM || inputInserted)
return;
// create the input form
var hiddenInput = document.createElement('input');
hiddenInput.type = "hidden";
hiddenInput.name = "testBrowser";
hiddenInput.value = "success";
//now add the input to the DOM.
document.forms[0].appendChild(hiddenInput);
inputInserted = true;
}
Then, you test that the GET/POST('testBrowser') == 'success';
The input looks like that:
<input type="text" name="OneOfMyFields" onclick="addInput()" />
The idea is to create a form with one input which has different instances, let's say:
<input class='c1' type="text" name="login_1" value="" /> <input class='c2' type="text" name="login_2" value="" /> <input class='c3' type="text" name="login_3" value="" />
With your script, you choose a 'random' number from 1 to 3, create the good CSS
style (hide the not chosen value). The script store in the a cookie /SESSION/JavaScript the value of the random number then check after with this value.
If another input than the good one is filled than this should be a automated thing...
These techniques are absolutely not perfect at all, for the first, the assumption is quite odd I mean than it's not too hard to build a bot which can handle javascript/css/dom etc. and for the second, the 3 inputs are not enough, you need at least 30
for a representative trust.
Last comments