笔记 by 车东

[MT]:垃圾评论的关键词词频统计

MT做为最成功的blog发布系统之一被spammer叮上有好几年了,虽然在mt 3.2以后垃圾评论的管理已经加强很多,但spammer对于mt的spamlookup的适应速度也是非常快的。昨天做了几个脚本统计,分析了一下垃圾评论中的关键词特征:数据源来自最近十天收到的2000多篇垃圾评论,目前收到的mt spam以英文为主。

30207 http 是的,获得反向链接是spammer最主要的目的:在PageRank做为 22256 biz .biz域名最近是不是降价了?这是spammer使用的主要域名后缀 22181 resea 21318 gay 10600 href spam中一般包含大量的html标签,后面还有 _blank target等; 5018 com 4974 boy 3134 info 3075 teen 2426 adobe 除了色情类的关键词,国外还有经常推销打折软件,这在中国是很难想像的, 2393 porn 2373 acrobat 2282 nude 2281 video 2267 sex 2082 url 1821 male 1653 html 1575 movie 1547 guys 1534 www 1529 strong 1297 pic 1291 cock 1278 pro 1270 man 1124 twinks 1054 anal 983 xxx 977 young 941 hardcore 880 picture 812 black 775 best 764 regards 744 buy 733 hot 732 fucking 728 blog 726 target 726 _blank 723 gallery 716 the 704 russian 696 lide 680 online 677 viagra 639 ultram 632 150m 623 weight 615 valium 609 blogspot blogspot是spammer经常使用的免费hosting之一。 588 cum 584 free 570 naked 562 kissing 559 sexo 556 free6xxx 545 ass 544 phentermine 528 rapidforum 528 64751 501 mujweb 490 and 489 cute 464 valiumonline 442 yahoo yahoo邮箱是spammer常用的fake邮箱地址; 436 cheap 428 lose 401 net 380 xxxcredo 376 freesexcredo 366 myteeundercar 360 freexxxcredo 341 site 336 pornzzz 328 you 321 found 306 dan 304 page 304 org 296 post 292 see 292 fuck 292 credosex 289 college 288 clip 288 adult 286 little 285 model 277 gratis 267 praize 259 discount 258 big 236 nice 232 fat 224 three 224 amateur 223 fc2 219 with

统计脚本: 1 从mt_comment表中提取出目前没有公开发表的评论作者,邮件地址,链接地址,评论文字 SELECT comment_author , comment_email , comment_url , comment_text FROM mt_comment WHERE comment_visible =0 INTO OUTFILE ‘/tmp/comment.log’

comment_visible表示评论未公开;

2 提取评论中的高频词: perl -pe ‘~s/\W/\n/g’ comment.log |awk ‘{if (length($1)> 1) print tolower($0)}’|sort|uniq -c|sort -rn | head -100 perl -pe ‘~s/\W/\n/g’ 将所有的非字符集变成回车(一行一个词) awk ‘{if (length($1)> 1) print tolower($0)}’ 滤出长度大于1的字符串,字符统一变成小写 sort|uniq -c|sort -rn | head -100 排序,计数,汇总,取top 100个

改进:MT应该将定期统计这些关键词,并能方便的加入到MT的关键词过滤中去。

2007-07-30更新: 对trackback中的统计 导出脚本: SELECT tbping_excerpt , tbping_title , tbping_source_url FROM mt_tbping WHERE tbping_visible =0 INTO OUTFILE ‘/tmp/tb.log’;

统计脚本: perl -pe ‘~s/\W/\n/g’ /tmp/tb.log |awk ‘{if (length($1)> 1) print tolower($0)}’|sort|uniq -c|sort -rn | head -100

统计结果: 11185 buy 10939 phentermine 5043 cheap 4403 tramadol 3328 cialis 3288 xanax 2306 prescription 2027 viagra 1719 ambien 1542 effects 1538 valium 1481 lexapro 1416 indymedia 1229 flyfolder 1129 cod 1090 ultram 1028 soma 835 diet 814 paxil 765 pharmacy 729 ephedra 725 pills 724 levitra 691 discount 645 purchase