AttackProtector: Add support for KNOCK flood. Closes GH-81.

This commit is contained in:
Valentin Lorentz 2013-05-21 17:14:07 +02:00
parent 9e9d12d56c
commit 1c1154c0bb
2 changed files with 7 additions and 0 deletions

View File

@ -101,11 +101,13 @@ conf.registerGlobalValue(AttackProtector, 'delay',
its incoming messages 'flood' on connection is an attack."""))) its incoming messages 'flood' on connection is an attack.""")))
kinds = {'join': ['5p10', 'ban', ''], kinds = {'join': ['5p10', 'ban', ''],
'knock': ['5p20', 'mode+K', ''],
'part': ['4p5', 'ban', ''], 'part': ['4p5', 'ban', ''],
'nick': ['7p300', 'ban', ''], 'nick': ['7p300', 'ban', ''],
'message': ['10p20', 'kick', ''], 'message': ['10p20', 'kick', ''],
'kicked': ['5p60', 'kban', _('user has been kicked multiple times')], 'kicked': ['5p60', 'kban', _('user has been kicked multiple times')],
'groupjoin': ['20p10', 'mode+i', ''], 'groupjoin': ['20p10', 'mode+i', ''],
'groupknock': ['7p20', 'mode+K', ''],
'grouppart': ['20p10', 'mode+i', ''], 'grouppart': ['20p10', 'mode+i', ''],
'groupnick': ['20p10', 'mode+N', ''], 'groupnick': ['20p10', 'mode+N', ''],
'groupmessage': ['100p10', 'mode+m', '']} 'groupmessage': ['100p10', 'mode+m', '']}

View File

@ -121,6 +121,9 @@ class AttackProtector(callbacks.Plugin):
if kind in ['part', 'join', 'message']: if kind in ['part', 'join', 'message']:
channels = [msg.args[0]] channels = [msg.args[0]]
prefix = msg.prefix prefix = msg.prefix
elif kind in ['knock']:
channels = [msg.args[0]]
prefix = msg.args[2]
elif kind in ['nick']: elif kind in ['nick']:
newNick = msg.args[0] newNick = msg.args[0]
channels = [] channels = []
@ -156,6 +159,8 @@ class AttackProtector(callbacks.Plugin):
def doJoin(self, irc, msg): def doJoin(self, irc, msg):
self._eventCatcher(irc, msg, 'join') self._eventCatcher(irc, msg, 'join')
def do710(self, irc, msg):
self._eventCatcher(irc, msg, 'knock')
def doPart(self, irc, msg): def doPart(self, irc, msg):
self._eventCatcher(irc, msg, 'part') self._eventCatcher(irc, msg, 'part')
def doNick(self, irc, msg): def doNick(self, irc, msg):