I've accepted an answer, but sadly, I believe we're stuck with our original worst case scenario: CAPTCHA everyone on purchase attempts of the crap. Short explanation: caching / web farms make it impossible to track hits, and any workaround (sending a non-cached web-beacon, writing to a unified table, etc.) slows the site down worse than the bots would. There is likely some pricey hardware from Cisco or the like that can help at a high level, but it's hard to justify the cost if CAPTCHA-ing everyone is an alternative. I'll attempt a more full explanation later, as well as cleaning this up for future searchers (though others are welcome to try, as it's community wiki).

情况

这是关于woot.com上的垃圾销售。我是Woot Workshop的总统,Woot Workshop是Woot的子公司,负责设计,撰写产品描述,播客,博客文章,并主持论坛。我使用CSS/HTML,对其他技术几乎不熟悉。我与开发人员密切合作,在这里讨论了所有的答案(以及我们的许多其他想法)。

可用性是我工作的重要组成部分,而让网站变得令人兴奋和有趣则是剩下的大部分工作。这就是下面三个目标的来源。验证码损害了可用性,机器人从我们的垃圾销售中偷走了乐趣和兴奋。

机器人一秒钟就会在我们的首页上猛击数十次屏幕抓取(和/或扫描我们的RSS),以寻找随机垃圾销售。他们一看到这个,就会触发程序的第二阶段登录,点击“我要一个”,填好表格,然后买下这些垃圾。

评价

lc:在stackoverflow和其他使用此方法的站点上,他们几乎总是处理已验证(登录)的用户,因为正在尝试的任务需要这样。

在Woot上,匿名(未登录)用户可以查看我们的主页。换句话说,撞击机器人可以不经过身份验证(除了IP地址之外基本上无法跟踪)。

所以我们又回到了扫描IP, a)在这个云网络和垃圾邮件僵尸的时代是相当无用的,b)考虑到来自一个IP地址的业务数量,捕获了太多无辜的人(更不用说非静态IP isp的问题和试图跟踪它的潜在性能影响)。

还有,让别人给我们打电话是最糟糕的情况。我们能让他们给你打电话吗?

布拉德克:内德·巴切德的方法看起来很酷,但它们是专门设计来击败为网络站点构建的机器人的。我们的问题是机器人是专门用来破坏我们网站的。其中一些方法可能只在很短的时间内有效,直到脚本编写人员将他们的机器人进化为忽略蜜罐,从屏幕上抓取附近的标签名称而不是表单id,并使用支持javascript的浏览器控件。

 

lc再次说道:“当然,除非炒作是你们营销计划的一部分。”是的,绝对是。当物品出现时的惊喜,以及当你设法得到一件物品时的兴奋,可能比你实际得到的垃圾一样重要,甚至更重要。任何消除先到/先得的东西都不利于“赢”的快感。

 

novatrust:就我个人而言,欢迎我们新的机器人霸主。我们实际上提供RSSfeeds,允许第三方应用程序扫描我们的网站的产品信息,但不是在主站HTML之前。如果我的理解正确的话,你的解决方案通过完全牺牲目标1来帮助目标2(性能问题),并放弃机器人将购买大部分垃圾的事实。我给你的回答投了赞成票,因为你最后一段的悲观情绪对我来说是准确的。这里似乎没有什么灵丹妙药。

其余的响应通常依赖于IP跟踪,这似乎是无用的(僵尸网络/僵尸/云网络)和有害的(捕获许多来自相同IP目的地的无辜的人)。

还有其他方法/想法吗?我的开发人员一直在说“让我们只做验证码”,但我希望有更少的侵入性方法,让所有真正想要我们的垃圾的人。

最初的问题

假设你卖的东西很便宜,但有很高的感知价值,而你的数量非常有限。没有人确切地知道你什么时候会卖这个东西。超过一百万人经常来看你卖什么。

你最终会发现脚本和机器人试图通过编程方式[a]找出你何时出售该道具,[b]确保他们是第一批购买该道具的人。这很糟糕,有两个原因:

你的网站被非人类攻击,拖慢了所有人的速度。 编剧最终“赢得”了产品,让常客感到被骗了。

一个看似显而易见的解决方案是为用户在下单前设置一些障碍,但这至少有三个问题:

The user experience sucks for humans, as they have to decipher CAPTCHA, pick out the cat, or solve a math problem. If the perceived benefit is high enough, and the crowd large enough, some group will find their way around any tweak, leading to an arms race. (This is especially true the simpler the tweak is; hidden 'comments' form, re-arranging the form elements, mis-labeling them, hidden 'gotcha' text all will work once and then need to be changed to fight targeting this specific form.) Even if the scripters can't 'solve' your tweak it doesn't prevent them from slamming your front page, and then sounding an alarm for the scripter to fill out the order, manually. Given they get the advantage from solving [a], they will likely still win [b] since they'll be the first humans reaching the order page. Additionally, 1. still happens, causing server errors and a decreased performance for everyone.

