LimitExternalLinks

This is a method to prevent WikiSpam like the following:

[http://www.king.com.cn 工业设计]
[http://www.king.com.cn 产品设计]
[http://www.king.com.cn 外观设计]
[http://www.king.com.cn 结构设计]
[http://www.king.com.cn 造型设计]
[http://www.king.com.cn 工业产品造型设计]
[http://www.king.com.cn 工业造型设计]
[http://www.king.com.cn 结构设计]
[http://www.king.com.cn 工业设计公司]
[http://www.king.com.cn 设计]
[http://www.king.com.cn industrial design]
[http://www.king.com.cn product design]
[http://www.king.com.cn/bbs 工业设计论坛]
[http://www.king.com.cn/portfolio.htm  产品设计]
[http://www.king.com.cn/engineering.htm  结构设计]

What is characteristic about it? There were several links to a single domain ("king.com.cn") added in one post.

Here's a script to test this, including a test run on the EmacsWiki:SiteMap.

# Count the new new domains added in URLs.
# www.FOO.BAR
# http://foo.bar

sub SpamAdded {
  my ($old, $new) = @_;
  my %domains = ();
  while ($new =~ m!(\.|http://)([-a-z0-9]+\.[a-z][a-z][a-z]?)\b!ig) {
    $domains{lc($2)}++;
  }
  while ($old =~ m!(\.|http://)([-a-z0-9]+\.[a-z][a-z][a-z]?)\b!ig) {
    $domains{lc($2)}--;
  }
  my $max = 0;
  foreach my $i (values(%domains)) {
    $max = $i if $i > $max;
  }
  if ($max > 2) {
    return "Spam!";
  }
}

# Test Code

use LWP::UserAgent;

sub GetRaw {
  my $uri = shift;
  my $ua = LWP::UserAgent->new;
  my $response = $ua->get($uri);
  return $response->content;
}

# http://www.emacswiki.org/cgi-bin/wiki?action=browse&diff=1&id=SiteMap&revision=538&diffrevision=537&Vergleichen=Vergleichen

sub Test {
  my ($id, $start, $stop) = @_;
  print $id, ":\n";
  for (my $i = $start; $i < $stop; $i++) {
    my $j = $i + 1;
    print $i, ' -> ', $j, ' ',
      SpamAdded(GetRaw("http://www.emacswiki.org/cgi-bin/wiki?action=browse;id=$id;revision=$i"),
		GetRaw("http://www.emacswiki.org/cgi-bin/wiki?action=browse;id=$id;revision=$j")),
		  "\n";
    sleep(5);
  }
}

Test('SiteMap', 537, 557);

The result:

/home/alex/src/oddmuse/modules $ perl spam.pl 
537 -> 538 
538 -> 539 
539 -> 540 
540 -> 541 
541 -> 542 Spam!
542 -> 543 
543 -> 544 
544 -> 545 
545 -> 546 
546 -> 547 Spam!
547 -> 548 
548 -> 549 
549 -> 550 
550 -> 551 
551 -> 552 
552 -> 553 
553 -> 554 
554 -> 555 
555 -> 556 
556 -> 557 

So two edits were recognized as spam.

However, this is what it looked like:

( ) (*) Revision 557 . . . . 2004-10-17 07:23 UTC by yonirabkinkatzenell -- Erased bolobo spam
        (minor)
(*) ( ) Revision 556 . . . . 2004-10-17 06:56 UTC by 218.104.201.30
( ) ( ) Revision 555 . . . . 2004-10-17 06:10 UTC by PierreGaston -- revert
( ) ( ) Revision 554 . . . . 2004-10-17 03:10 UTC by 218.80.149.186
( ) ( ) Revision 553 . . . . 2004-10-17 03:04 UTC by 218.80.149.186
( ) ( ) Revision 552 . . . . 2004-10-16 06:28 UTC by PierreGaston -- revert
( ) ( ) Revision 551 . . . . 2004-10-16 05:28 UTC by 218.104.201.30
( ) ( ) Revision 550 . . . . 2004-10-11 08:01 UTC by StefanKamphausen -- revert
( ) ( ) Revision 549 . . . . 2004-10-11 07:41 UTC by 219.238.6.194
( ) ( ) Revision 548 . . . . 2004-10-11 07:39 UTC by 219.238.6.194
( ) ( ) Revision 547 . . . . 2004-10-11 07:35 UTC by 219.238.6.194
( ) ( ) Revision 546 . . . . 2004-10-11 07:34 UTC by 219.238.6.194
( ) ( ) Revision 545 . . . . 2004-10-11 07:33 UTC by 219.238.6.194
( ) ( ) Revision 544 . . . . 2004-10-08 18:20 UTC by revert to 539 spam...
( ) ( ) Revision 543 . . . . 2004-10-08 10:29 UTC by lns-vlq-20-82-255-55-79.adsl.proxad.net
        (minor)
( ) ( ) Revision 542 . . . . 2004-10-08 10:28 UTC by lns-vlq-20-82-255-55-79.adsl.proxad.net
        (minor)
( ) ( ) Revision 541 . . . . 2004-10-07 07:36 UTC by PierreGaston -- revert to 539
( ) ( ) Revision 540 . . . . 2004-10-07 06:23 UTC by lzbiz (minor)
( ) ( ) Revision 539 . . . . 2004-10-02 05:46 UTC by DrewAdams -- Deemphasized building emacs from
        sources (not the place to *start*) (minor)
( ) ( ) Revision 538 . . . . 2004-09-30 15:12 UTC by PatrickAnderson -- made "Downloading and
        Installing Emacs" the second step
( ) ( ) Revision 537 . . . . 2004-09-18 14:06 UTC by AlexSchroeder (minor)

As you can see, reverts happened at 541, 544, 550, 552, 555, and 557.

Thus, the proposed method is not good enough. All the other spammers linked to various different domains.


CategoryWikiTechnology

Languages: