kickMessage is now an array of strings, randomly chosen

This commit is contained in:
Nicolas Coevoet 2015-03-31 20:51:25 +02:00
parent 232e962205
commit 0f5bacd675
3 changed files with 20 additions and 14 deletions

View File

@ -75,7 +75,7 @@ After the 'doNothingAboutOwnOpStatus' changed to False, bot will deop in each ch
!config supybot.plugins.ChanTracker.keepOp False
!config channel #myChannel supybot.plugins.ChanTracker.keepOp True
You should increase the ping interval because when the bot joins a channel because it requests lots of data and sometimes the server takes time to answer
You should increase the ping interval because when the bot joins a channel it requests lots of data and sometimes the server takes time to answer
!config supybot.protocols.irc.ping.interval 3600
@ -122,6 +122,10 @@ The bot can have a "reporting channel" like an -ops channel, where it forwards a
!config supybot.plugins.ChanTracker.logChannel #myGeneralSecretChannel
!config channel #myChannel supybot.plugins.ChanTracker.logChannel #myChannel-ops
You can use colors in it:
!config channel #myChannel supybot.plugins.ChanTracker.useColorForAnnounces True
You can tweak which information you would like to be forwarded to the reporting channel. Some reporting is activated by default like topic changes, mode changes, etc, some not, like bot's ban/quiet edit/mark etc. Take a look at:
!search supybot.plugins.ChanTracker.announce
@ -145,13 +149,13 @@ The plugin can create persistent bans to help manage large ban lists that exceed
!config channel #myChannel supybot.plugins.ChanTracker.useChannelBansForPermanentBan true
!channel ban add #myChannel *!*@mask
!b #example baduser,baduser2 --perm 1w stop trolling ( --perm add computed hostmasks to Channel.ban )
!b #example --perm baduser,baduser2 1w stop trolling ( --perm add computed hostmasks to Channel.ban )
With autoExpire enabled, the IRCd list is pruned as appropriate and bans are rotated in a way to not reveal the pattern used for the match. Due to a supybot limitation, extended bans are not supported with this feature.
If supported by the ircd, the bot can track account changes and get GECOS and username information when a user joins the channel. This requires ircd CAP features: http://tools.ietf.org/html/draft-mitchell-irc-capabilities-01
The plugin also supports extended bans/quiets including $r, $x, $a (real name, full match and account name, respectively). If you want the plugin to support your IRCd extended bans, please, report a bug or contact me directly.
The plugin also supports extended bans/quiets including $r, $x, $a, $j (real name, full match and account name, respectively). If you want the plugin to support your IRCd extended bans, please, report a bug or contact me directly.
By default, if the bot is asked to set a ban (+b), it will also kick affected users (Note: bot will only kick people if the ban was set by the bot -- if an op places the ban, the bot will not kick affected users). See:
@ -188,13 +192,14 @@ Each of those detections has the same kind of settings: there is *Permit (-1 to
For bans (b and q mode), you can choose the *Duration of the quiet/ban, and add a *Mark on the related quiet/ban. The 'bad' settings, when enabled (badPermit > -1) keeps track of users who did something wrong during badLife, and can end to badMode if the user exceeds the limit.
Example: flood control: to quiet for 1 minute anyone who sends more than 4 messages in 7 seconds to #channel; if the user continues to flood, after 2 times he will be banned:
Example: flood control: to quiet for 1 minute anyone who sends more than 4 messages in 7 seconds to #channel; if the user continues to flood, after 2 times on 5 minutes he will be banned:
!config channel #channel supybot.plugins.ChanTracker.floodPermit 4 <-- max number of messages allowed
!config channel #channel supybot.plugins.ChanTracker.floodLife 7 <-- in 7 seconds
!config channel #channel supybot.plugins.ChanTracker.floodMode q <-- quiet the user
!config channel #channel supybot.plugins.ChanTracker.floodDuration 60 <-- for 60 seconds
!config channel #channel supybot.plugins.ChanTracker.badPermit 2 <-- if user does that 3 times,
!config channel #channel supybot.plugins.ChanTracker.badLife 300 <-- during 5 minutes
!config channel #channel supybot.plugins.ChanTracker.badMode b <-- ban them
Additionally, the can track how many bad actions occur over a period of time and if a threshold is passed, this constitutes an attack on the channel. The attack* settings, when enabled keeps track of bad actions, and if the number exceeds attackPermit within attackLife, some specific channel modes are set for an attackDuration.
@ -202,7 +207,7 @@ Additionally, the can track how many bad actions occur over a period of time and
Example: not flooding: catch a wave of bots which sends the same message from different hosts:
!config channel #channel supybot.plugins.ChanTracker.massRepeatChars 200 <-- enable check only if there is at least 200 chars
!config channel #channel supybot.plugins.ChanTracker.massRepeatPermit 0 <-- that means if first message matchs the seconds, it will trigger it
!config channel #channel supybot.plugins.ChanTracker.massRepeatPermit 1 <-- if found 2 times
!config channel #channel supybot.plugins.ChanTracker.massRepeatLife 60 <-- don't keep messages too long in memory, to avoid false positive
!config channel #channel supybot.plugins.ChanTracker.massRepeatPercent 0.85 <-- set a low value for similarity, in order to catch them if there is some random chars in the messages
!config channel #channel supybot.plugins.ChanTracker.massRepeatMode b

View File

@ -155,7 +155,7 @@ conf.registerChannelValue(ChanTracker, 'kickMax',
registry.Integer(-1,"""if > 0, disable kick if affected users > kickMax, avoid to cleanup entire channel with ban like *!*@*"""))
conf.registerChannelValue(ChanTracker, 'kickMessage',
registry.String("You are banned from this channel", """bot kick reason"""))
registry.CommaSeparatedListOfStrings(["You are banned from this channel"], """bot kick reasons"""))
conf.registerChannelValue(ChanTracker, 'quietMessage',
registry.String("", """leave empty if you don't want the bot to tell something to the user when he has been quieted ( by/via the bot ), in any case, if channel is under attack: bot will not send message"""))

View File

@ -48,6 +48,7 @@ import socket
import re
import sqlite3
import collections
import random
from operator import itemgetter
try:
@ -3039,7 +3040,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
if len(kicks):
for kick in kicks:
chan = self.getChan(irc,kick[1])
chan.action.enqueue(ircmsgs.kick(kick[1],kick[0],self.registryValue('kickMessage',channel=kick[1])))
chan.action.enqueue(ircmsgs.kick(kick[1],kick[0],random.choice(self.registryValue('kickMessage',channel=kick[1]))))
self.forceTickle = True
def doMode(self, irc, msg):
@ -3100,7 +3101,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
if msg.nick == irc.nick or msg.nick == 'ChanServ':
if self.registryValue('kickMax',channel=channel) < 0 or len(item.affects) < self.registryValue('kickMax',channel=channel):
if nick in irc.state.channels[channel].users and nick != irc.nick:
chan.action.enqueue(ircmsgs.kick(channel,nick,self.registryValue('kickMessage',channel=channel)))
chan.action.enqueue(ircmsgs.kick(channel,nick,random.choice(self.registryValue('kickMessage',channel=channel))))
self.forceTickle = True
kicked = True
if not kicked and m in self.registryValue('modesToAsk',channel=channel) and self.registryValue('doActionAgainstAffected',channel=channel):
@ -3295,7 +3296,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
if len(results) and mode in 'kr':
chan = self.getChan(irc,channel)
if not reason or not len(reason):
reason = self.registryValue('kickMessage',channel=channel)
reason = random.choice(self.registryValue('kickMessage',channel=channel))
for n in results:
if mode == 'k':
chan.action.enqueue(ircmsgs.IrcMsg('KICK %s %s :%s' % (channel,n,reason)))