summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2015-12-20 03:22:44 +0400
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2015-12-20 03:22:44 +0400
commit9ff93cc7e050fbf7117413a17b74a4112b72183d (patch)
tree3e5c6991b0a3e832b952b0e5ee9dc99d98367434 /lib
parente052f5f45a96b9bf5ad4cea10a0533b724cc3a19 (diff)
Added ability to have regex-based blacklisting
Diffstat (limited to 'lib')
-rw-r--r--lib/ASM/Classes.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/ASM/Classes.pm b/lib/ASM/Classes.pm
index 8c874b5..325b71d 100644
--- a/lib/ASM/Classes.pm
+++ b/lib/ASM/Classes.pm
@@ -16,6 +16,7 @@ sub new
my $tbl = {
"strbl" => \&strbl,
"strblnew" => \&strblnew,
+ "strblpcre" => \&strblpcre,
"dnsbl" => \&dnsbl,
"floodqueue" => \&floodqueue,
"floodqueue2" => \&floodqueue2,
@@ -395,6 +396,7 @@ sub strblnew {
my ($chk, $xid, $event, $chan) = @_;
my $match = lc $event->{args}->[0];
foreach my $id (keys %{$::blacklist->{string}}) {
+ next unless $::blacklist->{string}->{$id}->{type} eq "string";
my $line = lc $::blacklist->{string}->{$id}->{content};
my $idx = index $match, $line;
if ( $idx != -1 ) {
@@ -408,6 +410,24 @@ sub strblnew {
return 0;
}
+sub strblpcre {
+ my ($chk, $xid, $event, $chan) = @_;
+ my $match = lc $event->{args}->[0];
+ foreach my $id (keys %{$::blacklist->{string}}) {
+ next unless $::blacklist->{string}->{$id}->{type} eq "pcre";
+ my $line = lc $::blacklist->{string}->{$id}->{content};
+ my $idx = index $match, $line;
+ if ( $match =~ /$line/ ) {
+ my $setby = $::blacklist->{string}->{$id}->{setby};
+ $setby = substr($setby, 0, 1) . "\x02\x02" . substr($setby, 1);
+ return defined($::blacklist->{string}->{$id}->{reason}) ?
+ "id $id added by $setby because $::blacklist->{string}->{$id}->{reason}" :
+ "id $id added by $setby for no reason";
+ }
+ }
+ return 0;
+}
+
sub nick {
my ($chk, $id, $event, $chan) = @_;
if ( lc $event->{nick} eq lc $chk->{content} ) {