2015-08-15 10:32:11 +02:00
|
|
|
|
# Copyright (C) 2013–2015 Alex Schroeder <alex@gnu.org>
|
2013-08-15 23:46:31 +02:00
|
|
|
|
#
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify it under
|
|
|
|
|
|
# the terms of the GNU General Public License as published by the Free Software
|
|
|
|
|
|
# Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
|
|
# version.
|
|
|
|
|
|
#
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
#
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License along with
|
|
|
|
|
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
#
|
|
|
|
|
|
# This file must load before logbannedcontent.pl such that quick
|
|
|
|
|
|
# editors will be logged.
|
|
|
|
|
|
|
2015-03-27 03:01:01 +02:00
|
|
|
|
use strict;
|
2015-08-18 10:48:03 +02:00
|
|
|
|
use v5.10;
|
2015-03-27 03:01:01 +02:00
|
|
|
|
|
2014-08-21 22:23:23 +02:00
|
|
|
|
AddModuleDescription('ban-quick-editors.pl', 'Banning Quick Editors');
|
2013-08-15 23:46:31 +02:00
|
|
|
|
|
2015-08-15 10:32:11 +02:00
|
|
|
|
our ($q, $Now, %RecentVisitors, $SurgeProtection);
|
2015-03-27 03:01:01 +02:00
|
|
|
|
|
2015-04-11 23:41:33 +03:00
|
|
|
|
*BanQuickOldUserIsBanned = \&UserIsBanned;
|
|
|
|
|
|
*UserIsBanned = \&BanQuickNewUserIsBanned;
|
2013-08-15 23:46:31 +02:00
|
|
|
|
|
|
|
|
|
|
sub BanQuickNewUserIsBanned {
|
|
|
|
|
|
my $rule = BanQuickOldUserIsBanned(@_);
|
|
|
|
|
|
if (not $rule
|
|
|
|
|
|
and $SurgeProtection # need surge protection
|
|
|
|
|
|
and GetParam('title')) {
|
2015-07-31 09:35:51 +02:00
|
|
|
|
my $name = GetParam('username', $q->remote_addr());
|
2013-08-15 23:46:31 +02:00
|
|
|
|
my @entries = @{$RecentVisitors{$name}};
|
|
|
|
|
|
# $entry[0] is $Now after AddRecentVisitor
|
|
|
|
|
|
my $ts = $entries[1];
|
|
|
|
|
|
if ($Now - $ts < 5) {
|
|
|
|
|
|
return "fast editing spam bot";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return $rule;
|
|
|
|
|
|
}
|