另一种解决方案是经常监视ip攻击,阻止它们进入防火墙,或以其他方式阻止它们排序。这个可以解2。和阻止[b],但扫描ip对性能的影响是巨大的,可能会导致更多像1这样的问题。比编剧自己造成的还要严重。此外,云网络和垃圾邮件僵尸的可能性使得IP检查相当无用。

第三个想法,强迫订单表单加载一段时间(比如半秒),可能会减慢快速订单的进度,但同样,脚本编写人员仍然是第一个进入的人,在任何速度下都不会对实际用户造成损害。

目标

将道具卖给非脚本人。 保持网站运行的速度不被机器人减慢。 不要让“正常”用户完成任何任务来证明他们是人类。


当前回答

根据您想要进入的复杂程度,您可以采取一些解决方案。

这些都是基于IP跟踪,在僵尸网络和云计算下有些崩溃,但应该能挫败绝大多数的僵尸。乔·兰登拥有大量机器人的可能性远远低于他只是运行一个从某处下载的Woot机器人来获取他的垃圾的可能性。

普通的节流

At a very basic, crude level, you could throttle requests per IP per time period. Do some analysis and determine that a legitimate user will access the site no more than X times per hour. Cap requests per IP per hour at that number, and bots will have to drastically reduce their polling frequency, or they'll lock themselves out for the next 58 minutes and be completely blind. That doesn't address the bot problem by itself, but it does reduce load, and increases the chance that legitimate users will have a shot at the item.

自适应调节

An variant on that solution might be to implement a load balancing queue, where the number of requests that one has made recently counts against your position in the queue. That is, if you keep slamming the site, your requests become lower priority. In a high-traffic situation like the bag of crap sales, this would give legitimate users an advantage over the bots in that they would have a higher connection priority, and would be getting pages back more quickly, while the bots continue to wait and wait until traffic dies down enough that their number comes up.

废料验证码

Third, while you don't want to bother with captchas, a captcha at the very end of the process, right before the transaction is completed, may not be a bad idea. At that point, people have committed to the sale, and are likely to go through with it even with the mild added annoyance. It prevents bots from completing the sale, which means that at a minimum all they can do is hammer your site to try to alert a human about the sale as quickly as possible. That doesn't solve the problem, but it does mean that the humans have a far, far better chance of obtaining sales than the bots do currently. It's not a solution, but it's an improvement.

以上的组合

实施基本的、慷慨的限制来阻止最滥用的机器人,同时考虑到单个公司IP背后的多个合法用户的潜力。截止数字将非常高——你引用了bot攻击你的网站10次/秒,即216万次/小时,这显然远远高于任何合法的使用量,即使是最大的公司网络或共享ip。

实现负载平衡队列,这样如果占用的服务器连接和带宽超过自己的份额,就会受到惩罚。这将惩罚共享公司池中的人,但不会阻止他们使用站点,而且他们的违规行为应该远没有您的装瓶者那么可怕,因此他们的惩罚应该不那么严重。

最后,如果您超过了每小时请求的某个阈值(这个阈值可能远远低于“自动断开连接”的截止值),那么就要求用户使用验证码进行验证。

这样,合法使用网站的用户每小时只有84个请求,即使他们非常兴奋,也不会注意到网站速度变慢了。然而,乔·波特发现自己陷入了两难境地。他可以:

Blow out his request quota with his current behavior and not be able to access the site at all, or Request just enough to not blow the request quota, which gives him realtime information at lower traffic levels, but causes him to have massive delays between requests during high-traffic times, which severely compromises his ability to complete a sale before inventory is exhausted, or Request more than the average user and end up getting stuck behind a captcha, or Request no more than the average user, and thus have no advantage over the average user.

只有滥用的用户才会受到服务降级或复杂性增加的影响。合法用户不会注意到任何变化,除了他们更容易购买他们的垃圾包。

齿顶高

以远低于注册用户的速率限制未注册用户的请求。这样,机器人所有者就必须通过一个经过身份验证的帐户来运行机器人,以通过应该是相对严格的节流率。

然后,有创造力的装瓶者将注册多个用户id,并使用这些id来实现他们想要的查询率;您可以通过将给定时间段内来自同一IP的任何ID视为相同的ID,并接受共享节流来解决这个问题。

这使得装瓶商别无选择,只能运行一个机器人网络,每个IP一个机器人,每个机器人注册一个Woot账户。不幸的是,这实际上无法与大量未关联的合法用户区分开来。

您可以将此策略与上述一种或多种策略结合使用,目的是为没有滥用使用模式的注册用户提供最佳服务,同时根据他们的状态(匿名或已注册)以及由流量指标决定的滥用程度逐步惩罚其他用户,包括注册用户和未注册用户。

其他回答

您可以通过同时更新RSS和HTML来减少服务器上的负载,这样机器人就不会对您的站点进行屏幕抓取。当然,这给了机器人和购买你的装备的优势。

如果你只接受信用卡支付(可能是这样,也可能不是,但这显示了我的思路),只允许用户每10次使用同一个账户和/或信用卡购买一次BOC。对一个脚本小子来说,搞到一大堆ip很容易,但搞到一大堆信用卡就不那么容易了。正如你所说的,ip很难被禁止,而暂时禁止信用卡应该是在公园里散步。

你可以让每个人都知道限制是什么,或者你可以告诉他们,因为高需求和/或机器人的兴趣,在不具体说明机制的情况下,对购买实施了限制。

在节流期间的每一次购买尝试都可能引发指数级的倒退——你买了一个BOC,在你再次尝试之前,你必须通过10次销售。不管怎样,你还是会在下一次促销时再次尝试,现在你不得不等待20次、40次、80次……

只有在人类用户不太可能在不到10次销售中获得两次BOC的情况下,这才真正有用。适当地调整数字。

我喜欢BradC的回答(使用Ned Batchelder文章中的建议),但我想在此基础上再增加一个层次。您不仅可以随机化字段名称,还可以随机化字段位置和使它们不可见的代码。

Now, this last bit is hard part and I don't know exactly how to do it, but someone with more JavaScript and CSS experience might be able to figure it out. Of course, you can't just keep the same positions all the time, because the scripters will just figure out that the element with position (x,y) is the real one. You would have to have some code that changes the positioning of form elements relative to other elements in order to move them off the page, overlay them on each other, etc. Then obfuscate the code that does this with some randomness introduced into it. Automatically change the obfuscation daily, before a new item is made available. The idea is that without a proper CSS and JavaScript implementation (and code to read layout of the page as a human would) a bot won't be able to figure out which elements are being shown to the user. Your server-side code, of course, knows which fields are real and which are fake.

总而言之:

字段名是随机的 字段顺序是随机的 字段隐藏代码很复杂 字段隐藏代码是随机混淆的 服务器端代码每天自动更改随机因子

在你给出的限制条件下,我不认为有办法避免某种形式的“军备竞赛”,但这并不意味着一切都完了。如果你能在军备竞赛中实现自动化,而编剧不能,那么你每次都能获胜。

我的解决方案是,通过为“机器人和脚本”设置大约10分钟的延迟,让屏幕抓取变得毫无价值。

以下是我的做法:

记录并识别任何重复作案的人。

你不需要记录每次点击的每个IP地址。大概每20次点击只录一次。一个惯犯仍然会在随机的偶尔跟踪中出现。

保留大约10分钟前页面的缓存。 当重复攻击者/机器人攻击您的网站时,给他们10分钟前的缓存页面。

他们不会马上意识到他们得到的是一个旧网站。他们可以把它刮掉,但他们不会再赢得任何比赛了,因为“真人”会有10分钟的领先优势。

好处:

没有麻烦或问题的用户(如验证码)。 完全在服务器端实现。(不依赖Javascript/Flash) 提供一个较旧的缓存页面的性能强度应该小于活动页面。这样实际上可以减少服务器的负载!

缺点

需要跟踪一些IP地址 需要保持和维护旧页面的缓存。

您可以尝试让脚本更难阅读价格。最简单的方法是将其转换为图像,但文本识别算法仍然可以解决这个问题。如果有足够多的脚本编写人员能够解决这个问题,您可以尝试对该图像应用类似验证码的东西,但显然是以牺牲用户体验为代价的。而不是图像,价格可以在一个flash应用程序。

或者,您可以尝试设计一种方法,以某种不影响呈现的方式在页面中“洗牌”HTML。我一时想不出一个好的例子,但我确信它在某种程度上是可行的。

那么使用Flash呢?

是的,我知道使用Flash的开销,加上一些用户将无法购买这些垃圾(即iPhone用户),这可能会造成不利影响,但在我看来,Flash可以防止屏幕抓取或至少使其变得困难。

我错了吗?

编辑添加

在你的提交表单上添加几个“隐藏”字段怎么样,就像我下面发现的那样:

Actually, best practice seems to be to use two hidden fields, one with an initial value, and one without. It's the rare bot which can ignore both fields. Check for one field to be blank, and the other to have the initial value. And hide them using CSS, not by making them "hidden" fields: .important { display : none ; } Please don't change the next two fields. Bots tend to like fields with names like 'address'. The text in the paragraph is for those few rare human beings who have a non-CSS capable browser. If you're not worried about them, you can leave it out. In the logic for processing the form, you'd do something like: if (address2 == "xyzzy" and address3 == "") { /* OK to send / } else { / probably have a bot */ }