diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/classes.pl | 11 | ||||
| -rw-r--r-- | modules/inspect.pl | 9 | ||||
| -rw-r--r-- | modules/mysql.pl | 23 | ||||
| -rw-r--r-- | modules/xml.pl | 1 |
4 files changed, 36 insertions, 8 deletions
diff --git a/modules/classes.pl b/modules/classes.pl index 775eae6..f2372f2 100644 --- a/modules/classes.pl +++ b/modules/classes.pl @@ -79,7 +79,16 @@ sub dnsbl if (defined $rev) { my $iaddr = gethostbyname( "$rev$chk->{content}" ); my @dnsbl = unpack( 'C4', $iaddr ) if defined $iaddr; - return 1 if (@dnsbl); + my $strip; + if (@dnsbl) { + $strip = sprintf("%s.%s.%s.%s", @dnsbl); + print "found host (rev $rev) in $chk->{content} - $strip\n"; + } + if ((@dnsbl) && (defined($::dnsbl->{query}->{$chk->{content}}->{response}->{$strip}))) { + $::lastlookup=$::dnsbl->{query}->{$chk->{content}}->{response}->{$strip}->{content}; + # lol really icky hax + return 1; + } } return 0; } diff --git a/modules/inspect.pl b/modules/inspect.pl index faa4dd7..c86fd25 100644 --- a/modules/inspect.pl +++ b/modules/inspect.pl @@ -4,6 +4,7 @@ use strict; #use Data::Dumper; #use List::Util qw(first); +use String::Interpolate qw(interpolate); %::ignored = (); sub new @@ -45,11 +46,15 @@ sub inspect { } } delete $dct{$_} foreach @override; + my $mylastreason = $::lastreason; + my $evcontent = $event->{args}->[0]; + my $evhost = $event->{host}; foreach $chan (@{$event->{to}}) { foreach $id ( keys %dct ) { - $::db->record($chan, $event->{nick}, $event->{user}, $event->{host}, $::sn{lc $event->{nick}}->{gecos}, $dct{$id}{risk}, $id, $dct{$id}{reason}); + my $nicereason = interpolate($dct{$id}{reason}); + $::db->record($chan, $event->{nick}, $event->{user}, $event->{host}, $::sn{lc $event->{nick}}->{gecos}, $dct{$id}{risk}, $id, $nicereason); $txtz = "\x03" . $::RCOLOR{$::RISKS{$dct{$id}{risk}}} . "\u$dct{$id}{risk}\x03 risk threat [\x02$chan\x02]: ". - "\x02$event->{nick}\x02 - $dct{$id}{reason}; ping "; + "\x02$event->{nick}\x02 - ${nicereason}; ping "; $txtz = $txtz . ASM::Util->commaAndify(ASM::Util->getAlert(lc $chan, $dct{$id}{risk}, 'hilights')) if (ASM::Util->getAlert(lc $chan, $dct{$id}{risk}, 'hilights')); if (ASM::Util->cs(lc $chan)->{op} ne 'no') { if ($event->{type} eq 'topic') { #restore old topic diff --git a/modules/mysql.pl b/modules/mysql.pl index 22369e1..f0b7845 100644 --- a/modules/mysql.pl +++ b/modules/mysql.pl @@ -76,23 +76,36 @@ sub logg $string = $string . 'channel, '; } $string = $string . 'nick, user, host, geco'; - if ($table ne 'join') { + if (($table ne 'join') && ($table ne 'kick')) { $string = $string . ', content1'; } - if (($table eq 'kick') || ($table eq 'mode')) { + if ($table eq 'mode') { $string = $string . ', content2'; } + if ($table eq 'kick') { + $string = $string . ', victim_nick, victim_user, victim_host, victim_geco, content1'; + } $string = $string . ') VALUES ('; - if (($table ne 'nick') && ($table ne 'quit')) { + if (($table ne 'nick') && ($table ne 'quit') && ($table ne 'kick')) { $string = $string . $dbh->quote($event->{to}->[0]) . ", "; } + if ($table eq 'kick') { + $string = $string . $dbh->quote($event->{args}->[0]) . ", "; + } my $geco = $::sn{lc $event->{nick}}->{gecos}; $string = $string . $dbh->quote($event->{nick}) . ", " . $dbh->quote($event->{user}) . ", " . $dbh->quote($event->{host}) . ", " . $dbh->quote($geco); - if ($table ne 'join') { + if (($table ne 'join') && ($table ne 'kick')) { $string = $string. ', ' . $dbh->quote($event->{args}->[0]); } - if (($table eq 'kick') || ($table eq 'mode')) { + if ($table eq 'kick') { + $string = $string . ', ' . $dbh->quote($event->{to}->[0]); + $string = $string . ', ' . $dbh->quote($::sn{lc $event->{to}->[0]}->{user}); + $string = $string . ', ' . $dbh->quote($::sn{lc $event->{to}->[0]}->{host}); + $string = $string . ', ' . $dbh->quote($::sn{lc $event->{to}->[0]}->{gecos}); + $string = $string . ', ' . $dbh->quote($event->{args}->[1]); + } + if ($table eq 'mode') { $string = $string . ', ' . $dbh->quote($event->{args}->[1]); } $string = $string . ');'; diff --git a/modules/xml.pl b/modules/xml.pl index 1978af9..ce7712d 100644 --- a/modules/xml.pl +++ b/modules/xml.pl @@ -17,6 +17,7 @@ sub readXML { $::users = $::xs1->XMLin( "$p/users.xml", ForceArray => 'person'); $::commands = $::xs1->XMLin( "$p/commands.xml", ForceArray => [qw/command/]); $::mysql = $::xs1->XMLin( "$p/mysql.xml", ForceArray => []); + $::dnsbl = $::xs1->XMLin( "$p/dnsbl.xml", ForceArray => []); } sub writeXML { |
