User:Devkyu/AntiSpam

From Wikimon

AntiSpam Stuff

Courtesy of GreenReaper[edit]

You doesn't seem to have much in the way of protection. Consider these extensions?

  • SimpleAntiSpam - trivial, often works well
  • ForcePreview - good luck saving if they don't know to preview first
  • SpamBlacklist - set it up to use Wikimedia's lists and you catch a lot
  • AntiBot - an extensible framework, comes with one useful thing. Make sure you copy the plugin into the active directory else it won't do anything. Our modification of the genericFormEncoding.php:
$wgHooks['EditFilterMerged'][] = 'AntiBot_GenericFormEncoding::onEditFilterMerged';
class AntiBot_GenericFormEncoding {
       function onEditFilterMerged( $editPage, $text, &$hookError ) {
               if ( !function_exists( 'apache_request_headers' ) ) {
                       return true;
               }
               $headers = apache_request_headers();
               if ( isset( $headers['Content-Type'] )
                       && $headers['Content-Type'] == 'application/x-www-form-urlencoded' )
               {
                       global $wgUser;
                       if ( !$wgUser->isAllowed( 'noratelimit' ) && !$wgUser->isAllowed( 'bot' )) {
                               if ( AntiBot::trigger(__CLASS__) == 'fail' ) {
                                       return false;
                               }
                       }
               }
               return true;
       }
}
  • AbuseFilter - configurable blocks against particular behaviours. A couple of filters we use on WikiFur (use import on Special:AbuseFilter to apply):

{"row":{"af_id":"1","af_pattern":"!(\"autoconfirmed\" in user_groups) &\r\nset_var('lc_added_lines',lcase(added_lines)) &\r\nset_var('lc_removed_lines',lcase(removed_lines)) &\r\n(\r\n count(\"http:\/\/\", lc_added_lines) > count(\"http:\/\/\", lc_removed_lines) + 7 &\r\n !count(\"<ref\", lc_added_lines) > count(\"<ref\", lc_removed_lines)\r\n)","af_user":"149","af_user_text":"GreenReaper","af_timestamp":"20091020073009","af_enabled":"1","af_comments":"Warn non-autoconfirmed users adding more than seven external links to an article at once. Those adding references are exempted from the number of external links restriction.","af_public_comments":"Link spamming by anonymous or recently-registered users","af_hidden":"0","af_hit_count":"5792","af_throttled":"0","af_deleted":"0","af_actions":"warn,tag","af_global":"0"},"actions":{"tag":{"action":"tag","parameters":["linkspam"]},"warn":{"action":"warn","parameters":["abusefilter-warning"]}}}

{"row":{"af_id":"2","af_pattern":"set_var('lc_added_lines',lcase(added_lines)) &\r\nset_var('lc_removed_lines',lcase(removed_lines)) & (\r\ncount(\"[link=\", lc_added_lines) > count(\"[link=\", lc_removed_lines) |\r\ncount(\"[url=\", lc_added_lines) > count(\"[url=\", lc_removed_lines) |\r\ncount(\"[img\", lc_added_lines) > count(\"[img\", lc_removed_lines) |\r\ncount(\"<a href=\", lc_added_lines) > count(\"<a href=\", lc_removed_lines) |\r\ncount(\"<img\", lc_added_lines) > count(\"<img\", lc_removed_lines) )","af_user":"149","af_user_text":"GreenReaper","af_timestamp":"20091020072936","af_enabled":"1","af_comments":"Prevents link, url, img and href misuse (and spamming).","af_public_comments":"Invalid linking or image syntax","af_hidden":"0","af_hit_count":"8062","af_throttled":"0","af_deleted":"0","af_actions":"warn,tag","af_global":"0"},"actions":{"tag":{"action":"tag","parameters":["wronglinksyntax"]},"warn":{"action":"warn","parameters":["abusefilter-wronglinksyntax"]}}}

{"row":{"af_id":"3","af_pattern":"!(\"bot\" in user_groups) &\r\n(set_var('lc_added_lines',lcase(added_lines)) | true) &\r\ncount(\"[[image:\", lc_added_lines) > 0","af_user":"149","af_user_text":"GreenReaper","af_timestamp":"20120929223126","af_enabled":"1","af_comments":"This should also prevent spam which uses [[Image:\r\nAllow the Interwiki bot","af_public_comments":"Discourage old-style [[Image: syntax (use [[File: instead)","af_hidden":"0","af_hit_count":"1188","af_throttled":"0","af_deleted":"0","af_actions":"warn,disallow","af_global":"0"},"actions":{"disallow":{"action":"disallow","parameters":[""]},"warn":{"action":"warn","parameters":["abusefilter-imagesyntax"]}}}