检测服务器上的机器人?
Stackoverflow 是如何做到这一点的,因为这就是我想做的:检查数据,如果它看起来像机器人,则请求人工验证。
此外,这还需要在 Java(最好)、Perl 或 PHP 上完成。
This question sort of extends my other question on robots and captcha. I did what everyone recommend (thanks everyone!), however is it at all possible to detect a robot on the server first? For Example (Once again, I will use Stackoverflow as a reference): Sometimes when I ask a question, Stackoverflow comes back asking me to verify if I am human.
However, sometimes it does not.
How does Stackoverflow do that, because that is what I want to do: Check data and if it looks like a robot, request human verification.
Also this needs to be done on Java (preferably), Perl or PHP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 StackOverflow 上,这是通过太快地执行同一任务太多次或太快地执行多个任务来完成的。
如果您想模仿这一点,您可以跟踪最近请求的数量和时间,并检查一切是否在您的限制范围内。如果不是,请重定向到验证码。
不幸的是,我没有足够的 Java EE 经验来提供任何代码,但希望我的方法能给您一些想法。
On StackOverflow, it's done by performing the same task too many times too quickly or performing multiple tasks too quickly.
If you want to emulate this, you can keep track of the number and time(s) of recent requests and check to see that everything is within your limits. If it isn't, redirect to a CAPTCHA.
Unfortunately, I don't have enough Java EE experience to provide any code, but hopefully my approach will give you some idea(s).
简单的方法是记录活动(点击、评论等),然后检查这些活动之间的频率和相似性。您通常可以通过查找重复执行的类似任务来检测机器人。
如果您真的认真对待机器人检测,请记录每次击键和鼠标移动。普通用户在打字和浏览网站时会遇到一定比例的错误和不确定性。一个 100% 无拼写错误的用户,能够轻松快速地浏览网站(将鼠标从 a 点直线移动到 b 点),而无需使用后退按钮,那么该用户很可能是机器人。
The simple method would be to log activity (clicks, comments, ect.) and then check the frequency and similarity between these. You can usually detect robots by looking for similar tasks performed repeatedly.
If you are really serious about robot detection, log every keystroke and mouse movements. Regular users have a percentage of error and uncertainty associated with typing and navigating the site. A 100% typo free user that navigates the site easily and quickly (moving the mouse on a straight line from point a to point b) without ever going for the back button is very likely to be a bot.