From d7aa95f5ee6f1d03c707f5a1ecc87f6c3dee0b05 Mon Sep 17 00:00:00 2001 From: William Heimbigner Date: Wed, 30 May 2012 22:12:30 +0000 Subject: make rules private, properly handle ghosting/releasing, added a proxy list, much faster join/startup --- config-default/channels.xml | 182 ++++++++++++++++++++++++++++++++++---------- config-default/users.xml | 2 + meta.pl | 13 +++- modules/classes.pl | 14 +++- modules/event.pl | 40 +++++++++- modules/inspect.pl | 4 +- modules/services.pl | 18 +++-- modules/xml.pl | 1 + 8 files changed, 222 insertions(+), 52 deletions(-) diff --git a/config-default/channels.xml b/config-default/channels.xml index a23eebb..c9312b7 100644 --- a/config-default/channels.xml +++ b/config-default/channels.xml @@ -68,6 +68,10 @@ ##linux-ops + + + + @@ -76,6 +80,12 @@ + + + ttuttle + + + vegadark @@ -151,6 +161,7 @@ mquin ttuttle njan + ttuttle denny Gary JonathanD @@ -337,6 +348,22 @@ #wikimedia-ops + + + mbimmler + Bastique + Philippe + Cbrown1023 + StevenW + DenizG + Az1568 + Theo10011 + Ironholds + + + #wikimedia-ops + + Cbrown1023 @@ -363,6 +390,25 @@ jeremyb kibble Keegan + Thehelpfulone + Rjd0060 + + + #wikimedia-ops + + + + + Logan_ + Thehelpfulone + Tempodivalse + Tanvir + Barras + peteforsyth + Az1568 + Cbrown1023 + fschulenburg + Bastique #wikimedia-ops @@ -407,6 +453,22 @@ #wikimedia-ops + + + Austin + James_F + Duesentrieb + zwitter + DaBPunkt + APPER + mindspillage + Simetrical + Werdna + + + #wikimedia-ops + + Golbez @@ -501,6 +563,49 @@ #wikimedia-ops + + + Thehelpfulone + jamesofur + Nixeagle + DeltaQuad + Netalarm + JoeGazz84 + MacMed + Snowolf + + + #wikimedia-ops + #wikimedia-ops + + + + + anowlin + ragesoss + stwalkerster + chzz + Prodego + Deskana + Pathoschild + fetchcomms + BarkingFish + Cbrown1023 + Earwig + ldavis + annielin + PeterSymonds + Shirik + Fluffernutter + Thehelpfulone + + + #wikimedia-ops + + + + + werdan7 @@ -536,17 +641,55 @@ KFP Gfoley4 sonia + Pine #wikimedia-ops + + + lucasbfr + Deskana + Tiptoety + Avraham + DeltaQuad + WilliamH_UK + Thehelpfulone + Steven_Zhang + PeterSymonds + Shirik + + + #wikimedia-ops + #wikimedia-ops + + #wikimedia-ops + + + yannf + Dvortygirl + Cbrown1023 + Leftmost + flood + Versageek + Dmcdevit + msh210 + Amgine + TheDaveRoss_ + Wytukaze + Tawker + + + #wikimedia-ops + + @@ -558,45 +701,6 @@ - 5:3 - dnsbl.ahbl.org - (?i)w(.?)w\1w\1?.\1?a\1n\1o\1n\1t\1a\1l\1k\1?.\1?c\1o\1m - ^requested by ChanServ - blah - .* - .* - .* - ^DCC (SEND|S?CHAT) |\bDCC (SEND|S?CHAT) "?[A-Za-z0-9]+"? \d+ \d+ \d+ - \bDCC SEND - \bDCC SEND - \bDCC SEND - debugantispambotdebug - dnsbl.dronebl.org - rbl.efnetrbl.org - 10:20 - (?i)\bgnaa\b - (?i)\bgnaa\b - 5:20 - ^startkeylogger$|^stopkeylogger$ - \bstartkeylogger\b|\bstopkeylogger\b - (?i)(http://(\S+\.)?on\.nimp\.org|http://(\S+\.)?feenode.net|http://wikipaste\.eu|http://(\S+\.)?bioghost\.com|http://(\S+\.)?on\.zoy\.org|http://(lastmeasure|dirtysanchez|doom3|freeipods|halflife2|halo2|lastmeasure4|lastmeasureunified|softmeasure|traceroute)\.zoy\.org) - contentisuseless - .*!~NUMONE@.*!REAL_NAME - 4:4 - (?i).*eepsheep.* - 60:10 - dnsbl.njabl.org - .* - identify.*/msg .* identify <password> - ^This nickname is registered - dnsbl.proxybl.org - RED ARMY OF LOL - \.com/sms.exe - dnsbl.sorbs.net - (suck.*dick) - (?i)^sure are a ?lot of .*fags? in here - THISHASBEENDISABLED[ð-÷][€-¿]{3} - 󠁟 Corey marienz diff --git a/config-default/users.xml b/config-default/users.xml index 80f120c..d083b8e 100644 --- a/config-default/users.xml +++ b/config-default/users.xml @@ -9,10 +9,12 @@ + + diff --git a/meta.pl b/meta.pl index 1719512..a769103 100755 --- a/meta.pl +++ b/meta.pl @@ -20,11 +20,14 @@ $::debug = 0; $::cset = ''; %::debugx = ( "dnsbl" => 0, - "pingpong" => 0 + "pingpong" => 0, + "services" => 1, + "sync" => 1 ); %::dsock = (); %::spy = (); $::starttime = time; +@::syncqueue = (); BEGIN { my @modules = qw/Util Xml Inspect Event Services Log Command Classes Mysql/; @@ -72,6 +75,14 @@ sub init { my @strbl = io('string_blacklist.txt')->getlines; chomp @strbl; @::string_blacklist = @strbl; + %::proxies = {}; + my @proxy = io('proxy.txt')->getlines; + chomp @proxy; + foreach my $line (@proxy) { + if ($line =~ /(\d+\.\d+\.\d+\.\d+):\d+/) { + $::proxies{$1} = 1; + } + } $irc->start(); } diff --git a/modules/classes.pl b/modules/classes.pl index d747815..fc80da1 100644 --- a/modules/classes.pl +++ b/modules/classes.pl @@ -25,6 +25,7 @@ sub new "gecos" => \&gecos, "nuhg" => \&nuhg, "levenflood" => \&levenflood, + "proxy" => \&proxy }; $self->{ftbl} = $tbl; bless($self); @@ -38,6 +39,17 @@ sub check return $self->{ftbl}->{$item}->(@_); } +sub proxy +{ + my ($chk, $id, $event, $chan, $rev) = @_; + if (defined($rev) and ($rev =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)\./)) { + if (defined($::proxies{"$4.$3.$2.$1"})) { + return 1; + } + } + return 0; +} + my %ls = (); sub levenflood { @@ -167,7 +179,7 @@ sub splitflood { process_cf(); } if ( scalar @{$cf{$id}{$chan}{$text}} == int($cut[0]) ) { - $bs{$id}{$text} = time; + $bs{$id}{$text} = time unless length($text) < 10; return 1; } return 0; diff --git a/modules/event.pl b/modules/event.pl index 39c733d..f9888e5 100644 --- a/modules/event.pl +++ b/modules/event.pl @@ -52,6 +52,7 @@ sub new $conn->add_handler('topic', \&irc_topic); $conn->add_handler('topicinfo', \&irc_topic); $conn->add_handler('nicknameinuse', \&on_errnickinuse); + $conn->add_handler('bannickchange', \&on_bannickchange); $conn->add_handler('kick', \&on_kick); $conn->add_handler('cping', \&on_ctcp); $conn->add_handler('cversion', \&on_ctcp); @@ -62,6 +63,8 @@ sub new $conn->add_handler('cclientinfo', \&on_ctcp); $conn->add_handler('cfinger', \&on_ctcp); $conn->add_handler('354', \&on_whoxreply); + $conn->add_handler('315', \&on_whoxover); + $conn->add_handler('263', \&on_whofuckedup); $conn->add_handler('account', \&on_account); $conn->add_handler('ping', \&on_ping); $conn->add_handler('banlist', \&on_banlist); @@ -128,7 +131,10 @@ sub on_account sub on_connect { my ($conn, $event) = @_; # need to check for no services $conn->sl('MODE AntiSpamMeta +Q'); - $conn->privmsg( 'NickServ', "ghost $::settings->{nick} $::settings->{pass}" ) if lc $event->{args}->[0] ne lc $::settings->{nick}; + if (lc $event->{args}->[0] ne lc $::settings->{nick}) { + $conn->privmsg( 'NickServ', "ghost $::settings->{nick} $::settings->{pass}" ); + $conn->privmsg( 'NickServ', "release $::settings->{nick} $::settings->{pass}" ); + } $conn->sl('CAP REQ :extended-join multi-prefix account-notify'); #god help you if you try to use this bot off freenode } @@ -141,7 +147,11 @@ sub on_join { if ( lc $conn->{_nick} eq lc $nick) { $::sc{$chan} = {}; mkdir($::settings->{log}->{dir} . $chan); - $conn->sl('who ' . $chan . ' %tcnuhra,314'); + $::synced{$chan} = 0; + unless ( @::syncqueue ) { + $conn->sl('who ' . $chan . ' %tcnuhra,314'); + } + push @::syncqueue, $chan; } $::sc{$chan}{users}{$nick} = {}; $::sc{$chan}{users}{$nick}{hostmask} = $event->{userhost}; @@ -232,6 +242,14 @@ sub on_errnickinuse $conn->nick($_); } +sub on_bannickchange +{ + my ($conn, $event) = @_; + $_ = ${$::settings->{altnicks}}[rand @{$::settings->{altnicks}}]; + print "Nick is in use, trying $_\n"; + $conn->nick($_); +} + sub on_quit { my ($conn, $event) = @_; @@ -455,6 +473,24 @@ sub on_whoxreply $::sn{$nick}->{account} = lc $account; } +sub on_whoxover +{ + my ($conn, $event) = @_; + my $chan = pop @::syncqueue; +# print Dumper($event); + $::synced{$event->{args}->[1]} = 1; + if (defined($chan) ){ + $conn->sl('who ' . $chan . ' %tcnuhra,314'); + } +} + +sub on_whofuckedup +{ + my ($conn, $event) = @_; + if ($::debugx{sync}) { + print "on_whofuckedup called!\n"; + } +} sub on_banlist { my ($conn, $event) = @_; diff --git a/modules/inspect.pl b/modules/inspect.pl index c3a9c1a..6a4afec 100644 --- a/modules/inspect.pl +++ b/modules/inspect.pl @@ -32,11 +32,11 @@ sub inspect { } } else { -# $iaddr = gethostbyname($event->{host}); + $iaddr = gethostbyname($event->{host}); $rev = join('.', reverse(unpack('C4', $iaddr))).'.' if (defined $iaddr); } ## NB: isn't there a better way to do this with grep, somehow? - %aonx = %{$::channels->{channel}->{master}->{event}}; + %aonx = %{$::rules->{event}}; foreach $chan ( @{$event->{to}} ) { next unless $chan =~ /^#/; next if ((defined($::channels->{channel}->{$chan}->{monitor})) and ($::channels->{channel}->{$chan}->{monitor} eq "no")); diff --git a/modules/services.pl b/modules/services.pl index e2c53e0..aafe68e 100644 --- a/modules/services.pl +++ b/modules/services.pl @@ -22,15 +22,19 @@ sub doServices { elsif ( $event->{args}->[0] =~ /^You are now identified/ ) { my @autojoins = @{$::settings->{autojoins}}; - while (@autojoins) { - my $joinstr = join (',', shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins); - $conn->schedule($i, sub { $conn->join($joinstr); }); - $i += 7; - } - $conn->schedule($i-6, sub { $conn->privmsg('#antispammeta', 'Now joined to all channels in '. (time - $::starttime) . " seconds."); }); +# while (@autojoins) { +# my $joinstr = join (',', shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins, +# shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins); +# $conn->schedule($i, sub { $conn->join($joinstr); }); +# $i += 1; +# } + $conn->join(join(',', @autojoins[0..30])); + $conn->join(join(',', @autojoins[30..60])); + $conn->schedule(2, sub { $conn->privmsg('#antispammeta', 'Now joined to all channels in '. (time - $::starttime) . " seconds."); }); } - elsif ($event->{args}->[0] =~ /has been killed$/ ) + elsif ($event->{args}->[0] =~ /has been (killed|released)/ ) { + print "Got kill/release successful from nickserv!\n" if $::debugx{services}; $conn->nick( $::settings->{nick} ); } elsif ($event->{args}->[0] =~ /Password Incorrect/ ) diff --git a/modules/xml.pl b/modules/xml.pl index dbe4365..14f5826 100644 --- a/modules/xml.pl +++ b/modules/xml.pl @@ -16,6 +16,7 @@ sub readXML { $::commands = $::xs1->XMLin( "$p/commands.xml", ForceArray => [qw/command/]); $::mysql = $::xs1->XMLin( "$p/mysql.xml", ForceArray => []); $::dnsbl = $::xs1->XMLin( "$p/dnsbl.xml", ForceArray => []); + $::rules = $::xs1->XMLin( "$p/rules.xml", ForceArray => []); } sub writeXML { -- cgit v1.2.3