| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Mar 23, 2016 1:30 pm Post subject: repeatativy mode setting |
|
|
greetings i wonder why this anti join/part tcl keep setting mode +mi as it needs to be set only once and removed after like 20 sec
| Code: | # ####
# INFO
# ####
#
# joinpart.tcl v1.3 (Sep 10, 2005)
#
# ###########
# DESCRIPTION
# ###########
#
# Channel Protection Script for Join/Part or Revolving Door Floods.
# BAN the IP's, Optional Banmask, Multiple Lock modes to protect channel from any sort of abusive message, as seen in join/part flood that clones send their messages during parting.
#
# ########
# FEATURES
# ########
#
# You can set channel lock modes, bansmask type, parting/revolving time period etc. depends on your channel situation,
# Set to invite only (+i) -OR- register only (+r on Undernet)/(+R on DALnet) -OR- Multiple modes (+mi/+mr) etc. to protect channel from continuous join/part and revolving door floods.
# By default, this script will ban those who part the channel after 3 seconds of joining with lock time of 8 seconds.
# you can change the settings as per your desire which is suitable for your channel.
#
# ############
# INSTALLATION
# ############
#
# * First unzip zipped file i.e. joinpart.zip file
# * Put joinpart.tcl file in your eggdrop "/scripts" folder
# * Add a link at the bottom of your eggdrop's .CONF file
#
# source scripts/joinpart.tcl
#
# * Save your bot's configuration
# * RESTART your bot -OR- do .rehash from the partyline (DCC) to load the tcl.
#
# #######
# UPDATES
# #######
#
# v1.0 - 01/04/2005 - Initial Release.
# v1.1 - 16/05/2005 - Bug Fixed: "Tcl error [ban:jp]: no such channel record"
# v1.2 - 22/06/2005 - Added: putlog.
# v1.3 - 10/09/2005 - Following;
# o BAN Style
# o BAN Time
#
# #######
# CONTACT
# #######
#
# Any suggestions, comments, questions or bugs,
# feel free to email me at:
#
# fyre_tcls@yahoo.com
#
# fyre @ #Eggdrop & #RO-TCL
# On Undernet IRC Network
#
# #########
# DOWNLOADS
# #########
#
# This script and other good scripts/tcls can be found on:
#
# * http://www.egghelp.org/
# * http://www.tclscript.com/
#
# -REGARDS-
########################
#- Channel Activation -#
########################
# DCC/Partyline : n|n .chanset Use .chanset to activate the protections for the particular channel or not.
# Example : .chanset * +joinpart
# .chanset #mychan2 -joinpart
#########################
#- Part/Revolving Time -#
#########################
# Set time period (in seconds) that how long did nick stay in channel before parting.
set jp(part) 10
###############
#- Lock Mode -#
###############
# Set channel modes which you want to be use for locking in join/part or revolving door floods,
# Leave blank "" if you dont like to set modes.
set jp(lock_modes) "im"
##############
#- BAN Type -#
##############
# Set the banmask type to use in banning the join/part or revolving door floods.
# Currently BAN Type is set to 1 (*!*@some.domain.com),
# BAN Types are given below;
# 1 - *!*@some.domain.com
# 2 - *!*@*.domain.com
# 3 - *!*ident@some.domain.com
# 4 - *!*ident@*.domain.com
# 5 - *!*ident*@some.domain.com
# 6 - *nick*!*@*.domain.com
# 7 - *nick*!*@some.domain.com
# 8 - nick!ident@some.domain.com
# 9 - nick!ident@*.host.com
set jpban_type 1
###############
#- Lock Time -#
###############
# Set time period (in seconds) that how much time it takes to do unlock after join/part flood.
set jp(unlock) 5
#####################
#- Kick/BAN Reason -#
#####################
# Set kick/ban reason here.
set jp(reason) "Part/Revolving Door Flood Detected"
###############
#- BAN Style -#
###############
# Set the punishment style/method you want to use to ban flooders.
# Select BAN Style from the following;
# 1 - Server Ban (set ban on the channel)
# 2 - Channel Ban (set ban in bot's internal banlist on specific channel)
# 3 - Global Ban (set ban in bot's internal banlist for every channel)
set jp(style) "1"
##############
#- BAN Time -#
##############
# Leave blank "" if you select style 1 in "BAN Style",
# If you select "BAN Style" 2 or 3 above, then set ban time in minutes, 0 for permanent ban.
set jp(btime) "0"
########################################################
#- Don't edit below unless you know what you're doing -#
########################################################
setudef flag joinpart
bind part - * ban:jp
proc ban:jp {nick uhost hand chan arg} {
global jp botnick jpchan
if {[isbotnick $nick] || ![botisop $chan] || ![channel get $chan joinpart]} {
return
}
if {![info exists jpchan($chan)]} {
set jpchan($chan) 0
}
if {($chan == $botnick) || [matchattr $hand b] || [matchattr $hand fom|fom $chan]} {
return
}
if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$jp(part)}]} {
if {$jp(style) == "1"} {
set banmask [jp:banmask $uhost $nick]
putnow "MODE $chan +$jp(lock_modes)b $banmask"
putnow "KICK $chan $nick :$jp(reason)"
putlog "JoinPart: Flood Attempt on $chan ($banmask) banned on the channel"
utimer $jp(unlock) [list putnow "MODE $chan -$jp(lock_modes)"]
}
if {$jp(style) == "2"} {
set banmask [jp:banmask $uhost $nick]
putnow "MODE $chan +$jp(lock_modes)b $banmask"
putnow "KICK $chan $nick :$jp(reason)"
putlog "JoinPart: Flood Attempt on $chan ($banmask) added in the channel banlist"
#newchanban "$chan" "$banmask" "JoinPart" "$jp(reason)" "$jp(btime)"
utimer $jp(unlock) [list putnow "MODE $chan -$jp(lock_modes)"]
}
if {$jp(style) == "3"} {
set banmask [jp:banmask $uhost $nick]
putnow "MODE $chan +$jp(lock_modes)b $banmask"
putnow "KICK $chan $nick :$jp(reason)"
#putlog "JoinPart: Flood Attempt on $chan ($banmask) added in the global banlist"
#newban "$banmask" "JoinPart" "$jp(reason)" "$jp(btime)"
utimer $jp(unlock) [list putnow "MODE $chan -$jp(lock_modes)"]
}
}
}
proc jp:banmask {uhost nick} {
global jpban_type
switch -- $jpban_type {
1 { set banmask "*!*@*.[join [lrange [split $uhost .] end-1 end] .]" }
10 { set banmask "*!*@[lindex [split $uhost @] 1]" }
2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
3 { set banmask "*!*$uhost" }
4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
6 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
7 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
8 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
9 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
default { set banmask "*!*@[lindex [split $uhost @] 1]" }
return $banmask
}
}
#############################################################
putlog "LOADED: Part/Revolving Door Flood Protection by fyre"
############################################################# |
| Quote: | 18:25:47 @Eggy Sets Mode on #uno to: +mib *!*@*.8.89
18:25:47 @Eggy Sets Mode on #uno to: +mib *!*@*.proxad.net
18:25:47 Parts : roman ~Kuntz@103.20.168.21
18:25:47 @Eggy Sets Mode on #uno to: +mib *!*@*.168.21
18:25:47 Parts : x01awm7byaie ~Lantz@138.255.32.77
18:25:47 @Eggy Sets Mode on #uno to: +mib *!*@*.32.77
18:25:53 @Eggy Sets Mode on #uno to: -mi
18:25:53 @Eggy Sets Mode on #uno to: -mi
18:25:53 @Eggy Sets Mode on #uno to: -mi
18:25:53 @Eggy Sets Mode on #uno to: -mi
18:26:01 Join : heard ~Stearns@177.224.18.100
18:26:01 Parts : heard ~Stearns@177.224.18.100
18:26:01 @Eggy Sets Mode on #uno to: +mib *!*@*.18.100
18:26:07 @Eggy Sets Mode on #uno to: -mi |
|
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Mar 23, 2016 3:49 pm Post subject: |
|
|
You don't need the:
| Code: |
($chan == $botnick)
|
check since this never validates.
Also, since you already decide on the ban mask via $jpban_type inside jp:banmask the:
| Code: |
if {$jp(style) == "1"} {
set banmask [jp:banmask $uhost $nick]
putnow "MODE $chan +$jp(lock_modes)b $banmask"
putnow "KICK $chan $nick :$jp(reason)"
putlog "JoinPart: Flood Attempt on $chan ($banmask) banned on the channel"
utimer $jp(unlock) [list putnow "MODE $chan -$jp(lock_modes)"]
}
if {$jp(style) == "2"} {
set banmask [jp:banmask $uhost $nick]
putnow "MODE $chan +$jp(lock_modes)b $banmask"
putnow "KICK $chan $nick :$jp(reason)"
putlog "JoinPart: Flood Attempt on $chan ($banmask) added in the channel banlist"
#newchanban "$chan" "$banmask" "JoinPart" "$jp(reason)" "$jp(btime)"
utimer $jp(unlock) [list putnow "MODE $chan -$jp(lock_modes)"]
}
if {$jp(style) == "3"} {
set banmask [jp:banmask $uhost $nick]
putnow "MODE $chan +$jp(lock_modes)b $banmask"
putnow "KICK $chan $nick :$jp(reason)"
#putlog "JoinPart: Flood Attempt on $chan ($banmask) added in the global banlist"
#newban "$banmask" "JoinPart" "$jp(reason)" "$jp(btime)"
utimer $jp(unlock) [list putnow "MODE $chan -$jp(lock_modes)"]
}
|
is also redundant since you take the same action anyway.
To fix your problem and your code try this:
| Code: |
proc ban:jp {nick uhost hand chan text} {
if {[isbotnick $nick] || ![botisop $chan] || ![channel get $chan joinpart] || [matchattr $hand b] || [matchattr $hand fom|fom $chan]} return
global jp botnick jpchan
if {![info exists jpchan($chan)]}
set jpchan($chan) 0
if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$jp(part)}]} {
set banmask [jp:banmask $uhost $nick]
lock:jp $chan $jp(lock_modes)
putnow "MODE $chan +b $banmask"
putnow "KICK $chan $nick :$jp(reason)"
putlog "JoinPart: Flood Attempt on $chan ($banmask) banned on the channel"
utimer $jp(unlock) [list unlock:jp $chan $jp(lock_modes)]
}
}
proc lock:jp {chan lock} {
if {![botisop $chan]} return
set cm [lindex [split [getchanmode $chan] +] 1]
foreach m [split $lock ""] {
if {[lsearch -exact $cm $m] != -1} continue
pushmode $chan +$m
}
}
proc unlock:jp {chan lock} {
if {![botisop $chan]} return
set cm [lindex [split [getchanmode $chan] +] 1]
foreach m [split $lock ""] {
if {[lsearch -exact $cm $m] != -1} {
pushmode $chan -$m
}
}
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Wed Mar 30, 2016 2:54 pm Post subject: |
|
|
thnx caesar i tried it but it returns the next error:
| Quote: | | Tcl error [ban:jp]: wrong # args: no script following "![info exists jpchan($chan)]" argument |
| Code: | # ####
# INFO
# ####
#
# joinpart.tcl v1.3 (Sep 10, 2005)
#
# ###########
# DESCRIPTION
# ###########
#
# Channel Protection Script for Join/Part or Revolving Door Floods.
# BAN the IP's, Optional Banmask, Multiple Lock modes to protect channel from any sort of abusive message, as seen in join/part flood that clones send their messages during parting.
#
# ########
# FEATURES
# ########
#
# You can set channel lock modes, bansmask type, parting/revolving time period etc. depends on your channel situation,
# Set to invite only (+i) -OR- register only (+r on Undernet)/(+R on DALnet) -OR- Multiple modes (+mi/+mr) etc. to protect channel from continuous join/part and revolving door floods.
# By default, this script will ban those who part the channel after 3 seconds of joining with lock time of 8 seconds.
# you can change the settings as per your desire which is suitable for your channel.
#
# ############
# INSTALLATION
# ############
#
# * First unzip zipped file i.e. joinpart.zip file
# * Put joinpart.tcl file in your eggdrop "/scripts" folder
# * Add a link at the bottom of your eggdrop's .CONF file
#
# source scripts/joinpart.tcl
#
# * Save your bot's configuration
# * RESTART your bot -OR- do .rehash from the partyline (DCC) to load the tcl.
#
# #######
# UPDATES
# #######
#
# v1.0 - 01/04/2005 - Initial Release.
# v1.1 - 16/05/2005 - Bug Fixed: "Tcl error [ban:jp]: no such channel record"
# v1.2 - 22/06/2005 - Added: putlog.
# v1.3 - 10/09/2005 - Following;
# o BAN Style
# o BAN Time
#
# #######
# CONTACT
# #######
#
# Any suggestions, comments, questions or bugs,
# feel free to email me at:
#
# fyre_tcls@yahoo.com
#
# fyre @ #Eggdrop & #RO-TCL
# On Undernet IRC Network
#
# #########
# DOWNLOADS
# #########
#
# This script and other good scripts/tcls can be found on:
#
# * http://www.egghelp.org/
# * http://www.tclscript.com/
#
# -REGARDS-
########################
#- Channel Activation -#
########################
# DCC/Partyline : n|n .chanset Use .chanset to activate the protections for the particular channel or not.
# Example : .chanset * +joinpart
# .chanset #mychan2 -joinpart
#########################
#- Part/Revolving Time -#
#########################
# Set time period (in seconds) that how long did nick stay in channel before parting.
set jp(part) 10
###############
#- Lock Mode -#
###############
# Set channel modes which you want to be use for locking in join/part or revolving door floods,
# Leave blank "" if you dont like to set modes.
set jp(lock_modes) "im"
##############
#- BAN Type -#
##############
# Set the banmask type to use in banning the join/part or revolving door floods.
# Currently BAN Type is set to 1 (*!*@some.domain.com),
# BAN Types are given below;
# 1 - *!*@some.domain.com
# 2 - *!*@*.domain.com
# 3 - *!*ident@some.domain.com
# 4 - *!*ident@*.domain.com
# 5 - *!*ident*@some.domain.com
# 6 - *nick*!*@*.domain.com
# 7 - *nick*!*@some.domain.com
# 8 - nick!ident@some.domain.com
# 9 - nick!ident@*.host.com
set jpban_type 1
###############
#- Lock Time -#
###############
# Set time period (in seconds) that how much time it takes to do unlock after join/part flood.
set jp(unlock) 5
#####################
#- Kick/BAN Reason -#
#####################
# Set kick/ban reason here.
set jp(reason) "Part/Revolving Door Flood Detected"
###############
#- BAN Style -#
###############
# Set the punishment style/method you want to use to ban flooders.
# Select BAN Style from the following;
# 1 - Server Ban (set ban on the channel)
# 2 - Channel Ban (set ban in bot's internal banlist on specific channel)
# 3 - Global Ban (set ban in bot's internal banlist for every channel)
set jp(style) "1"
##############
#- BAN Time -#
##############
# Leave blank "" if you select style 1 in "BAN Style",
# If you select "BAN Style" 2 or 3 above, then set ban time in minutes, 0 for permanent ban.
set jp(btime) "0"
########################################################
#- Don't edit below unless you know what you're doing -#
########################################################
bind pub n|n !joinpart joinpart_control
proc joinpart_control {nick host handle chan args} {
global joinpart botnick
if { ![channel get $chan joinpart] && [string compare $args "on"] == 0 } {
channel set $chan +joinpart
putserv "NOTICE $nick :joinpart: enabled on $chan"
} elseif { [channel get $chan joinpart] && [string compare $args "off"] == 0 } {
channel set $chan -joinpart
putserv "NOTICE $nick :joinpart: disabled on $chan"
}
}
setudef flag joinpart
bind part - * ban:jp
proc ban:jp {nick uhost hand chan text} {
if {[isbotnick $nick] || ![botisop $chan] || ![channel get $chan joinpart] || [matchattr $hand b] || [matchattr $hand fom|fom $chan]} return
global jp botnick jpchan
if {![info exists jpchan($chan)]}
set jpchan($chan) 0
if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$jp(part)}]} {
set banmask [jp:banmask $uhost $nick]
lock:jp $chan $jp(lock_modes)
putnow "MODE $chan +b $banmask"
putnow "KICK $chan $nick :$jp(reason)"
putlog "JoinPart: Flood Attempt on $chan ($banmask) banned on the channel"
utimer $jp(unlock) [list unlock:jp $chan $jp(lock_modes)]
}
}
proc lock:jp {chan lock} {
if {![botisop $chan]} return
set cm [lindex [split [getchanmode $chan] +] 1]
foreach m [split $lock ""] {
if {[lsearch -exact $cm $m] != -1} continue
pushmode $chan +$m
}
}
proc unlock:jp {chan lock} {
if {![botisop $chan]} return
set cm [lindex [split [getchanmode $chan] +] 1]
foreach m [split $lock ""] {
if {[lsearch -exact $cm $m] != -1} {
pushmode $chan -$m
}
}
}
proc jp:banmask {uhost nick} {
global jpban_type
switch -- $jpban_type {
1 { set banmask "*!*@*.[join [lrange [split $uhost .] end-1 end] .]" }
10 { set banmask "*!*@[lindex [split $uhost @] 1]" }
2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
3 { set banmask "*!*$uhost" }
4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
6 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
7 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
8 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
9 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
default { set banmask "*!*@[lindex [split $uhost @] 1]" }
return $banmask
}
}
#############################################################
putlog "LOADED: Part/Revolving Door Flood Protection by fyre"
############################################################# |
also it takes kind of long before channel is locked and unlocked it must be locked first than right start banning and kicking also it seems to lock channel multiple times while it was already locked
| Quote: | 21:09:41 Join : mackay ~Santo@117.223.26.125
21:09:45 Join : guillermo ~Echevarri@138.36.190.38
21:09:49 Join : hannah ~Lilli@131.100.219.10
21:09:52 Join : j4s024f ~Rocha@104-59-56-226.lightspeed.wchtks.sbcglobal.net
21:10:04 Parts : j4s024f ~Rocha@104-59-56-226.lightspeed.wchtks.sbcglobal.net
21:10:05 Parts : Guillermo ~Echevarri@138.36.190.38
21:10:05 Parts : Hannah ~Lilli@131.100.219.10
21:10:05 Parts : Mackay ~Santo@117.223.26.125
21:10:06 Join : j4s024f ~Rocha@104-59-56-226.lightspeed.wchtks.sbcglobal.net
21:10:06 Join : mackay ~Santo@117.223.26.125
21:10:07 Join : hannah ~Lilli@131.100.219.10
21:10:07 Parts : j4s024f ~Rocha@104-59-56-226.lightspeed.wchtks.sbcglobal.net
21:10:07 Parts : Hannah ~Lilli@131.100.219.10
21:10:07 Parts : Mackay ~Santo@117.223.26.125
21:10:07 Join : guillermo ~Echevarri@138.36.190.38
21:10:07 Parts : Guillermo ~Echevarri@138.36.190.38
21:10:07 @Eggy_ Sets Mode on #simo to: +b *!*@*.sbcglobal.net
21:10:08 @Eggy_ Sets Mode on #simo to: +b *!*@*.219.10
21:10:11 @Eggy_ Sets Mode on #simo to: +b *!*@*.26.125
21:10:18 @Eggy_ Sets Mode on #simo to: +b *!*@*.190.38
21:10:19 Join : dubose ~Terisa@cpe-172-74-241-154.sc.res.rr.com
21:10:19 Parts : Dubose ~Terisa@cpe-172-74-241-154.sc.res.rr.com
21:10:19 Join : bertram ~Cline@173-164-249-90-SFBA.hfc.comcastbusiness.net
21:10:19 Parts : Bertram ~Cline@173-164-249-90-SFBA.hfc.comcastbusiness.net
21:10:21 @Eggy_ Sets Mode on #simo to: +im
21:10:25 @Eggy_ Sets Mode on #simo to: +b *!*@*.rr.com
21:10:31 @Eggy_ Sets Mode on #simo to: +b *!*@*.comcastbusiness.net
21:10:36 @Eggy_ Sets Mode on #simo to: +im |
|
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu Mar 31, 2016 1:09 am Post subject: |
|
|
To be honest I haven't tested the entire script on a bot but on a tclsh environment and all seemed to be working fine.
The only explanation of the multiple mode changes could be the fact that the pushmode uses a slow query and tries to fit multiple modes in the same line.
We can try two things to sort this out:
1. replace pushmode with a faster method like putquick or putnow.
OR
2. add a flushmode $chan after the pushmode $chan +$m line.
As for the error you get, replace:
| Code: |
if {![info exists jpchan($chan)]}
set jpchan($chan) 0
|
with:
| Code: |
if {![info exists jpchan($chan)]} {
set jpchan($chan) 0
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|
|
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
|
|