This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Join Part Flood Protection

Help for those learning Tcl or writing their own scripts.
Post Reply
G
Goga
Halfop
Posts: 84
Joined: Sat Sep 19, 2020 2:12 am

Join Part Flood Protection

Post by Goga »

Hello.
Can anyone please suggest me an affective Join/Part, Revolving Door Flood Protection TCL ? Who sets Like +bbbbb and sets Mode +R too.
This TCL is for DALNET.
Thanking already.
User avatar
CrazyCat
Revered One
Posts: 1301
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

G
Goga
Halfop
Posts: 84
Joined: Sat Sep 19, 2020 2:12 am

Post by Goga »

Dear CrazyCat,
I only require Join Part Flood Protecting, This TCL contains everything.
User avatar
CrazyCat
Revered One
Posts: 1301
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

So disable other parts.
Or search by yourself on tclarchive.org
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Goga:
Try this forum thread...
http://forum.egghelp.org/viewtopic.php?t=21181
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
G
Goga
Halfop
Posts: 84
Joined: Sat Sep 19, 2020 2:12 am

Post by Goga »

Sir Spike,
I already tried this one in my EGGDROP on DALNET.
But I don't know why its not working on my side.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Plz explain "its not working on my side"

The code posted by simo seems fine to me:)
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Thats because the original thread poster didn't include the entire code of the original author like the settings configuration and such

Original author : https://tclarchive.org/download.php?id=1141
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Code: Select all

# ####
# INFO 
# ####
#
# joinpart.tcl v1.3 (Sep 10, 2005)
# edited by simo 3 sept 2022
#
# ###########
# 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-Flood.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 #mychan1 +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) 2

###############
#- 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) "R"

##############
#- 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 2

###############
#- Lock Time -#
###############

# Set time period (in seconds) that how much time it takes to do unlock after join/part flood.
set jp(unlock) 300

#####################
#- 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) "10"


########################################################
#- Don't edit below unless you know what you're doing -#
########################################################



######## i added Public Command to enable/disable ###########
# Syntax : !jp on/off

bind PUB n !jp JoinPart:Flood


 

setudef flag joinpart

proc JoinPart:Flood {nick uhost hand chan arg} {

  switch -nocase -- [lindex [split $arg] 0] {
    on {
      if {[channel get $chan joinpart]} {
        putserv "NOTICE $nick :anti-joinpart is already enabled on $chan."
      } else { 
        channel set $chan +joinpart
        putserv "NOTICE $nick :anti-joinpart is now enabled."
}
    }
    off {
      if {![channel get $chan joinpart]} {
        putserv "NOTICE $nick :anti-joinpart is already disabled on $chan."
      } else {
        channel set $chan -joinpart
        putserv "NOTICE $nick :anti-joinpart is now disabled."
     }
    }    
  }
}




 
bind part - * ban:jp

proc ban:jp {nick uhost hand chan arg} {
  global jp botnick jpchan kickcount logo
 
   if {[string match -nocase "*@*irccloud*" $uhost]} { return 0 }


  if {[isbotnick $nick] || ![botisop $chan] || ![channel get $chan joinpartflood]} {
    return
  }
  if {![info exists jpchan($chan)]} {
    set jpchan($chan) 0
  }
  if {[matchattr $hand b] || [matchattr $hand fom|fom $chan]} {
    return
  }
  if {[getchanjoin $nick $chan] >= [expr {[clock seconds]-$jp(part)}]} {

 
         set Lockreason "Join/Part-detected"
         jp:lockchan $chan "Join/Part-Flood"
		 
    if {$jp(style) == "1"} {
   set banmask [jp:banmask $uhost $nick]
       pushmode $chan +b $banmask
      putserv "KICK $chan $nick :$jp(reason) $kickcount $logo"
      putlog "JoinPart: Flood Attempt on $chan ($banmask) banned on the channel"
    }
    if {$jp(style) == "2"} {
   set banmask [jp:banmask $uhost $nick]
      pushmode $chan +b $banmask    
      putserv "KICK $chan $nick :$jp(reason) $kickcount $logo"
      putlog "JoinPart: Flood Attempt on $chan ($banmask) added in the channel banlist"
      newchanban "$chan" "$banmask" "JoinPart" "$jp(reason)" "$jp(btime)"
    }
    if {$jp(style) == "3"} {
    set banmask [jp:banmask $uhost $nick]
      pushmode $chan +b $banmask
      putserv "KICK $chan $nick :$jp(reason) $kickcount $logo"
      putlog "JoinPart: Flood Attempt on $chan ($banmask) added in the global banlist"
      newban "$banmask" "JoinPart" "$jp(reason)" "$jp(btime)"
    }
    flushmode $chan
  }
}


proc jp:banmask {uhost nick} {
 global jpban_type
  switch -- $jpban_type {
   1 { 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
  }
}

proc jp:lockchan {chan LockReason} {
global joinpart_flooded lock_channel jp
    if {![info exists joinpart_flooded($chan)]} {
    set joinpart_flooded($chan) 1
    putnow "MODE $chan +R-k ${LockReason}"
	utimer $jp(unlock) [list putquick "MODE $chan -$jp(lock_modes)k ${LockReason}-Unlocked"]
    utimer 10 [list unset -nocomplain ::joinpart_flooded($chan)]
  }
}


 
 
#############################################################
putlog "LOADED: Part/Revolving Door Flood Protection by fyre"
#############################################################

Post Reply