问题原文
原帖链接 · Mike -- No longer here · CC BY-SA 3.0
I was checking my server via awstats to see who was visiting my site and I have a user-agent of the following value:
}__test|O:21:\
Some research has lead me to believe that someone was trying to hack my server.
To prevent such things from happening, what are the syntax rules in determining that a user agent string is 100% legitimate and not some hacker-crafted string? For example, what characters are/are not allowed in a proper user-agent string and do some characters need to be in a certain order?
社区高分解答
原帖链接 · John Conde · CC BY-SA 3.0
There are no rules. A user agent can be anything.
There's no reasonable way to whitelist user agents as there are a lot of legitimate ones and you do not want to accidentally block a legitimate user. There's also no way to block bad user agents because, once again, there is no standard way to determine if a user agent represents a bad user.
If you want to try to block bad bots you can compare a user agent against this database and see who it is and then make a semi-educated decision about whether you should block it or not. There are also some attempts to maintain lists of bad user agents but I don't know how current they are and new user agents appear every day.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
