]> jfr.im git - irc/freenode/Sigyn.git/commitdiff
dnsbling on server's side filtered messages
authorNicolas Coevoet <redacted>
Fri, 29 Mar 2019 14:43:59 +0000 (14:43 +0000)
committerNicolas Coevoet <redacted>
Mon, 1 Apr 2019 12:59:41 +0000 (12:59 +0000)
config.py
plugin.py

index 0c179c0fa8bfd847eb24bb0e0ca05d11befac574..63be1d4eedff4dbbd2dcc65fa12013eb0bd315b8 100644 (file)
--- a/config.py
+++ b/config.py
@@ -107,6 +107,11 @@ conf.registerGlobalValue(Sigyn, 'lagPermit',
 conf.registerGlobalValue(Sigyn, 'lagInterval',
      registry.PositiveInteger(1, """interval between two check about lag, also used to garbage collect useless items in internal state"""))
 
+conf.registerGlobalValue(Sigyn, 'serverFilteringPermit',
+     registry.Integer(-1, """-1 to disable, enable dnsbling and klining when server trigger filtering messages"""))
+conf.registerGlobalValue(Sigyn, 'serverFilteringLife',
+     registry.PositiveInteger(1, """life of message in buffer in seconds"""))
+
 conf.registerGlobalValue(Sigyn, 'ghostPermit',
      registry.Integer(-1, """max number of ghost connections allowed"""))
 
index c3d4e5c7c99c39cdc2a7b4113d9b88392cc39a86..1cb0004f35c1078231312a081013b53992ff6a1c 100644 (file)
--- a/plugin.py
+++ b/plugin.py
@@ -1843,19 +1843,20 @@ class Sigyn(callbacks.Plugin,plugins.ChannelDBHandler):
             elif 'UNGROUP: ' in text:
                 target = text.split('UNGROUP: ')[1]
             if len(target):
-                q = self.getIrcQueueFor(irc,src,target,120)
+                q = self.getIrcQueueFor(irc,src,'nsAccountGroup',120)
                 q.enqueue(text)
-                #self.log.info('%s > %s (%s)' % (target,text,len(q)))
+                self.log.info('%s > %s (%s)' % (target,text,len(q)))
                 if len(q) == 3:
                     index = 0
                     a = b = c = False
                     for m in q:
-                       if 'GROUP' in m and index == 0:
+                       if ' GROUP:' in m and index == 0:
                            a = True
-                       elif 'SET:ACCOUNTNAME' in m and index == 1:
+                       elif ' SET:ACCOUNTNAME:' in m and index == 1:
                            b = True
-                       elif 'UNGROUP' in m and index == 2:
+                       elif ' UNGROUP:' in m and index == 2:
                            c = True
+                       index = index + 1
                     q.reset()
                     if a and b and c: 
                         self.logChannel(irc,"SERVICE: %s suspicious evades/abuses" % src)
@@ -2862,18 +2863,20 @@ class Sigyn(callbacks.Plugin,plugins.ChannelDBHandler):
             elif 'failed login attempts to' in text and 'SASL' in text:
                 self.handleSaslFailure(irc,text)
             elif text.startswith('FILTER'):
-                ip = text.split('[')[1].split(']')[0]
+                ip = text.split(' ')[2].split('[')[1].split(']')[0]
                 if utils.net.isIPV4(ip) or utils.net.bruteIsIPV6(ip):
                     if not ip in self.ipfiltered:
-                        q = self.getIrcQueueFor(irc,'serverSideFiltering',ip,20)
-                        q.enqueue(ip)
-                        reason = 'Server Side Filtering'
-                        if len(q) == 3:
-                            self.ipfiltered[ip] = True
-                            if len(self.registryValue('droneblKey')) and len(self.registryValue('droneblHost')) and self.registryValue('enable'):
-                                t = world.SupyThread(target=self.fillDnsbl,name=format('fillDnsbl %s', ip),args=(irc,ip,self.registryValue('droneblHost'),self.registryValue('droneblKey'),reason))
-                                t.setDaemon(True)
-                                t.start() 
+                        if self.registryValue('serverFilteringPermit') > -1:
+                        
+                            q = self.getIrcQueueFor(irc,'serverSideFiltering',ip,self.registryValue('serverFilteringLife'))
+                            q.enqueue(ip)
+                            reason = 'Server Side Filtering'
+                            if len(q) > self.registryValue('serverFilteringPermit'):
+                                self.ipfiltered[ip] = True
+                                if len(self.registryValue('droneblKey')) and len(self.registryValue('droneblHost')) and self.registryValue('enable'):
+                                    t = world.SupyThread(target=self.fillDnsbl,name=format('fillDnsbl %s', ip),args=(irc,ip,self.registryValue('droneblHost'),self.registryValue('droneblKey'),reason))
+                                    t.setDaemon(True)
+                                    t.start() 
         else:
             self.handleMsg(irc,msg,True)
 
@@ -3375,7 +3378,7 @@ class Sigyn(callbacks.Plugin,plugins.ChannelDBHandler):
                 chan = self.getChan(irc,channel)
                 t = time.time()
                 mask = self.prefixToMask(irc,msg.prefix,channel)
-                if isCloaked(msg.prefix,self):
+                if isCloaked(msg.prefix,self) or account:
                     t = t - self.registryValue('ignoreDuration',channel=channel) - 1
                 chan.nicks[msg.nick] = [t,msg.prefix,mask,gecos,account]
                 if self.registryValue('ignoreRegisteredUser',channel=channel):