3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-02 01:18:40 +02:00

Increase join flood detection to 4 joins within 30 minutes without a message; set join_watch -= 2 on join ban to allow two join attempts afterwards in order to give them a chance to rejoin

This commit is contained in:
Pragmatic Software 2010-06-05 17:45:41 +00:00
parent 4b342be290
commit 7bcfa52b25
3 changed files with 7 additions and 6 deletions

View File

@ -67,7 +67,7 @@ sub check_flood {
${ $self->message_history }{$nick}{$channel}{messages} = [];
}
print "$nick $channel joinwatch: ${ $self->message_history }{$nick}{$channel}{join_watch}\n";
$self->{pbot}->logger->log("$nick $channel joinwatch: ${ $self->message_history }{$nick}{$channel}{join_watch}\n");
#$self->{pbot}->logger->log("appending new message\n");
@ -93,7 +93,7 @@ sub check_flood {
my %msg = %{ @{ ${ $self->message_history }{$nick}{$channel}{messages} }[$length - $max_messages] };
my %last = %{ @{ ${ $self->message_history }{$nick}{$channel}{messages} }[$length - 1] };
$self->{pbot}->logger->log("Comparing $last{timestamp} against $msg{timestamp}: " . (int($last{timestamp} - $msg{timestamp})) . " seconds\n");
$self->{pbot}->logger->log("Comparing " . int($last{timestamp}) . " against " . int($msg{timestamp}) . ": " . (int($last{timestamp} - $msg{timestamp})) . " seconds\n");
if($last{timestamp} - $msg{timestamp} <= $max_time && not $self->{pbot}->admins->loggedin($channel, "$nick!$user\@$host")) {
if($mode == $self->{FLOOD_JOIN}) {
@ -101,6 +101,7 @@ sub check_flood {
$self->{pbot}->chanops->quiet_user_timed("*!$user\@$host", $channel, 60 * 60);
$self->{pbot}->logger->log("$nick!$user\@$host banned for one hour due to join flooding.\n");
$self->{pbot}->conn->privmsg($nick, "You have been banned from $channel for one hour due to join flooding.");
${ $self->message_history }{$nick}{$channel}{join_watch} = $max_messages - 2; # give them a chance to rejoin
}
} elsif($mode == $self->{FLOOD_CHAT}) {
${ $self->message_history }{$nick}{$channel}{offenses}++;
@ -141,7 +142,7 @@ sub check_flood {
} elsif($mode == $self->{FLOOD_CHAT}) {
${ $self->message_history }{$nick}{$channel}{join_watch} = 0;
}
print "$nick $channel joinwatch adjusted: ${ $self->message_history }{$nick}{$channel}{join_watch}\n";
$self->{pbot}->logger->log("$nick $channel joinwatch adjusted: ${ $self->message_history }{$nick}{$channel}{join_watch}\n");
} else {
#$self->{pbot}->logger->log("brand new nick addition\n");
# new addition

View File

@ -155,7 +155,7 @@ sub on_join {
my ($nick, $user, $host, $channel) = ($event->nick, $event->user, $event->host, $event->to);
#$self->{pbot}->logger->log("$nick!$user\@$host joined $channel\n");
$self->{pbot}->antiflood->check_flood($channel, $nick, $user, $host, "JOIN", 3, 90, $self->{pbot}->{FLOOD_JOIN});
$self->{pbot}->antiflood->check_flood($channel, $nick, $user, $host, "JOIN", 3, 60 * 30, $self->{pbot}->{FLOOD_JOIN});
}
sub on_departure {

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 143,
BUILD_DATE => "2010-06-04",
BUILD_REVISION => 144,
BUILD_DATE => "2010-06-05",
};
1;