Flood snippet for Eggdrop needed
 
Post new topic   Reply to topic    Hawkee.com Forum Index -> TCL Scripting
 
sk68  -  Sun Feb 06, 2011 9:03 am Reply with quote
Pretty much what I need is a simple x queries in y seconds flood protection snippet that I can incorporate into any script. Anyone that can come up with one would be greatly appreciated and credit for the snippet will go to you. Thanks in advance Smile
Malphas  -  Mon Feb 07, 2011 4:22 am Reply with quote

sk68 wrote

Pretty much what I need is a simple x queries in y seconds flood protection snippet that I can incorporate into any script. Anyone that can come up with one would be greatly appreciated and credit for the snippet will go to you. Thanks in advance Smile


This script will do what you need it todo plus more this script was not written by me

[code:1:f4d75f84ab]

###########################[ ALL PROTECTION 4.7 ]############################
# #
# Author : Opposing (Fz_Egg@yahoo.com) #
# a.k.a Sir_Fz (Fayez Zouheiry) #
# Version : 4.7 #
# Released: December 21, 2010 #
# Source: http://Sir-Fz.blogspot.com #
## #
# Description: Has all kinds of channel protections + Botnet channel flood #
# protections and private protections. #
# #
# Commands: #
# DCC: #
# .ap:import <oldchan> <*/newchan> (This sets the AP settings #
# of <oldchan> on <newchan> or all chans if *) #
# .ap:reset <*/chan> (This will reset the AP settings of chan #
# or all chans if * to the default settings) #
# .ap:disable <*/chan> (This will disable all protections on #
# chan or all chans if *) #
# .ap:monitor (displays info about followed punishments) #
# .ap:add <list> <chan/global> <elements> #
# .ap:rem <list> <chan/global> <elements> #
# .ap:list <list> <chan/global> #
# .ap:priv <set/list> <setting> <value> (priv flood settings) #
# ** Available lists: bchans, bnicks, bidents, bwords, adexempts, #
# droneexempts, adwords, bctcrs & greetexempts. #
# #
# All protections are enabled via .chanset DCC command. #
# Use: .chaninfo to know AllProtection's settings (ap:<setting>) #
# NOTE: To set an AP channel setting use: (* means all channels) #
# .chanset <chan> <setting> <value> <btime> <punish> <btype> #
# #
# Credits: #
# - Thanks to my friend Salah Rifai who introduced me to Eggdrops #
# & *nix. He is the person who guided me to Eggdrops' resources. He #
# also was the founder of nexushells.net which was my first shell #
# which hosted my Eggdrop (Shrider). #
# - Thanks to http://forum.egghelp.org which was and still is my #
# tcl toutor, I've learned tcl through this community. #
# - Thanks to slennox for adding a link on the main page of #
# www.egghelp.org to the topic of AllProtection, and for hosting #
# the script on his site when my site went down. #
# - Thanks Silence, Marcel, dotslasher & others for reporting bugs #
# which was an important step for the developement of this script. #
# - Thanks to all who suggested ideas & features at egghelp.org. #
# - Used maskhost & wordwrap procs by user from the egghelp forum. #
# Edited wordwrap slightly to suite its purpose in the script. #
# - Used massmode proc's algorithm for ban-queueing (by user). #
# - Used checkbcd proc by Marcel (edited by me). #
# #
# History: #
# - 4.7: Stable release of the 4.6 series. Got the bad nicks/idents #
# & perhaps other fixes I haven't logged. It was a good ride :) #
# - 4.6b9: The script would not ban if a channel was not added in #
# lower case; fixed now. Fixed other issues... #
# - 4.6b8: Integrated queues, enhanced AntiSpamBot, modulated #
# exempt types, scanning bad/excess chans and bad CTCP replies #
# when bot gains ops, flexible warn method (notice or privmsg), #
# fixed AntiSpamBot IP problem, added ability to exempt hostmasks #
# from greets by antispambot, AntiSpam bans spammers only if on #
# chan (optional), ability to immediately ban thru X, enable or #
# disable bad words/ads ban for quit/part, queue for bad/excess #
# chans scan. Punish bad chan users in all channels. #
# - 4.6b7: Throttle kicking (halt redundant kicks). Bad words/ads #
# now detected in notices, parts & quits. Choose CTCP requests 4 #
# bad ctcp replies (bad version before). Ability to ban thru X. #
# Following now occurs in 1 array (less memory). All flood types #
# now have a punishment method. Added AntiSpamBot. Enhancements #
# made over code. #
# - 4.6b6: Adding drone exempts via .ap:add cmd. Fixed undiscovered #
# exploit in string splitting (string2list). Added extra 2 ban #
# types. Added exemption for part msgs in revdoor protection. #
# Bad version-reply kick, set private flood settings via DCC, log #
# everyday (configurable), scan channels in intervals for bad or #
# excess chans or bad version-replies and ability to add custom #
# advertising words. #
# - 4.6b5: Fixed bugs in badchan and clones protections. Enhanced #
# advertisement detection to avoid false detections. #
# - 4.6b4: Fixed lists saving, uninstalling error. Added ability to #
# remove bans on full banlist + enhanced the drones detecting #
# procedure and the ap:import DCC command to accept *. #
# - 4.6b3: More code fixes and enhancements. You can now add words #
# to be exempted from advertising (channel specific as well) and #
# log bot's kicks and bans. Join flood can now check joins from #
# same idents if enabled. Implemented queueing bans. #
# - 4.6b2: Major coding changes, changed style of binding and procs #
# for better and faster performance. Reduced code & implemented #
# the use of namespaces in order not to conflict with other #
# scripts. Added excess chans protection + several bug fixes. #
# - 4.6b1: Major coding changes, added bad chans protections + bug #
# fixes. #
# #
# Report bugs/suggestions to Fz_Egg@yahoo.com #
# #
# Copyright © 2005 Opposing (aka Sir_Fz) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
#############################################################################
#
##############################
# Configurations start here: #
# __________________________ #


########################
# SETTINGS & iNFO #
########################

### READ THIS FIRST:
# * AllProtection works best with eggdrop1.6.18 and above. (so upgrade)
#
# * AllProtection exempts channel ops, friends (+f) and masters (+mo) from protection by default.
# That means users with the +f or +mo flags will not be affected by any protection.
# (You can add hosts to the +f handle if you don't want the bot to ban them). To prevent from banning
# ChanServ, add chanserv to your bot with the +f or +mo flag.
#
# * AllProtection does not use the internal banlist of the bot so you will not have to worry
# about other ops not being able to remove the bans, they can! (feature or bug, I dont care :P)
#
# * AllProtection will not trigger protection on a channel where the bot is not oped, so your
# bot will not send redundant commands to the server. (good for the lag)
#
# * AllProtection strips control-codes (i.e. bold, underline, colors...etc) from text when checking for
# repeats, bad words or advertising.
#
# * All settings are enabled via .chanset DCC command. Example: .chanset #channel ap:textl 5:2 15 w:k:kb 2
# this will enable the text flood (lines) protection on #channel (punish on 5 lines or more in 2 seconds)
# 1st warn - 2nd kick - 3rd kickban. ban is 15 minutes and ban type is 2.
#
# * You can use mode lock modes such as "mR-k type.flood" which will work fine with AllProtection.
#
# * Adding elements to the lists (bad words, chans...etc) can ONLY be done via the DCC commands.
#
# * Read all the comments during configuration so you won't miss any important info.
### Enjoy configuring...

