看起来我们将为Stack Overflow添加CAPTCHA支持。这对于防止机器人、垃圾邮件发送者和其他恶意脚本活动是必要的。我们只希望人类在这里发布或编辑东西!

我们将使用JavaScript (jQuery)验证码作为第一道防线:

http://docs.jquery.com/Tutorials:Safer_Contact_Forms_Without_CAPTCHAs

这种方法的优点是,对于大多数人来说,CAPTCHA永远不会可见!

然而,对于禁用JavaScript的人,我们仍然需要一个备用方案,这就是棘手的地方。

我为ASP编写了一个传统的CAPTCHA控件。NET,我们可以重复使用。

但是,我更倾向于使用一些文本化的东西,以避免为每个请求在服务器上创建所有这些图像的开销。

我见过这样的事情…

ASCII文本验证码:\/\/(_)\/\/ 数学难题:7减3乘以2等于多少? 小问题:癞蛤蟆和冰棍,哪个更好吃?

也许我只是在风车这里倾斜,但我希望有一个更少的资源密集型,非图像为基础的<noscript>兼容的验证码,如果可能的话。

想法吗?


当前回答

请打电话给xxxxx,让我们谈谈你那里的天气。

但是,现在的发展太快了,利润导向也太大了,对我们选择的服务提供商来说,即使是一个电话也太贵了(时间很宝贵)。

我们接受了大部分时间与机器交谈。

悲伤的时光...

其他回答

修正语法错误的验证码:

echo "Hello, world!;
for (int $i = 0; $i < 10; $i ++ {
  echo $i /*
}

括号和引号被随机移除。

机器人可以自动检查语法错误,但他们不知道如何修复它们!

不是最精致的反垃圾邮件武器,但是微软支持:

Nobot-Control (AjaxControlToolkit的一部分)。

NoBot可以通过违反上述任何技术进行测试:快速回发、多次回发或禁用浏览器中的JavaScript。

演示:

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/NoBot/NoBot.aspx

Make an AJAX query for a cryptographic nonce to the server. The server sends back a JSON response containing the nonce, and also sets a cookie containing the nonce value. Calculate the SHA1 hash of the nonce in JavaScript, copy the value into a hidden field. When the user POSTs the form, they now send the cookie back with the nonce value. Calculate the SHA1 hash of the nonce from the cookie, compare to the value in the hidden field, and verify that you generated that nonce in the last 15 minutes (memcached is good for this). If all those checks pass, post the comment.

This technique requires that the spammer sits down and figures out what's going on, and once they do, they still have to fire off multiple requests and maintain cookie state to get a comment through. Plus they only ever see the Set-Cookie header if they parse and execute the JavaScript in the first place and make the AJAX request. This is far, far more work than most spammers are willing to go through, especially since the work only applies to a single site. The biggest downside is that anyone with JavaScript off or cookies disabled gets marked as potential spam. Which means that moderation queues are still a good idea.

从理论上讲,这可以作为通过模糊性的安全,但在实践中,这是很好的。

我从未见过垃圾邮件发送者试图破解这种技术,尽管可能每隔几个月我就会收到一个手动输入的主题垃圾邮件条目,这有点怪异。

我认为一个定制的验证码是你最好的选择。这种方法需要一个专门针对机器人/脚本来破解它。这种努力因素应该会减少尝试的次数。人类毕竟是懒惰的

当我看到一个关于人类计算的视频(该视频是关于如何使用人类通过游戏来标记图像)时,我有了一个想法来构建一个验证码系统。人们可以使用这样的系统来标记图像(可能用于其他目的),然后使用关于标记的统计信息来选择适合验证码使用的图像。

假设有一张图片,90%的人都给它贴上了“猫”或“摩天大楼”的标签。然后可以呈现图像,要求图像最明显的特征,这将是图像的主导标签。

这可能超出了SO的范围,但有人可能会发现这是一个有趣的想法:)