Apache-BruteWatch
view release on metacpan or search on metacpan
lib/Apache/BruteWatch.pm view on Meta::CPAN
sub attacks {
my ( $r, $username, $time, $dbh ) = @_;
my $count;
my $old = $r->dir_config('BruteMaxTime');
my $sth = $dbh->prepare(
"select count(ID) from bruteattempt where
username = ? and ts > $time - $old"
);
$sth->execute($username);
$sth->bind_columns( \$count );
$sth->fetch;
$sth->finish;
my $forgive = $r->dir_config('BruteForgive');
$sth = $dbh->prepare(
"delete from bruteattempt where
ts > $time - $forgive"
);
$sth->execute;
$sth->finish;
lib/Apache/BruteWatch.pm view on Meta::CPAN
my $count;
warn "Attempting to notify";
# Have they already been notified?
my $sth = $dbh->prepare(
"select count(ID) from brutenotified
where username = ?"
);
$sth->execute($username);
$sth->bind_columns( \$count );
$sth->fetch;
$sth->finish;
return if $count;
my $notify = $r->dir_config('BruteNotify');
my $message = qq~
Apache::BruteWatch
( run in 2.200 seconds using v1.01-cache-2.11-cpan-2398b32b56e )