# You can change the name of the namespace (AllProtection).
namespace eval AllProtection {

# Basic declarations: (don't touch)
variable declr
foreach declr {textl textc notcl notcc capsp repeatf codesf adexempts adwords greetexempts adv antispam bwords
swear ctcpf massdeop massdeop masskick massb joinflood pmsgf revdoor nickflood eclones bnick bnicks drone
bident bidents droneexempts bchans bchan bctcrs bctcr apfp ptextl ptextc pnotil pnotic pctcpf NumKicks apudef
apqueue banthruX ap:udefs logkbs btclocked kckcount cbcd serv kline kcfop} { variable $declr }
unset declr

# Do you want your bot to queue bans? set here the time in seconds before dumping bans:
# NOTE: 0 means the bot will set the ban immediately
# The modes-per-line setting in eggdrop.conf is the number of modes allowed per command.
set apqueue(time) 1

# Set here the numbers of last bans to be removed on full banlist? (0: remove none)
# NOTE: Full banlist is when the channel has max-bans bans set. (from eggdrop.conf)
variable removebs 20

# Do you want the bot to ban through services?
# 0: Never
# 1: Only when banlist is full (determined by max-bans)
# 2: always
set banthruX(do) 0

# If banthruX is 1/2, set the command here to ban through services:
# %nick = nickname
# %ban = ban-mask
set banthruX(cmd) "privmsg X :ban %chan %ban %btime %level %reason"

# If banthruX is 1/2, set here the default level to be used on all channels
lappend ap:udefs {ap:level 75}

# Do you want AP to log all the kicks/bans done by the bot? (0: no, 1: daily, 2: forever)
set logkbs(do) 0

# If yes, set the logfile here: (will be reset everyday at 3:00 a.m.)
set logkbs(file) "logs/aplogs.log"

# Set here any additional exempts, you can exempt the following:
# ops: Channel ops
# halfops: Channel halfops
# voices: Channel voices
# +flags|+flags: Users with global or channel specific flags (e.g. +fm friends and masters...)
# -flags&-flags: Users which do not have the specified flags (e.g. -k&-k)
variable exmptype {ops voices +fmo|+fmo}

# Set here the handles of the users you want to notify when the bots locks a channel
# for mass (botnet) flood.
# example: set notifyusers {TheOwner LamerDude}
variable notifyusers {}

# Set here the notice to be sent to the channel when the bot locks the channel because of a
# Botnet flood. leave "" if you don't wish the notice to be sent.
set btclocked(lnotc) "Channel has been locked due to flood, sorry for any inconvenience this may have caused."

# What info do you wanna add to your kick message?
# After setting this variable, you can use $kckcount(form) to add a these info to the bot's
# kick msg.
### NOTE:
## %kcount = number of kicks.
## %btime = ban time
## %chan = channel name
## %date = kick date
## %rate = offenses in seconds, bad words/nicks/idents/chans/ads or clone/clones (depends on type of offense)
### PS: You can use the above directly in the kick message (not only here)
set kckcount(form) "(%rate) :: \[%date\] - Banned %btime minutes ·%kcount·"

# Set the file in which the number of kicks will be stored.
set kckcount(file) "scripts/kcount.txt"

# Do you want the bot to check for bad nicks/idents and clones when it first joins the channels
# and gains op ? (0: no , 1: yes)
# NOTE: This may be CPU intensive if your bot is on big channels or on alot of channels.
# NOTE: This may (probably will) cause huge self-lag on the bot.
set cbcd(check) 0

# If cbcd(check) is set to 1, change this if you want the bot to only check for certain types
# of protection in the nicklist.
# drones : Random drones
# clones : Excess clones and kick them
# bnicks : Bad nicks
# bidents: Bad idents.
# bchans : Bad/Excess channels.
# bctcrs : Bad CTCP replies
set cbcd(procs) {drones clones bnicks bidents bchans bctcrs}

# If cbcd(check) is set to 1, on what channels do you want it to be applied ? (use "*" to make it work on all chans)
# example: set cbcd(chans) "#chan1 #chan2"
set cbcd(chans) "*"

# Your service's chanserv nick.
# example: set serv(nick) "ChanServ" or "PRIVMSG X@channels.undernet.org"
set serv(nick) "ChanServ"

# Chanserv deop command.
# use %nick for the nick you want to deop and %chan for the channel name.
# example: set serv(deop) "deop %chan %nick"
set serv(command) "deop %chan %nick"

# Set the time in seconds to wait before reseting the punishment monitor:
# Note: this setting means the bot will apply the punishment steps on each user
# within this period of time, otherwise it'll trigger steps from the beginning.
variable pwait 180

# Set here the warning method you wish to use: (PRIVMSG or NOTICE)
variable wmeth NOTICE

# Edit this only if your bot is an ircop and will use the kline command:
# Set here the kline command used on your server.
# for example some ircds user:
# kline %mask %time %reason
# others use:
# kline %time %mask %reason
## NOTE:
# %mask = the klined mask.
# %time = the kline time.
# %reason = the kline reason.
##
set kline(cmd) "kline %time %mask :%reason"

# set the default kline time. (seconds or minutes depends on your ircd)
set kline(time) 30

## Available punishment methods:
# v : Void - do nothing
# w : Warn offender
# k : Kick offender
# b : Ban offender
# kb : Kick + Ban offender
# kl : KLine offender
# kil: Kill offender
#
## You can use them like this for example:
# w:k:kb
# this means, first Warn then Kick then Kickban. (if offence is repeated ofcourse)
## these steps will be triggered if the offences happend during <pwait> seconds.
# NOTE: These methods are not applicable on all flood types. I only applied this
# feature on the flood types I think they're needed.

## Available ban types:
# 0 : *!user@full.host.tld
# 1 : *!*user@full.host.tld
# 2 : *!*@full.host.tld
# 3 : *!*user@*.host.tld
# 4 : *!*@*.host.tld
# 5 : nick!user@full.host.tld
# 6 : nick!*user@full.host.tld
# 7 : nick!*@full.host.tld
# 8 : nick!*user@*.host.tld
# 9 : nick!*@*.host.tld
# 10: *!user@*
# 11: nick!*@*

## Available kline mask types:
# 0 : user@full.host.tld
# 1 : *user@full.host.tld
# 2 : *@full.host.tld
# 3 : *user@*.host.tld
# 4 : *@*.host.tld
# 5 : user@full.host.tld
# 6 : *user@full.host.tld
# 7 : *@full.host.tld
# 8 : *user@*.host.tld
# 9 : *@*.host.tld
# 10: user@*

##########################
# TEXT FLOOD #
##########################

#
## 1 ## Text flood (lines)
#

# use .chanset #channel ap:textl <lines>:<seconds> <btime> <pmeth> <btype> (in DCC, 0:0 to disable)
# Set default rate here:
lappend ap:udefs {ap:textl "5:2 60 k:kb 2"}

# Text flood (lines) kick msg.
set textl(kmsg) "Text flood detected. $kckcount(form)"

# Text flood (lines) warn msg.
set textl(wmsg) "Warning: You've triggered text flood (lines) protection, slow down your typing."

## Edit the following only if you choose a punish method above 5 (oper commands):

# Text flood (lines) kline mask type.
set textl(ktype) 2

# Text flood (lines) kline/kill reason.
set textl(klmsg) "Text flooding is not permissable on this network."

# Text flood (lines) kline time (seconds or minutes depends on your ircd).
set textl(ktime) 0

#
## 2 ## Text flood (chars)
#

lappend ap:udefs {ap:textc "215:3 120 kb 2"}

set textc(kmsg) "Excess chars detected. $kckcount(form)"

set textc(wmsg) "Warning: You've triggered text flood (chars) protection, decrease your text legnth."

## Edit the following only if you choose a punish method above 5 (oper commands):

set textc(ktype) 2

set textc(klmsg) "Text flooding (chars) is not permissable on this network."

set textc(ktime) 0

#
## 3 ## Notice flood (lines)
#

lappend ap:udefs {ap:notcl "1:3 120 kb 2"}

set notcl(kmsg) "Notice not allowed. $kckcount(form)"

set notcl(wmsg) "Warning: you've triggered notice flood (lines) protection, slow down your notices."

## Edit the following only if you choose a punish method above 5 (oper commands):

set notcl(ktype) 2

set notcl(klmsg) "Notice flooding is not permissable on this network."

set notcl(ktime) 0

#
## 4 ## Notice flood (chars)
#

lappend ap:udefs {ap:notcc "200:3 180 kb 2"}

set notcc(kmsg) "Excess chars (notice) detected. $kckcount(form)"

set notcc(wmsg) "Warning: you've triggered notice flood (chars) protection, decrease your text length."

## Edit the following only if you choose a punish method above 5 (oper commands):

set notcc(ktype) 2

set notcc(klmsg) "Notice flooding (chars) is not permissable on this network."

set notcc(ktime) 0

###################
# TEXT #
###################

#
## 5 ## Caps flood.
#

# Use .chanset #channel ap:caps <percent>:<line-length> <btime> <pmeth> <btype> (in DCC, 0:0 to disable)
# Set default rate here:
lappend ap:udefs {ap:caps "60:90 120 kb 2"}

set capsp(kmsg) "Excess CAPS detected. $kckcount(form)"

set capsp(wmsg) "Warning: You've triggered caps flood protection, release your caps."

## Edit the following only if you choose a punish method above 5 (oper commands):

set capsp(ktype) 2

set capsp(klmsg) "Caps flooding is not permissable on this network."

set capsp(ktime) 0

#
## 6 ## Text repeating.
#

lappend ap:udefs {ap:repeatl "3:10 60 k:kb 2"}

## Text repeating Kick on how many consecutive repeated letters?
## Example: if this is set to 5 then the bot will kick any user who types (example):
# Hellooooo (5 consecutive o's)
# Hello!!!!!!!!! (5 and more consecutive ! marks)
## Use .chanset #channel ap:repeatc <number-of-letters> <btime> <pmeth> <btype> (in DCC, 0 to disable)
# Set default value here:
lappend ap:udefs {ap:repeatc "25 30 w:k:kb 2"}

set repeatf(kmsg) "Text repeating detected. $kckcount(form)"

set repeatf(lkmsg) "Letter repeats detected, do not use excess consecutive letters. $kckcount(form)"

set repeatf(wmsg) "Warning: You've triggered %type repeating protection, stop repeating."

## Edit the following only if you choose a punish method above 5 (oper commands):

set repeatf(ktype) 2

set repeatf(klmsg) "Constant repeating is not permissable on this network."

set repeatf(ktime) 0

#
## 7 ## Control codes.
#

# Use .chanset #channel ap:codes r:<n> b:<n> u:<n> c:<n> <btime> <pmeth> <btype> (in DCC)
# Example: If you set ap:codes to: r:35 b:35 u:35 c:35
# Then 35 (or more) characters affected by Reverse or Bold or Underline or Color
# will be considered an offence.
# Set default rate here:
lappend ap:udefs {ap:codes "r:35 b:80 u:80 c:80 90 kb 2"}

set codesf(kmsg) "Excess codes detected. $kckcount(form)"

set codesf(wmsg) "Warning: You've triggered control codes protection, release your msgs from codes."

## Edit the following only if you choose a punish method above 5 (oper commands):

set codesf(ktype) 2

set codesf(klmsg) "Excess use of control codes is not permissable on this network."

set codesf(ktime) 0

#
## 8 ## Advertising.
#

# NOTE: This protection also works for private advertising.

# Use .chanset #channel ap:adv + <btime> <pmeth> <btype> (to enable)
# set default value here: (+ enabled, - disabled)
lappend ap:udefs {ap:adv "+ 180 kb 2"}

# Set here the string you want to exempt (don't consider as spam):
# Note: %chan = current channel. Also, you can change these for every channel via DCC
# using the .ap:add command. (no wildcards used)
set adexempts(global) { %chan www.egghelp.org }

set adwords(global) { "*join *" "*plz visit*" }

set adv(kmsg) "Advertising detected. $kckcount(form)"

set adv(wmsg) "Warning: You've triggered adverting protection, advertisements are not allowed."

# ANTI SPAM BOT: (NOTE: Some networks may not allow such bots.)

# Use: .chanset #channel ap:antispam + <greet> <cycle-time> <idle-time> (to enable)
# the antispam bot will not cycle a channel where last join occured in <idle-time> or more minutes.
# <greet> is either + or - which will enable or disable the on-join message.
# set default value here:
lappend ap:udefs {ap:antispam "- + 10 10"}

# AntiSpamBot basic settings
# You can edit all these settings as you wish
# example: set antispam(nick) AntiSpamBot
set antispam(nick) $altnick
set antispam(altnick) ${altnick}1
# Antispam ident & real name
set antispam(user) AP
set antispam(realname) "AllProtection Anti-Spam"
# example: set antispam(ip) 127.0.0.1
set antispam(ip) ${my-ip}
# example: set antispam(host) my.lame.vhost.net
set antispam(host) ${my-hostname}

# Ban spammer in all channels or only in channels it's in? (0: It's in, 1: All)
set antispam(banall) 1

# Exempt list from greets:
set greetexempts(global) { *example*!*@* *!*example*@*.example.net }

# If you want your bot to reply to users with random message, set messages here:
set antispam(r) {
"hey, what's up"
"I'm feeling good today, what about you ?"
"I feel you're too busy ?"
"Are you nice ?"
"Hiiii lol"
"hello there, just teasing"
}

# On what messages do you want the bot to reply:
set antispam(t) {
"*hi*"
"*h r u*"
"*hello*"
"*hola*"
"*how *y*"
"*how *u*"
"*hey*"
"*asl*"
"*a/s/l*"
}

# Do you want the bot to msg users on join? (leave "" if no)
set antispam(greet) "Hello %nick, checking for spam. Please do not reply..."

# Stop greeting after how many joins in secs:
set antispam(jprot) 4:2

# Stop replying to messages after how many msgs in secs:
set antispam(mprot) 8:4

## Edit the following only if you choose a punish method above 5 (oper commands):

set adv(ktype) 2

set adv(klmsg) "Constant advertising is not permissable on this network."

set adv(ktime) 0

#
## 9 ## Swearing.
#

lappend ap:udefs {ap:swear "+ 120 kb 2"}

set bwords(global) {
*fark*
"*bastard *"
*cock*
"* @#$ *"
*ommak*
*fag*
"* shoot*"
*asshole*
*bitch*
*pussy*
"* whore *"
"* slut *"
*dickhead*
*horny*
"* shoot *"
*fagget*
"* !@#$? *"
"* fag? *"
"* fuker *"
*p%&@#*
"* fuk *"
}

set swear(kmsg) "Bad word detected. $kckcount(form)"

set swear(wmsg) "Warning: You've triggered swearing protection, cussing is prohibited."

## Edit the following only if you choose a punish method above 5 (oper commands):

set swear(ktype) 2

set swear(klmsg) "Swearing is not permissable on this network."

set swear(ktime) 0

#
## 8-9 ## Swearing/Advertising in part/quit messages
#
# Exampl: "s:1 a:1" Enables banning of users with part/quit msgs containing swear/advertisement
lappend ap:udefs {ap:pqsadv "s:1 a:1"}

###################
# CTCP #
###################

#
## 10 ## CTCP/CTCR flood
#

lappend ap:udefs {ap:ctcps "2:30 180 kb 2"}

set ctcpf(kmsg) "CTCP flood detected. $kckcount(form)"

set ctcpf(wmsg) "Warning: You've triggered CTCP/CTCR flood protection, decrease your ctcps."

## Edit the following only if you choose a punish method above 5 (oper commands):

set ctcpf(ktype) 2

set ctcpf(klmsg) "CTCP/CTCR floods are not permissable on this network."

set ctcpf(ktime) 0

###################
# TAKEOVER #
###################

#
## 11 ## Mass deop.
#

lappend ap:udefs {ap:massd "5:1 30 kb 2"}

# Mass deop: deop abuser ? (0: no , 1: yes)
set massdeop(deop) 1

set massdeop(kmsg) "Mass deop detected. $kckcount(form)"

set massdeop(wmsg) "Warning: You've triggered the mass deop protection, do not repeat this action."

## Edit the following only if you choose a punish method above 5 (oper commands):

set massdeop(ktype) 2

set massdeop(klmsg) "Mass deops are not allowed on this network."

set massdeop(ktime) 0

#
## 12 ## Mass kick.
#

lappend ap:udefs {ap:massk "8:2 30 kb 2"}

# Mass kick: deop abuser ? (0: no , 1: yes)
set masskick(deop) 1

set masskick(kmsg) "Mass kick detected. $kckcount(form)"

set masskick(wmsg) "Warning: You've triggered mass kick protection, do not repeat this action."

## Edit the following only if you choose a punish method above 5 (oper commands):

set masskick(ktype) 2

set masskick(klmsg) "Mass kicks are prohibited on this network."

set masskick(ktime) 0

#
## 13 ## Mass ban (bans).
#

lappend ap:udefs {ap:massb "18:2 30 kb 2"}

# Mass ban (bans) deop abuser ? (1: yes , 0: no)
set massb(deop) 1

set massb(kmsg) "Mass ban is not allowed. $kckcount(form)"

set massb(wmsg) "Warning: You've triggered mass ban protection, do not repeat this action."

## Edit the following only if you choose a punish method above 5 (oper commands):

set massb(ktype) 2

set massb(klmsg) "Mass banning (bans) is prohibited on this network."

set massb(ktime) 0

#
## 14 ## Channel limit.
#

# Use .chanset #channel ap:limit <limit> (in DCC, 0 to disable)
# Note: this be the number that will be added to the channel's limit.
# Set default limit here:
lappend ap:udefs {ap:limit 8}

###################
# MISCELLANEOUS #
###################

#
## 15 ## Join flood.
#

lappend ap:udefs {ap:cjoin "3:2 120 kb 2"}

# Join flood: Check for join flood from same idents as well? (0: no, 1: yes)
set joinflood(checkident) 1

# Join flood: Lock channel when triggered ? (1: yes , 0: no)
set joinflood(lockchan) 1

# Join flood: If lock channel is enable, what modes ?
set joinflood(lockmode) "mR-k clone.join.flood"

# Join flood: lock time in seconds.
set joinflood(locktime) 45

set joinflood(kmsg) "Join flood detected. $kckcount(form)"

set joinflood(wmsg) "Warning: you've triggered join flood protection, further offence will cause harsher actions."

## Edit the following only if you choose a punish method above 5 (oper commands):

set joinflood(ktype) 2

set joinflood(klmsg) "Join floods are not permissable on this network."

set joinflood(ktime) 0

#
## 16 ## Part msg flood.
#

# Use .chanset #channel ap:partmsgs <message-length> <btime> <pmeth> <btype> (in DCC, 0 to disable)
# Set default value here:
lappend ap:udefs {ap:partmsgs "180 120 kb 2"}

# Also, you can ban if excess codes are used in a part msg:
# Use .chanset #channel ap:partmsgc r:<n> b:<n> u:<n> c:<n> <btime> <pmeth> <btype> (in DCC)
# Note: check codes protection to understand how codes checking work.
# r = reverse, b = bold, u = underline and c = colors.
# Set default rate here:
lappend ap:udefs {ap:partmsgc "r:35 b:35 u:35 c:35 30 kb 2"}

set pmsgf(kmsg) "Part msg flood detected. $kckcount(form)"

set pmsgf(wmsg) "Warning: You've triggered part msg flood protection, decrease text in your part reason."

## Edit the following only if you choose a punish method above 5 (oper commands):

set pmsgf(ktype) 2

set pmsgf(klmsg) "Part msg floods are not permissable on this network."

set pmsgf(ktime) 0

#
## 17 ## Revolving door.
#

# Use .chanset #channel ap:revdoor <seconds> <btime> <pmeth> <btype> (in DCC)
# example: setting this to 3 will make the bot ban whoever joins and parts/quits in 3 or less seconds.
# Set default value here:
lappend ap:udefs {ap:revdoor "3 120 kb 2"}

set revdoor(kmsg) "Join-part revolving door attempt detected. $kckcount(form)"

# Part messages that should not be considered as revdoor: (can use wildcards)
# Example: set revdoor(exempt) {"Registered."}
set revdoor(exempt) {}

set revdoor(wmsg) "Warning! you have triggered revolving-door protection, do not join-part channels."

## Edit the following only if you choose a punish method above 5 (oper commands):

set revdoor(ktype) 2

set revdoor(klmsg) "Revolving-door bots are not allowed on this network."

set revdoor(ktime) 0

#
## 18 ## Nick flood.
#

lappend ap:udefs {ap:nickf "4:12 60 w:k:kb 2"}

set nickflood(kmsg) "Nick flood detected. $kckcount(form)"

set nickflood(wmsg) "Warning: You've triggered nick flood protection, slow down your nick changes."

## Edit the following only if you choose a punish method above 5 (oper commands):

set nickflood(ktype) 2

set nickflood(klmsg) "Nick floods are not permissable on this network."

set nickflood(ktime) 0

#
## 19 ## Clones.
#

# Use .chanset #channel ap:clones <clones-number> <btime> <pmeth> <btype> (in DCC)
# Note: This will be the number of clones that triggers punishment.
# Set default value here:
lappend ap:udefs {ap:clones "8 120 kb 2"}

set eclones(kmsg) "Excess clones detected. $kckcount(form)"

set eclones(wmsg) "Warning: You've exceeded the maximum number of clones, remove your clones now."

# Do you want to check if the clones are still excess after warn?
# if yes then set this to the number of seconds to wait before checking again. (0 means no)
# NOTE: This should be less than <pwait> (at the beginning of the configuration).
set eclones(caw) 60

## Edit the following only if you choose a punish method above 5 (oper commands):

set eclones(ktype) 2

set eclones(klmsg) "Excess clones are not allowed on this network."

set eclones(ktime) 0

#
## 20 ## Bad nick.
#

# Use .chanset #channel ap:bnicks + <btime> <pmeth> <btype> (in DCC to enable)
# Set default value here: (+ enabled, - disabled)
lappend ap:udefs {ap:bnicks "+ 120 kb 2"}

set bnicks(global) {
*porno*
*horny*
*horney*
*fark*
*asshole*
*!@#$*
*bitch*
*fagget*
*shoot*
*shoot*
*p%&@#*
*pussy*
*fukker*
}

set bnick(kmsg) "Bad nick detected. $kckcount(form)"

set bnick(wmsg) "Warning! you are using a bad nick, type /nick <nick> to change it."

set bnick(caw) 60

## Edit the following only if you choose a punish method above 5 (oper commands):

set bnick(ktype) 2

set bnick(klmsg) "Bad nicks are not allowed on this network."

set bnick(ktime) 0

#
## 21 ## Random drones.
#

# Use .chanset #channel ap:drones + <btime> <pmeth> <btype> (in DCC to enable)
# Set default value here: (+ enabled, - disabled)
# If you set <pmeth> to a positive-integer then the bot will only kick the drone once.
# So if the drone rejoins within this amount of seconds it won't be kicked again.
lappend ap:udefs {ap:drones "+ 180 45 2"}

# Random drones: What masks to exempt? (remember to change these or remoce them)
set droneexempts(global) { *example1*!*@* *!*example2*@* *!*@example3.net }

set drone(kmsg) "Possible random drone detected. $kckcount(form)"

set drone(wmsg) "Warning: You've triggered random drones protection, change your nick now."

## Edit the following only if you choose a punish method above 5 (oper commands):

set drone(ktype) 2

set drone(klmsg) "Random drones are not allowed on this network."

set drone(ktime) 0

#
## 22 ## Bad ident.
#

# Use .chanset #channel ap:bidents + <btime> <pmeth> <btype> (in DCC to enable)
# Set default value here: (+ enabled, - disabled)
lappend ap:udefs {ap:bidents "+ 120 kb 2"}

set bidents(global) {
*porno*
*horny*
*horney*
*fark*
*asshole*
*!@#$*
*bitch*
*fagget*
*shoot*
*shoot*
*p%&@#*
*pussy*
*fukker*
}

set bident(kmsg) "Bad ident detected. $kckcount(form)"

set bident(wmsg) "Warning! you're using a bad ident. Disconnect, change it and then connect again."

set bident(caw) 60

## Edit the following only if you choose a punish method above 5 (oper commands):

set bident(ktype) 2

set bident(klmsg) "Bad idents are not allowed on this network."

set bident(ktime) 0

#
## 23 ## Bad chans/Excess chans.
#

# Use .chanset #channel ap:bchans + <btime> <pmeth> <btype> <scan-time> (in DCC to enable)
# <scan-time> is the time in minutes in which the bot will scan the channel for users in bad chans. (0 disable)
# Set default value here: (+ enabled, - disabled)
lappend ap:udefs {ap:bchans "- 90 kb 2 0"}

# For excess channels use:
# .chanset #channel ap:echans <excess-chan-number> <btime> <pmeth> <btype> <scan-time> (in DCC to enable)
# if <excess-chan-number> is 0, then it is disabled.
lappend ap:udefs {ap:echans "0 60 w:kb 2 0"}

# Set default global badchan list here:
set bchans(global) { #example1 #example2 #example3 }

# Bad chans flood protect, stop whois/ctcp incase of x joins in y seconds: (applies on bad versions too)
set bchan(floodprot) 4:10

# Bad chans kick message:
set bchan(kmsg) "Bad chan detected. $kckcount(form)"

# Excess chans kick message:
set bchan(ekmsg) "Excess chans detected. $kckcount(form)"

# Bad/Excess chans check after warning time in seconds.
# Incase you chose to warn the offender (punish method), this is the time in seconds to wait
# before checking again. (keep it 0 if you're not using warn)
# Setting this to 50 or less will be useless, also make sure this is less than pwait.
set bchan(caw) 60

# Bad chans warning message:
set bchan(wmsg) "Warning: You're on a bad chan %bchan, leave it or you'll be kicked from %chan. You have $bchan(caw) seconds to leave %bchan."

# Excess chans warning message:
set bchan(ewmsg) "Warning: You're on excess chans (%echan), maximum allowed is %max. You have $bchan(caw) seconds to leave excess chans."

## Edit the following only if you choose a punish method above 5 (oper commands):

set bchan(ktype) 2

set bchan(klmsg) "Joining bad channels is prohibited on this network."

set bchan(ktime) 0

#
## 24 ## Bad CTCP reply
#

# Use .chanset #channel ap:bctcrs + <btime> <pmeth> <btype> <scan-time> (in DCC to enable)
# Set default value here: (+ enabled, - disabled)
lappend ap:udefs {ap:bctcrs "- 120 kb 2 0"}

# Use .chanset #channel ap:ctcpchecks <ctcp-types>
# Set default CTCP replies to check for: (example: "VERSION TIME FINGER")
lappend ap:udefs {ap:ctcpchecks "VERSION"}

set bctcrs(global) {
"*exploitation script*"
}

# %rtype is the CTCP reply type.
set bctcr(kmsg) "Bad %rtype reply detected. $kckcount(form)"

# Bad version check after warning time in seconds.
# Same as check for bad/excess chans.
set bctcr(caw) 60

set bctcr(wmsg) "Warning: You replied with \"%vers\" for %rtype request, if you don't change your script you'll be kicked from %chan. You have $bctcr(caw) seconds."

## Edit the following only if you choose a punish method above 5 (oper commands):

set bctcr(ktype) 2

set bctcr(klmsg) "Using bad scripts is prohibited on this network."

set bctcr(ktime) 0

#########################################
# BOTNET FLOOD PROTECTION (MASS FLOODS) #
#########################################

#
## 1 ## Botnet Text flood (lines).
#

# Use .chanset #channel ap:btextl <lines>:<seconds> <lockmode> <locktime> (in DCC, 0:0 to disable)
# Set default rate here:
lappend ap:udefs {ap:btextl "15:7 mR-k lines.flood 60"}

#
## 2 ## Botnet Text flood (chars).
#

lappend ap:udefs {ap:btextc "550:3 mR-k chars.flood 60"}

#
## 3 ## Botnet Notice flood (lines).
#

lappend ap:udefs {ap:bnotcl "4:2 mR-k lines.flood 60"}

#
## 4 ## Botnet Notice flood (chars).
#

lappend ap:udefs {ap:bnotcc "500:3 mR-k chars.flood 60"}

#
## 5 ## Botnet CTCP/CTCR flood.
#

lappend ap:udefs {ap:bctcp "4:60 mR-k ctcp.flood 60"}

#
## 6 ## Botnet join flood.
#

lappend ap:udefs {ap:massjoin "9:3 mR-k join.flood 60"}

#
## 7 ## Botnet revolving door flood.
#

## Note: ap:revdoor must be set for this to work.

lappend ap:udefs {ap:brevdoor "5:3 mR-k revdoor.flood 60"}

#
## 8 ## Botnet part msg flood.
#

## Note: ap:partmsgs or ap:partmsgc (or both) must be enabled for this to work.

lappend ap:udefs {ap:bpartmsg "5:3 mR-k partmsg.flood 60"}

#
## 9 ## Botnet Nick flood.
#

lappend ap:udefs {ap:bnickf "5:30 mR-k nick.flood 60"}

#
## 10 ## Botnet Codes flood.
#

lappend ap:udefs {ap:bcodes "25:3 mR-k codes.flood 60"}

###########################
# PRIVATE PROTECTIONS #
###########################

# Set here if you want the bot to set a restriction mode on itself when flooded.
# example: +R is used on DALnet so only registered users can send to the bot.
# set this to "" if you don't wish to change your bot's modes during a flood.
# NOTE: Maximum 1 mode, less or more means it's disabled.
set apfp(rmode) R

# Set here the time you want to keep the restriction mode in seconds.
set apfp(rtime) 30

# How many seconds do you want to stop answering data from server?
set apfp(itime) 45

#
## 1 ## Private text floods.
#

# Private text (lines) flood <lines>:<seconds>. (0:0 to disable)
set ptextl(punish) 12:6

# Private text (chars) flood <chars>:<seconds>. (0:0 to disable)
set ptextc(punish) 750:6

#
## 2 ## Private notice floods.
#

set pnotil(punish) 6:3

set pnotic(punish) 600:4

#
## 3 ## Private CTCP/CTCR flood.
#

set pctcpf(punish) 4:20

# Configurations end here. #
############################
#
######################################################################
# Code starts here, please do not edit anything unless you know TCL: #
# __________________________________________________________________ #

proc istimer {arg {t timers}} {
set a ""
foreach rt [$t] {
if {[string equal -nocase $arg [lindex $rt 1]]} {
set a [lindex $rt 2] ; break
}
}
set a
}

if {![info exists NumKicks]} {
if {![file exists $kckcount(file)]} {set NumKicks 0} {
set NumKicks [read -nonewline [set kcfop [open $kckcount(file)]]][close $kcfop][unset kcfop]
if {![string is integer -strict $NumKicks]} {set NumKicks 0}
}
}

variable bred 0
variable sfluds 0
foreach apudef ${ap:udefs} {
if {[lindex $apudef 0] == "ap:level" && !$banthruX(do)} {continue}
setudef str [lindex $apudef 0]
}
unset apudef

proc load {{b bind}} {
if {$b == "loaded"} { set b bind }
set nsc [namespace current]
foreach joinb {cjoin massjoin bchans bctcrs drones bnicks bidents clones} {
$b join - * "${nsc}::joins $joinb"
}
foreach pubmb {textl textc btextl btextc bcodes adv swear repeatl codes caps} {
$b pubm - * "${nsc}::pubms $pubmb"
}
foreach notcb {notcl notcc bnotcl bnotcc bcodes adv swear codes} {
$b notc - * "${nsc}::notc $notcb"
}
foreach ctcpb {textl textc btextl btextc bcodes adv swear repeatl codes caps} {
$b ctcp - ACTION "${nsc}::ctcps $ctcpb"
}
foreach {modem modeb} {"* -b" rembs "* +b" massb "* -o" massd "* +o" cbcd} {
$b mode - $modem "${nsc}::modes $modeb"
}
foreach partb {revdoor partmsgs adv swear} {
$b part - * "${nsc}::parts $partb"
}
foreach signb {revdoor adv swear} {
$b sign - * "${nsc}::parts $signb"
}
$b ctcp - * "${nsc}::ctcps ctcps"
$b ctcp - * "${nsc}::ctcps bctcp"
$b nick - * "${nsc}::joins bnicks"
$b nick - * "${nsc}::nicks nickf"
$b nick - * "${nsc}::nicks bnickf"
$b ctcr - * ${nsc}::bctcrs
$b ctcr - * ${nsc}::ctcr
$b kick - * ${nsc}::massk
$b raw - 319 ${nsc}::bchansgw
$b msgm - * "${nsc}::ptext f"
$b msgm - * "${nsc}::ptext adv"
$b ctcp - ACTION "${nsc}::pctcp text"
$b ctcp - * "${nsc}::pctcp ctcp"
$b notc - * ${nsc}::pnotc
$b ctcr - * ${nsc}::pctcr
$b flud - * ${nsc}::pflud
$b time - * ${nsc}::core
$b time - * ${nsc}::antispamcore
$b evnt - prerehash ${nsc}::unload
$b evnt - prerestart ${nsc}::unload
foreach apdccb {import reset disable add rem list monitor priv} {
$b dcc n|n ap:$apdccb "${nsc}::cmd $apdccb"
}
if {$b == "bind"} {
rd; variable logkbs
foreach c [channels] { init $c }
if {![info exists logkbs(logs)] && $logkbs(do)} {
lappend logkbs(logs) "\$Log started [ctime [unixtime]]\$"
if {[file exists $logkbs(file)]} {
append logkbs(logs) " [lrange [split [read [set f [open $logkbs(file)]]] \n][close $f] 1 end]"
}
}
checkscans
if {[lsearch -glob [binds loaded] "* ${nsc}::load"] != -1} {
unbind evnt - loaded ${nsc}::load
}
upvar #0 [ezilamn noisrev-pctc] cvar
if {![string match "* [ezilamn "\002gnisoppO\002"] *" $cvar]} {
set cvar "$cvar [ezilamn ")zF_riS aka( \002gnisoppO\002 yb 7.4v noitcetor\002P\002ll\002A\002 gnisU -"]"
}
putlog "\002A\002ll\002P\002rotection v4.7 by Opposing Loaded..."
}
}

proc joins {flood nick uhost hand chan {nn ""}} {
if {[isbotnick $nick]} {init $chan ; return 0}
if {[set chan [string tolower $chan]] == "*" || [invalid:apc $nick $hand $chan]} {return 0}
if {$flood != "bchans" && ![vcg $chan ap:$flood]} {return 0}
foreach {off btime pmeth btype} [set cgot [split [channel get $chan ap:$flood]]] {break}
switch -- $flood {
"cjoin" {
variable joinflood; variable apjoinfn
foreach {j s} [cgsplit $off] {break}
if {[invalid:apf $j $s]} {return 0}
Nfollow $s apjoinfn([set h jnf:[string tolower [set f [lindex [split $uhost @] 1]]:$chan]]) $nick $uhost
if {$joinflood(checkident)} {
Nfollow $s apjoinfn([set hi jif:[string tolower [lindex [split $uhost @] 0]:$chan]]) $nick $uhost
}
if {[set ts [follow $s $h $j 1 1]] != -1 || ($joinflood(checkident) && [set ts2 [follow $s $hi $j 1 1]] != -1)} {
if {[info exists ts2]} { set f [lindex [split $uhost @] 0]; set ts $ts2 ; set h $hi }
if {$joinflood(lockchan)} {lockc $chan $joinflood(lockmode) $joinflood(locktime) "Join flood from $f"}
punish $pmeth $apjoinfn($h) $chan [mapr $joinflood(kmsg) "$j joins in $ts secs"] $joinflood(wmsg) $btype $btime $joinflood(klmsg) $joinflood(ktime) $joinflood(ktype) [string tolower $f]:joinflood
}
}
"massjoin" {
foreach {o s} [cgsplit $off] {break}
if {[invalid:apf $o $s] || [isbotnick $nick]} {return 0}
checklc $s mjf:$chan $o $chan [join [lrange $cgot 1 end-1]] [lindex $cgot end] join
}
"bnicks" {
variable bnick; variable bnicks
if {$nn == ""} { set nn $nick }
if {[string first # $chan] != 0 || [invalid:apc $nn $hand $chan]} {return 0}
if {$off != "+"} {return 0}
if {![info exists bnicks($chan)]} { set l $bnicks(global) } { set l $bnicks($chan) }
set isbn 0
foreach bn $l { if {[string match -nocase $bn $nn]} {set isbn 1; break} }
if {$isbn} {
if {$bnick(caw) > 0 && [string match -nocase *w* $pmeth]} {
set bnick([set ch $chan:[string tolower $uhost]]) 1
if {[istimer "[namespace current]::followrem bnick($ch)" utimers]==""} {
utimer [expr {$bnick(caw) + 1}] [list [namespace current]::followrem bnick($ch)]
}
}
punish $pmeth [list $nn $uhost] $chan [mapr $bnick(kmsg) $bn] $bnick(wmsg) $btype $btime $bnick(klmsg) $bnick(ktime) $bnick(ktype) [string tolower $uhost]:bnick
}
}
"drones" {
variable droneexempts
if {$off != "+"} {return 0}
set Nod 0
if {[info exists droneexempts([set chan [string tolower $chan]])]} { set l $droneexempts($chan) } { set l $droneexempts(global) }
foreach e $l { if {[string match -nocase $e $nick!$uhost]} {set Nod 1 ; break} }
if {$Nod} {return 0}
set id [string trimleft [lindex [split $uhost @] 0] ~]
if {[follow 2 dr:$chan 3] != -1} {return 0}
if {[regexp {^[a-z]{4,}![a-z]{4,}$} $nick!$id]} {
if {(![string match {*[aeiou]*} $nick]) || ([regexp {^[^aeiou]{4}|[aeiou]{4}|q[^ua]|[^aeioux]x[^aeiouyx]|[^aeiouy]{5}} $nick dronm] && ![regexp {a{3}|e{3}|i{3}|o{3}|u{3}} $nick])} {
if {![info exists dronm]} { set dronm "no vowels" }
droneb $nick $uhost $chan $btime $pmeth $btype *$dronm*
} elseif {![string match *$id* $nick] && [regexp {q[bcdfghknpqrstwzxv]|x[dfghkmnqrvz]|z[bcdfhmqrtvx]|v[bfghkmnqxw]|g[zv]|kz|bgb|wj|lx|jwm} $nick dronm]} {
droneb $nick $uhost $chan $btime $pmeth $btype *$dronm*
}
}
}
"bidents" {
variable bident; variable bidents
if {[invalid:apc $nick $hand $chan]} {return 0}
if {$off != "+"} {return 0}
scan $uhost {%[^@]} ident
if {![info exists bidents($chan)]} { set l $bidents(global) } { set l $bidents($chan) }
set isbi 0
foreach bi $l { if {[string match -nocase $bi $ident]} {set isbi 1; break} }
if {$isbi} {
if {$bident(caw) > 0 && [string match -nocase *w* $pmeth]} {
set bident([set ch $chan:[string tolower $uhost]]) 1
if {[istimer "[namespace current]::followrem bident($ch)" utimers]==""} {
utimer [expr {$bident(caw) + 1}] [list [namespace current]::followrem bident($ch)]
}
}
punish $pmeth [list $nick $uhost] $chan [mapr $bident(kmsg) $bi] $bident(wmsg) $btype $btime $bident(klmsg) $bident(ktime) $bident(ktype) [string tolower $uhost]:bident
}
}
"clones" {
variable eclones
if {![string is integer $off] || $off <= 0} {return 0}
set c 0
foreach ccheck [chanlist $chan] {
if {[string equal -nocase [scan $uhost {%*[^@]@%s}] [scan [set chost [getchanhost $ccheck $chan]] {%*[^@]@%s}]]} {
incr c ; lappend cn $ccheck ; lappend cn $chost
}
}
if {$c >= $off} {
if {$eclones(caw) > 0 && [string match -nocase *w* $pmeth]} {
set eclones([set ch $chan:[string tolower [lindex [split $uhost @] 1]]]) 1
if {[istimer "[namespace current]::followrem eclones($ch)" utimers]==""} {
utimer [expr {$eclones(caw) + 1}] [list [namespace current]::followrem eclones($ch)]
}
}
punish $pmeth $cn $chan [mapr $eclones(kmsg) %ic/$c] $eclones(wmsg) $btype $btime $eclones(klmsg) $eclones(ktime) $eclones(ktype) [string tolower [scan $uhost {%*[^@]@%s}]]:eclones
}
}
"bchans" {
if {[vcg $chan ap:bchans] || [vcg $chan ap:echans]} {
set off1 [lindex [split [channel get $chan ap:echans]] 0]
if {![string is integer -strict $off1]} {set off1 0}
if {$off == "+" || $off1 > 0} {
bchansw $nick $uhost $hand $chan 0
}
}
}
"bctcrs" {
if {$off == "+"} { bchansw $nick $uhost $hand $chan 1 }
}
}
}

proc pubms {flood nick uhost hand chan arg} {
if {[invalid:apc $nick $hand [set chan [string tolower $chan]]]} {return 0}
if {![vcg $chan ap:$flood]} {return 0}
foreach {off btime pmeth btype} [set cgot [split [channel get $chan ap:$flood]]] {break}
switch -- $flood {
"textl" - "textc" {
foreach {o s} [cgsplit $off] {break}
seqflood $flood $o $s $nick $uhost $chan $pmeth $btype $btime [string length $arg]
}
"btextl" - "btextc" {
foreach {o s} [cgsplit $off] {break}
if {[invalid:apf $o $s]} {return 0}
checklc $s $flood:$chan $o $chan [join [lrange $cgot 1 end-1]] [lindex $cgot end] "text ([expr {$flood=="btextl"?"lines":"chars"}])" [expr {$flood=="btextl"?1:[string length $arg]}]
}
"repeatl" {
variable repeatf
foreach {o s} [cgsplit $off] {break}
set arg [cf $arg]
if {![invalid:apf $o $s]} {
if {[set ts [follow $s rpt:[md5 [string tolower $uhost:$arg:$chan]] $o]] != -1} {
set kmsg [mapr $repeatf(kmsg) "$o repeats in $ts secs"]
set wmsg [string map {%type text} $repeatf(wmsg)] ; set reptype repeatl
}
}
if {![info exists kmsg] && [vcg $chan ap:repeatc]} {
set cgotc [split [channel get $chan ap:repeatc]]
if {[string is integer [set i [lindex $cgotc 0]]] && $i > 0} {
set cl "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&"
for {set c 0} {$c < [string length $cl]} {incr c} {
if {[string match -nocase *[string repeat [string index $cl $c] $i]* $arg]} {
foreach {btime pmeth btype} [lrange $cgotc 1 end] {break}
set kmsg [mapr $repeatf(lkmsg) "${i}+ consecutive [string index $cl $c]'s"]
set wmsg [string map {%type letter} $repeatf(wmsg)] ; set reptype repeatc ; break
}
}
}
}
if {[info exists kmsg]} {
punish $pmeth [list $nick $uhost] $chan $kmsg $wmsg $btype $btime $repeatf(klmsg) $repeatf(ktime) $repeatf(ktype) [string tolower $uhost]:$reptype
}
}
"codes" {
variable codesf
if {[string is integer [set cc [ccodes $chan $arg ap:codes]]] && $cc > 0} {
punish [lindex $cgot 5] [list $nick $uhost] $chan [mapr $codesf(kmsg) "$cc chars affected"] $codesf(wmsg) [lindex $cgot 6] [lindex $cgot 4] $codesf(klmsg) $codesf(ktime) $codesf(ktype) [string tolower $uhost]:codesf
}
}
"bcodes" {
foreach {o s} [cgsplit $off] {break}
if {[invalid:apf $o $s]} {return 0}
checklc $s bcodes:$chan $o $chan [join [lrange $cgot 1 end-1]] [lindex $cgot end] "control codes" [regexp -all {\002|\003\d{1,2}(,\d{1,2})?|\017|\026|\037} $arg]
}
"adv" {
if {$off != "+"} {return 0}
variable adv
if {[set advword [isspam $arg $chan]] != ""} {
punish $pmeth [list $nick $uhost] $chan [mapr $adv(kmsg) *$advword*] $adv(wmsg) $btype $btime $adv(klmsg) $adv(ktime) $adv(ktype) [string tolower $uhost]:adv
}
}
"swear" {
variable swear ; variable bwords
if {$off != "+"} {return 0}
se
sk68  -  Sat Feb 12, 2011 9:10 am Reply with quote
Thanks for the reply, but I think you're misunderstanding what I need. Im not looking for channel protection and such, Im looking for a snippet I can incorporate into scripts to protect from that command being abused
Get_A_Fix  -  Wed Mar 02, 2011 6:33 am Reply with quote

sk68 wrote

Thanks for the reply, but I think you're misunderstanding what I need. Im not looking for channel protection and such, Im looking for a snippet I can incorporate into scripts to protect from that command being abused


Eggdrop has default flood protection via the .chanset command. You can configure these as follows.

flood-chan <= sets how many channel messages in how many seconds from one host constitutes a flood. Setting this to 0 or 0:0 disables flood protection for the channel.

flood-deop <= settings are as above.

flood-kick <= settings are as above.

flood-join <= settings are as above.

flood-ctcp <= settings are as above.

flood-nick <= settings are as above.

Examples on setting these via eggdrop Partyline:

.chanset #channel flood-chan 5:3 <= sets a flood check of 5 lines in 3 seconds.

.chanset #channel flood-deop 3:5 <= sets a flood check of 3 deops in 5 seconds.

.chanset #channel flood-kick 3:5 <= as above.

.chanset #channel flood-join 5:10 <= sets a flood check of 5 joins in 10 seconds.

.chanset #channel flood-ctcp 2:30 <= sets a flood check of 2 CTCP events to channel in 30 seconds.

.chanset #channel flood-nick 5:60 <= sets a flood check for 5 nick changes in 60 seconds.

The above settings allow you to play around a bit, fine tune etc. The default settings only really allow for a kick to be done, so you may need to add a little bit of code in order to make the bot ban the user for matching floods.

If you set the above flood-controls and use a script like this

Code
 


it should auto ban+kick the user from the channel. The above code checks if the user is known to the bot, it won't affect anyone who is added with a global 'o' flag and above, or channel 'o' flag and above. It currently checks text, joins, ctcps. Edit as needed.
sk68  -  Wed Mar 02, 2011 1:25 pm Reply with quote
What I mean is, I want a command I can plug into a script to stop that script's commands from being abused. For example, I have a script that allows people to add and read quotes, I want a command I can put in so that if someone has used a command, say, 3 times in the last 10 seconds, they will be ignored for flooding, sorry if I'm not being clear
Display posts from previous:   
Post new topic   Reply to topic    Hawkee.com Forum Index -> TCL Scripting All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.