From 14bd999ada56e20ffc355ef32d7a8a0bbf9d1032 Mon Sep 17 00:00:00 2001 From: William Heimbigner Date: Tue, 26 Jun 2007 09:17:21 +0000 Subject: new commands, users, hilights, rules, bugfixes, and all sorts of other good stuff --- config-default/channels.xml | 121 ++++++++++++++++++++++++++++---------------- config-default/commands.xml | 39 ++++++++++++-- config-default/settings.xml | 1 + config-default/users.xml | 8 +-- meta.pl | 3 +- modules/event.pl | 32 ++++++++++++ modules/inspect.pl | 15 +++--- modules/util.pl | 6 +-- modules/xml.pl | 17 ++++++- 9 files changed, 180 insertions(+), 62 deletions(-) diff --git a/config-default/channels.xml b/config-default/channels.xml index e738bfa..9b85be3 100644 --- a/config-default/channels.xml +++ b/config-default/channels.xml @@ -1,24 +1,4 @@ - - - White_cat - - - #wikimedia-ops - - - - - numist - quux - HentaiXP - TechSalvager - xyr - njan - JonathanD - Cpudan80 - - @@ -36,7 +16,7 @@ WildPikachu nalioth - xyr + seanw quux denny Fieldy @@ -47,63 +27,112 @@ ##linux-ops WildPikachu - .* WildPikachu - xyr + seanw quux denny Fieldy numist PhilKC - - ##linux-ops - + + + + + numist + quux + HentaiXP + TechSalvager + seanw + njan + JonathanD + Cpudan80 + - + - vishwin60 + Shadow_mil + newmanbe + + + + + White_cat #wikimedia-ops - + - Shadow_mil - newmanbe + Lcarsdata + + #wikimedia-ops + - + + ^mode \S+ \+b (.*)$ + .*Fags! Fags! Fags!.* - AppleBoy - xyr + seanw + Pilotguy + Eagle-101 + Mbimmler + skenmy + Ral315 + Karlprof + tomaw Fabexplosive - Crazytales2 + Krimpet + ST47 + AndrewB + stylus #wikimedia-ops - ^mode \S+ \+b (.*)$ - .*Fags! Fags! Fags!.* + White_Cat AppleBoy Soms - xyr - White_Cat + Pilotguy + ST47 + seanw + + + #wikimedia-ops + + + + + vishwin60 + + + #wikimedia-ops + + + + + seanw + Eagle-101 + Mbimmler + Pilotguy + ST47 + skenmy #wikimedia-ops @@ -113,31 +142,37 @@ 15:45 - ircbl.ahbl.org requested by ChanServ tinyurl\.com/ypvk4n .* ^DCC SEND |\bDCC SEND "?[A-Za-z0-9]+"? \d+ \d+ \d+ DCC SEND \bDCC SEND + ^... DDOS COUNTDOWN ...$ via paypal if you DoS somone for + dnsbl.dronebl.org + rbl.efnet.org http://exotics\.ezbbforum\.com 10:30 5:3 - 5:3 ([^ ]{4,} +)\1{5,} + goatse\.cz 3:20 ^startkeylogger$|^stopkeylogger$ \bstartkeylogger\b|\bstopkeylogger\b http://\S+\.on\.nimp\.org ^lesbian..$ + i=magical + 5:3 + 5:3 ^cupid..$ MUDKIP.. 150:20 .* - \.com/sms.exe - dnsbl.dronebl.org RED ARMY OF LOL + \.com/sms.exe + hello sir, my name is Chris Benoit and I am a WWE MASS MURDERER. + sure are a ?lot of wikifag AfterDeath diff --git a/config-default/commands.xml b/config-default/commands.xml index 4d543c9..77ee1c7 100644 --- a/config-default/commands.xml +++ b/config-default/commands.xml @@ -1,4 +1,38 @@ + + privmsg($event->{to}->[0], "$result results found."); + ]]> + + + {channel}->{$chan}->{hilights}->{$level}}; + push(@tmphl, $nick); + $::channels->{channel}->{$chan}->{hilights}->{$level} = \@tmphl; + writeChannels(); + $conn->privmsg($event->{to}->[0], "$nick added to $level risk hilights for $chan"); + ]]> + + + {channel}->{$chan}->{hilights}->{$risk}}; + @ppl = grep { lc $_ ne lc $nick } @ppl; + $::channels->{channel}->{$chan}->{hilights}->{$level} = \@ppl; + } + writeUsers(); + $conn->privmsg($event->{to}->[0], "kthxbai $nick"); + ]]> + join($1); @@ -59,9 +93,4 @@ chomp @eline; ]]> - - sl("remove $event->{to}->[0] $1"); - ]]> - diff --git a/config-default/settings.xml b/config-default/settings.xml index c7e693f..f90dde6 100644 --- a/config-default/settings.xml +++ b/config-default/settings.xml @@ -17,6 +17,7 @@ #wikipedia-en-roads-us ##windows #wikimedia-commons + #wikimedia-commons-social logs/$chan diff --git a/config-default/users.xml b/config-default/users.xml index 54ef0df..555ac73 100644 --- a/config-default/users.xml +++ b/config-default/users.xml @@ -1,10 +1,12 @@ - - + - + + + + diff --git a/meta.pl b/meta.pl index 42b30ab..3f54a65 100755 --- a/meta.pl +++ b/meta.pl @@ -13,7 +13,7 @@ use POSIX qw(strftime); @::eline=(); $::pass = ''; -my @modules = qw/Xml Util Inspect Services Log Command Event Classes Actions/; +my @modules = qw/Xml Util Inspect Services Log Command Event Classes Actions Mysql/; require 'modules/' . lc $_ . '.pl' foreach @modules; @@ -46,6 +46,7 @@ sub init { $host = ${$::settings->{server}}[rand @{$::settings->{server}}]; print "Connecting to $host\n"; $irc->debug($debug); + sql_connect(); $conn = $irc->newconn( Server => $host, Port => $::settings->{port} || '6667', Nick => $::settings->{nick}, diff --git a/modules/event.pl b/modules/event.pl index 77583e4..2feb915 100644 --- a/modules/event.pl +++ b/modules/event.pl @@ -234,6 +234,38 @@ sub whois_end { $::idqueue{$who} = []; } +sub whois_user { + my ($conn, $event2) = @_; + my $lnick = lc $event2->{args}->[1] + unless (defined($::sn{$lnick})) { + $::sn{$lnick} = {}; + } + $::sn{$lnick}{gecos} = $event2->{args}->[5]; + $::sn{$lnick}{user} = $event2->{args}->[2]; + $::sn{$lnick}{host} = $event2->{args}->[3]; + if (defined( $::needgeco{$lnick} )) { + inspect(shift($::needgeco{$lnick})); + delete $::needgeco{$lnick} if $::needgeco{$lnick} eq (); + } +} +#<<< :kubrick.freenode.net 311 AntiSpamMeta AfterDeath i=icxcnika atheme/troll/about.linux.afterdeath * :[[User:WHeimbigner]] +#Trying to handle event 'whoisuser'. +#Handler for 'whoisuser' called. +#<<< :kubrick.freenode.net 319 AntiSpamMeta AfterDeath :#nslu2-general @#bash @##asb-testing +#vandalism-en-wp +#thetestwiki #arbchat #wikipedia-social #wikipedia-en #wikimedia-stewards #wikimedia-irc @##krypt77 #wikipedia #freenode #hyperion ##linux #gentoo #debian ##windows #defocus #atheme.org #freenode-dev +##asb-nexus #houseofhack ##linux-ops @#baadf00d #wikimedia-ops #ubuntu ##socialites +#Trying to handle event 'whoischannels'. +#Handler for 'whoischannels' called. +#<<< :kubrick.freenode.net 312 AntiSpamMeta AfterDeath irc.freenode.net :http://freenode.net/ +#Trying to handle event 'whoisserver'. +#Handler for 'whoisserver' called. +#<<< :kubrick.freenode.net 320 AntiSpamMeta AfterDeath :is identified to services +#Trying to handle event 'whoisvworld'. +#Handler for 'whoisvworld' called. +#<<< :kubrick.freenode.net 318 AntiSpamMeta afterdeath :End of /WHOIS list. +#Trying to handle event 'endofwhois'. +#Handler for 'endofwhois' called. + + + sub on_bannedfromchan { my ($conn, $event) = @_; $conn->privmsg('ChanServ', "unban $event->{args}->[1]"); diff --git a/modules/inspect.pl b/modules/inspect.pl index 3837ba9..76b520f 100644 --- a/modules/inspect.pl +++ b/modules/inspect.pl @@ -4,16 +4,18 @@ use strict; use List::Util qw(first); #my @ignored = (); +@::ignored = (); sub inspect { our ($conn, $event) = @_; my (%conx, %monx); our (%aonx, %dct, $rev, $chan, $id); - %aonx=(); %dct=(); $rev=""; $chan=""; $id=""; + %aonx=(); %dct=(); $rev; $chan=""; $id=""; my (@dnsbl, @unpakt, @uniq, @cut); my ($match, $txtz, $iaddr); my @override = []; our $unmode=''; + my $nick = lc $event->{nick}; return if (defined(first { ( lc $event->{nick} eq lc $_ ) } @::eline)); return if (defined(first { ( lc $event->{user} eq lc $_ ) } @::eline)); return if (defined(first { ( lc $event->{host} eq lc $_ ) } @::eline)); @@ -21,9 +23,9 @@ sub inspect { $rev = join('.', reverse(unpack('C4', $iaddr))).'.' if (defined $iaddr); %monx = defined($::channels->{channel}->{master}->{event}) ? %{$::channels->{channel}->{master}->{event}} : (); ## NB: isn't there a better way to do this with grep, somehow? -# foreach ( @ignored ) { -# return if (lc $event->{nick} eq $_); -# } + foreach ( @::ignored ) { + return if (lc $event->{nick} eq $_); + } foreach $chan ( @{$event->{to}} ) { next unless $chan =~ /^#/; %conx = defined($::channels->{channel}->{lc $chan}->{event}) ? %{$::channels->{channel}->{lc $chan}->{event}} : (); @@ -42,6 +44,7 @@ sub inspect { delete $dct{$_} foreach @override; foreach $chan (@{$event->{to}}) { foreach $id ( keys %dct ) { + sql_record($chan, $event->{nick}, $event->{user}, $event->{host}, $dct{$id}{risk}, $id, $dct{$id}{reason}); $txtz = "$dct{$id}{risk} risk threat: ". "Detected $event->{nick} $dct{$id}{reason} in $chan "; $txtz = $txtz . commaAndify(getAlert(lc $chan, $dct{$id}{risk}, 'hilights')) if (getAlert(lc $chan, $dct{$id}{risk}, 'hilights')); @@ -59,8 +62,8 @@ sub inspect { } } $conn->privmsg($_, $txtz) foreach getAlert($chan, $dct{$id}{risk}, 'msgs'); -# push(@ignored, lc $event->{nick}); -# $conn->schedule(10, sub { @ignored = grep { $_ ne lc $event->{nick} } @ignored; }); + push(@::ignored, lc $event->{nick}); + $conn->schedule(15, sub { @::ignored = grep { lc $_ ne lc $nick } @::ignored; }); } } } diff --git a/modules/util.pl b/modules/util.pl index 060eee0..fb10356 100644 --- a/modules/util.pl +++ b/modules/util.pl @@ -6,7 +6,7 @@ use strict; my %sf; my %oq; -my %RISKS = +%::RISKS = ( 'debug' => 10, 'info' => 20, @@ -91,8 +91,8 @@ sub getAlert { my ($c, $risk, $t) = @_; @_ = (); $c = lc $c; - foreach my $prisk ( keys %RISKS) { - if ( $RISKS{$risk} >= $RISKS{$prisk} ) { + foreach my $prisk ( keys %::RISKS) { + if ( $::RISKS{$risk} >= $::RISKS{$prisk} ) { push( @_, @{$::channels->{channel}->{master}->{$t}->{$prisk}} ) if defined $::channels->{channel}->{master}->{$t}->{$prisk}; push( @_, @{cs($c)->{$t}->{$prisk}} ) if defined cs($c)->{$t}->{$prisk}; } diff --git a/modules/xml.pl b/modules/xml.pl index 2cb2505..9e7e526 100644 --- a/modules/xml.pl +++ b/modules/xml.pl @@ -15,10 +15,11 @@ sub readXML { $::users = $xs1->XMLin( "$p/users.xml", ForceArray => 'person' ); $::xusers = $::users->{person}; $::commands = $xs1->XMLin( "$p/commands.xml", ForceArray => [qw/command/]); + $::mysql = $xs1->XMLin( "$p/mysql.xml", ForceArray => [] ); } sub writeXML { - my ( $p ) = @_; + my ( $p ) = $::cset; #@_; $p = 'default' if $p eq ''; $p = "config-$p"; $xs1->XMLout($::settings, RootName => 'settings', KeyAttr => ['id'], @@ -31,6 +32,20 @@ sub writeXML { $xs1->XMLout($::commands, RootName => 'commands', KeyAttr => ['id']) > io("$p/commands.xml"); } +sub writeChannels { + my ( $p ) = $::cset; #@_; + $p = 'default' if $p eq ''; + $p = "config-$p"; + $xs1->XMLout($::channels, RootName => 'channels', KeyAttr => ['id']) > io("$p/channels.xml"); +} + +sub writeUsers { + my ( $p ) = $::cset; #@_; + $p = 'default' if $p eq ''; + $p = "config-$p"; + $xs1->XMLout($::users, RootName => 'people', KeyAttr => ['id']) > io("$p/users.xml"); +} + sub Xml::killsub { undef &readXML; undef &writeXML; -- cgit v1.2.3