只看 user agent 擋 spam 有沒有用?

下是不知多久前積累下來的 blog spam 統計,和上次一樣,只看 user agent:


mysql> select count(*) count, substr(comment_agent,1,50) agent from wp_comments where comment_approved = 'spam' group by comment_agent order by count desc limit 10;

count agent
8780
4585 Opera/9.0 (Windows NT 5.1; U; en)
1837 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
1430 –– WordPress/2.1-alpha3
1179 TrackBack/1.02
212 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;…
30 User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Win…
20 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;…
10 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
6 Incutio XML-RPC –– WordPress/4.01

今次比上次的集中很多,淨是頭三種加起來已經超過八成了(總數為 18419)。如果留意排行榜最高幾種,將一些不像 user agent 的過濾掉,會怎麼樣?單是計算標記了深色那三個,已經隔絕 6 成 spam 了。6 成夠不夠?絕對不夠。但起碼,用最簡單的方法先濾掉 6 成的 spam,餘下的才用較強的方法去處理,可以減輕負荷(縱使我的 blog 沒有甚麼負荷,哈哈)。這樣稱為 defense in depth,使用多種方法防衛,才算得上是比較安全。如果這世界有一種方法能夠 100% 擋掉全世界的 spam,發明的人老早就發達了,不用現在連電郵都信不過。WordPress 那羣跟尾狗只懂阿諛奉承而已,連 MD5 也可以稱為加密,有甚麼說不出。

現在就這種方法擋一下自己的站,看看有甚麼效果。

Tagged as , , • Categorized as Blog

Leave a Reply

E-mail is not disclosed nor shared. Required fields are marked *