summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-default/channels.xml121
-rw-r--r--config-default/commands.xml39
-rw-r--r--config-default/settings.xml1
-rw-r--r--config-default/users.xml8
-rwxr-xr-xmeta.pl3
-rw-r--r--modules/event.pl32
-rw-r--r--modules/inspect.pl15
-rw-r--r--modules/util.pl6
-rw-r--r--modules/xml.pl17
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 @@
<channels>
- <channel id="#wikimedia-commons" op="no">
- <hilights>
- <debug>White_cat</debug>
- </hilights>
- <msgs>
- <debug>#wikimedia-ops</debug>
- </msgs>
- </channel>
- <channel id="##windows" op="no">
- <hilights>
- <low>numist</low>
- <low>quux</low>
- <low>HentaiXP</low>
- <low>TechSalvager</low>
- <low>xyr</low>
- <low>njan</low>
- <low>JonathanD</low>
- <low>Cpudan80</low>
- </hilights>
- </channel>
<channel id="##asb-meta" op="no" />
<channel id="##asb-nexus" op="when" />
<channel id="##asb-testing" op="when">
@@ -36,7 +16,7 @@
<hilights>
<low>WildPikachu</low>
<low>nalioth</low>
- <low>xyr</low>
+ <low>seanw</low>
<low>quux</low>
<low>denny</low>
<low>Fieldy</low>
@@ -47,63 +27,112 @@
<debug>##linux-ops</debug>
<low>WildPikachu</low>
</msgs>
- <event id="no_ahbl" action="none" class="re" reason="placeholder" risk="debug" time="0" type="join" override="ahbl,no_ahbl">.*</event>
</channel>
<channel id="##linux-ops" op="no">
<hilights>
<opalert>WildPikachu</opalert>
- <opalert>xyr</opalert>
+ <opalert>seanw</opalert>
<opalert>quux</opalert>
<opalert>denny</opalert>
<opalert>Fieldy</opalert>
<opalert>numist</opalert>
<opalert>PhilKC</opalert>
</hilights>
- <msgs>
- <opalert>##linux-ops</opalert>
- </msgs>
+ <msgs opalert="##linux-ops" />
+ </channel>
+ <channel id="##windows" op="no">
+ <hilights>
+ <low>numist</low>
+ <low>quux</low>
+ <low>HentaiXP</low>
+ <low>TechSalvager</low>
+ <low>seanw</low>
+ <low>njan</low>
+ <low>JonathanD</low>
+ <low>Cpudan80</low>
+ </hilights>
</channel>
<channel id="#baadf00d" op="yes">
<hilights></hilights>
<msgs></msgs>
</channel>
- <channel id="#wikipedia-en-roads-us" op="yes">
+ <channel id="#religion" op="yes">
<hilights>
- <debug>vishwin60</debug>
+ <debug>Shadow_mil</debug>
+ <debug>newmanbe</debug>
+ </hilights>
+ </channel>
+ <channel id="#wikimedia-commons" op="no">
+ <hilights>
+ <debug>White_cat</debug>
</hilights>
<msgs>
<debug>#wikimedia-ops</debug>
</msgs>
</channel>
- <channel id="#religion" op="yes">
+ <channel id="#wikimedia-commons-social" op="no">
<hilights>
- <debug>Shadow_mil</debug>
- <debug>newmanbe</debug>
+ <low>Lcarsdata</low>
</hilights>
+ <msgs>
+ <debug>#wikimedia-ops</debug>
+ </msgs>
</channel>
<channel id="#wikimedia-ops" op="no">
<hilights></hilights>
<msgs></msgs>
</channel>
- <channel id="#wikipedia" op="when">
+ <channel id="#wikipedia" op="no">
+ <event id="autorem_2" action="fmod_wiki" class="re" override="autoremove" reason="on chanserv autoremove" risk="info" time="0" type="raw">^mode \S+ \+b (.*)$</event>
+ <event id="part_fags" action="ban" class="re" reason="parted with 'Fags!'" risk="low" time="0" type="part">.*Fags! Fags! Fags!.*</event>
<hilights>
- <low>AppleBoy</low>
- <low>xyr</low>
+ <low>seanw</low>
+ <low>Pilotguy</low>
+ <low>Eagle-101</low>
+ <low>Mbimmler</low>
+ <low>skenmy</low>
+ <low>Ral315</low>
+ <low>Karlprof</low>
+ <low>tomaw</low>
<low>Fabexplosive</low>
- <low>Crazytales2</low>
+ <low>Krimpet</low>
+ <low>ST47</low>
+ <low>AndrewB</low>
+ <low>stylus</low>
</hilights>
<msgs>
<debug>#wikimedia-ops</debug>
</msgs>
- <event id="autorem_2" action="fmod_wiki" class="re" reason="on chanserv autoremove" risk="info" time="0" type="raw" override="autoremove">^mode \S+ \+b (.*)$</event>
- <event id="part_fags" action="ban" class="re" reason="parted with 'Fags!'" risk="low" time="0" type="part">.*Fags! Fags! Fags!.*</event>
</channel>
<channel id="#wikipedia-en" op="no">
<hilights>
+ <debug>White_Cat</debug>
<low>AppleBoy</low>
<low>Soms</low>
- <low>xyr</low>
- <debug>White_Cat</debug>
+ <low>Pilotguy</low>
+ <low>ST47</low>
+ <low>seanw</low>
+ </hilights>
+ <msgs>
+ <debug>#wikimedia-ops</debug>
+ </msgs>
+ </channel>
+ <channel id="#wikipedia-en-roads-us" op="yes">
+ <hilights>
+ <debug>vishwin60</debug>
+ </hilights>
+ <msgs>
+ <debug>#wikimedia-ops</debug>
+ </msgs>
+ </channel>
+ <channel id="#wikipedia-overflow" op="no">
+ <hilights>
+ <low>seanw</low>
+ <low>Eagle-101</low>
+ <low>Mbimmler</low>
+ <low>Pilotguy</low>
+ <low>ST47</low>
+ <low>skenmy</low>
</hilights>
<msgs>
<debug>#wikimedia-ops</debug>
@@ -113,31 +142,37 @@
<event id="flood-15to45" action="none" class="floodqueue" reason="flooding 15 to 45" risk="low" time="0" type="public">15:45</event>
</channel>
<channel id="master">
- <event id="ahbl" action="ban" class="dnsbl" reason="in ircbl.ahbl.org" risk="info" time="0" type="join">ircbl.ahbl.org</event>
<event id="autoremove" action="none" class="re" reason="on chanserv autoremove" risk="info" time="0" type="part">requested by ChanServ</event>
<event id="badurl1" action="ban" class="re" reason="sending spam url" risk="medium" time="0" type="public">tinyurl\.com/ypvk4n</event>
<event id="ctcp-dcc" action="ban" class="re" reason="ctcp-dcc" risk="high" time="0" type="cdcc">.*</event>
<event id="dcc" action="ban" class="re" override="dcc-medium" reason="using the DC.C SE.ND exploit" risk="high" time="0" type="public">^DCC SEND |\bDCC SEND &quot;?[A-Za-z0-9]+&quot;? \d+ \d+ \d+</event>
<event id="dcc-medium" action="ban" class="re" reason="using the DC.C SE.ND exploit" risk="medium" time="0" type="public">DCC SEND </event>
<event id="dcc-topic" action="ban" class="re" reason="setting a bad topic" risk="medium" time="0" type="topic">\bDCC SEND </event>
+ <event id="ddos_countdown" action="none" class="re" reasion="doing the ddos countdown thing" risk="medium" time="0" type="public">^... DDOS COUNTDOWN ...$</event>
<event id="dosrequest" action="none" class="re" reason="requesting a DoS" risk="medium" time="0" type="public">via paypal if you DoS somone for</event>
+ <event id="dronebl" action="ban" class="dnsbl" override="ahbl" reason="in dnsbl.dronebl.org" risk="info" time="0" type="join">dnsbl.dronebl.org</event>
+ <event id="efnet_rbl" action="none" class="dnsbl" reason="in rbl.efnet.org" risk="info" time="0" type="join">rbl.efnet.org</event>
<event id="exoticforum" action="ban" class="re" reason="link spam" risk="low" time="0" type="public">http://exotics\.ezbbforum\.com</event>
<event id="flood-10to30" action="none" class="floodqueue" reason="flooding (10 messages per 30 seconds)" risk="low" time="0" type="public">10:30</event>
<event id="flood-5to3" action="quiet" class="floodqueue" reason="flooding (5 messages per 3 seconds)" risk="low" time="10" type="public">5:3</event>
- <event id="massflood" action="ban" class="splitflood" reason="distributed flooding" risk="medium" time="0" type="public,part,caction">5:3</event>
<event id="genspam1" action="none" class="re" reason="generic spamming" risk="debug" time="0" type="public">([^ ]{4,} +)\1{5,}</event>
+ <event id="goatse" action="ban" class="re" reason="posting goatse link" risk="low" time="0" type="public">goatse\.cz</event>
<event id="joinflood-3to20" action="none" class="floodqueue" reason="join flood (3 joins in 20 seconds)" risk="medium" time="0" type="join">3:20</event>
<event id="keylogger" action="ban" class="re" override="keylogger-medium" reason="using the norton start-key-logger exploit" risk="high" time="0" type="public">^startkeylogger$|^stopkeylogger$</event>
<event id="keylogger-medium" action="ban" class="re" reason="using the norton start-key-logger exploit" risk="medium" time="0" type="public">\bstartkeylogger\b|\bstopkeylogger\b</event>
<event id="last_measure_regex" action="kban" class="re" reason="posting what appears to be a last measure link" risk="medium" time="0" type="public">http://\S+\.on\.nimp\.org</event>
<event id="lesbian" action="ban" class="re" reason="bad nick match (lesbian..)" risk="medium" time="0" type="join">^lesbian..$</event>
+ <event id="magical" action="none" class="ident" reason="typical w00t ident" risk="info" time="0" type="join">i=magical</event>
+ <event id="massflood" action="ban" class="splitflood" reason="distributed flooding" risk="medium" time="0" type="public,part,caction">5:3</event>
+ <event id="massflood2" action="ban" class="splitflood" reason="distributed flooding" risk="medium" time="0" type="caction">5:3</event>
<event id="nick_cupid" action="ban" class="re" reason="bad nick match (cupid..)" risk="medium" time="0" type="join">^cupid..$</event>
<event id="nick_mudkip" action="ban" class="re" reason="bad nick match (mudkip..)" risk="medium" time="0" type="join">MUDKIP..</event>
<event id="nickspam" action="ban" class="nickspam" reason="nickspamming" risk="high" time="0" type="public">150:20</event>
<event id="notice" action="ban" class="re" reason="sending a notice to the channel" risk="high" time="0" type="notice">.*</event>
- <event id="sms_spam" action="none" class="re" reason="spam link / virus" risk="low" time="0" type="public">\.com/sms.exe</event>
- <event id="dronebl" action="ban" class="dnsbl" reason="in dnsbl.dronebl.org" risk="info" time="0" type="join" override="ahbl">dnsbl.dronebl.org</event>
<event id="redarmyoflol" action="ban" class="re" reason="parting with 'red army of lol'" risk="low" time="0" type="part">RED ARMY OF LOL</event>
+ <event id="sms_spam" action="none" class="re" reason="spam link / virus" risk="low" time="0" type="public">\.com/sms.exe</event>
+ <event id="weirdspam_1" action="none" class="re" reason="wwe mass murderer nonsense" risk="medium" time="0" type="public">hello sir, my name is Chris Benoit and I am a WWE MASS MURDERER.</event>
+ <event id="wikifags2" action="none" class="re" nocase="nocase" reason="saying 'sure are a lot of wikifag'..." risk="low" time="0" type="public">sure are a ?lot of wikifag</event>
<hilights>
<debug>AfterDeath</debug>
</hilights>
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 @@
<commands>
+ <command cmd="^;query (\S+) (\S+)$">
+ <![CDATA[
+ my $channel = $1;
+ my @nuh = split(/(\!|\@)/, $2);
+ my $result = sql_query($channel, $nuh[0], $nuh[2], $nuh[4]);
+ $conn->privmsg($event->{to}->[0], "$result results found.");
+ ]]>
+ </command>
+ <command cmd="^;hilight (\S+) (\S+) ?(\S*)$" flag="a">
+ <![CDATA[
+ my $chan = $1;
+ my $nick = $2;
+ my $level= $3;
+ if ($level eq '') { $level = 'low'; }
+ my @tmphl = @{$::channels->{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");
+ ]]>
+ </command>
+ <command cmd="^;dehilight (\S+) (\S+)" flag="a">
+ <![CDATA[
+ my $chan = $1;
+ my $nick = $2;
+ foreach my $risk ( keys %::RISKS ) {
+ my @ppl = @{$::channels->{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");
+ ]]>
+ </command>
<command cmd="^;join (.*)" flag="a">
<![CDATA[
$conn->join($1);
@@ -59,9 +93,4 @@
chomp @eline;
]]>
</command>
- <command cmd="^;remove (.*)$" flag="o">
- <![CDATA[
- $conn->sl("remove $event->{to}->[0] $1");
- ]]>
- </command>
</commands>
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 @@
<autojoin>#wikipedia-en-roads-us</autojoin>
<autojoin>##windows</autojoin>
<autojoin>#wikimedia-commons</autojoin>
+ <autojoin>#wikimedia-commons-social</autojoin>
</autojoins>
<log>
<dir>logs/$chan</dir>
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 @@
<people>
- <person id="afterdeath" flags="oda" host="atheme/troll/about.linux.afterdeath" />
- <person id="bumm13" flags="o" host="IDENTIFY" />
+ <person id="afterdeath" flags="oda" host="IDENTIFY" />
<person id="filiated" flags="oda" host="IDENTIFY" />
<person id="ocee" host="unaffiliated/ocee" />
<person id="wildpikachu" host="about/linux/staff/wildpikachu" />
<person id="slowking_man" host="IDENTIFY" flags="o" />
- <person id="crazytales2" host="IDENTIFY" flags="oda" />
+ <person id="cchan" host="IDENTIFY" flags="oda" />
<person id="mark_ryan" host="wikimedia/mark" flags="o" />
+ <person id="dmcdevit" host="IDENTIFY" flags="oa" />
+ <person id="seanw" host="freenode/staff/wikimedia.sean-whitton" flags="oa" />
+ <person id="st47" host="IDENTIFY" flags="oa" />
</people>
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;