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.

Need Help To Change Ban Mask Option..

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
F
F|irT
Voice
Posts: 30
Joined: Thu Apr 30, 2015 11:23 pm
Location: Pakistan

Need Help To Change Ban Mask Option..

Post by F|irT »

Hello,

Administrator & All HeLpers.

This Is The tcl wich was original written by SpiKe^^ i need some changing in it nothing much just need to be change ban mask option . in this tcl bot ban ip with full host *!*@182.178.23.63 like this i like to change it into just ban host. like this is ip @pool-108-52-22-104.phlapa.fios.verizon.net ban should be *!*@*.verizon.net --- just ban the last host .

Code: Select all

## remove-damn-spam-bots.tcl v1.4 (13May2015) by SpiKe^^ ## 


# Spam bots joins, kick-ban on joins:seconds # 
set rdsb(flood) 3:10 

# Spam bots joins kick-ban reason # 
set rdsb(reasn) "10Possibel/Spammer/Flooder! If Not join1 #gEtHeLp" 

# Max number of bans to stack in one mode command # 
set rdsb(maxb) 6 

# Length of time in minutes to ban damn spam bots # 
# - set 0 to disable this script removing bans (ex. set rdsb(btime) 0) # 
set rdsb(btime) 120 

# After a valid damn spam bot join flood, script will continue # 
# to kick-ban offenders for an additional 'x' seconds # 
set rdsb(xpire) 15 

# Set channel mode(s) on flood detected. # 
# - set empty to disable setting channel modes (ex. set rdsb(mode) "") # 
set rdsb(mode) "M-k Possible.Flooder" 

# Remove these channel modes after how many seconds? # 
set rdsb(mrem) 20 

# END OF SETTINGS # Don't edit below unless you know what you're doing # 

bind join - * rdsb_bindjoin 

proc rdsb_bindjoin {nick uhost hand chan} { 
  global rdsb rdsc rdsq 

  if {[isbotnick $nick]} { return 0 } 
  if {[matchattr $hand f|f $chan]} { return 0 } 
  if {![string match "~*" $uhost]} { return 0 } 

  set user [string range [lindex [split $uhost @] 0] 1 9] 
  if {$user ne [string range $nick 0 8]} { return 0 } 

  set uhost [string tolower $nick!$uhost] 
  set chan [string tolower $chan] 
  set utnow [unixtime] 
  set target [lindex $rdsb(flood) 0] 

  if {[info exists rdsc($chan)]} { 
    set uhlist [lassign $rdsc($chan) cnt ut] 
    set utend [expr {$ut + [lindex $rdsb(flood) 1]}] 
    set expire [expr {$utend + $rdsb(xpire)}] 
    if {$cnt < $target} { 
      if {$utnow > $utend} { unset rdsc($chan) } 
    } elseif {$utnow > $expire} { unset rdsc($chan) } 
  } 
  if {![info exists rdsc($chan)]} { 
    set rdsc($chan) [list 1 $utnow $uhost] 
    return 0 
  } 

  incr cnt 
  if {$cnt <= $target} { 
    if {[lsearch $uhlist $uhost] == -1} { lappend uhlist $uhost } 
    if {$cnt < $target} { 
      set rdsc($chan) [linsert $uhlist 0 $cnt $ut] 
    } else { 
      set rdsc($chan) [list $cnt $ut] 
      if {$rdsb(mode) ne "" && [string is digit -strict $rdsb(mrem)]} { 
        putquick "MODE $chan +$rdsb(mode)" 
        utimer $rdsb(mrem) [list putquick "MODE $chan -$rdsb(mode)"] 
      } 
      rdsb_dobans $chan $uhlist 
    } 
    return 0 
  } 

  if {![info exists rdsq($chan)]} { 
    utimer 2 [list rdsb_bque $chan] 
    set rdsq($chan) [list $uhost] 
  } elseif {[lsearch $rdsq($chan) $uhost] == -1} { 
    lappend rdsq($chan) $uhost 
  } 

  if {[llength $rdsq($chan)] >= $rdsb(maxb)} { 
    rdsb_dobans $chan $rdsq($chan) 
    set rdsq($chan) "" 
  } elseif {[botisop $chan]} { putquick "KICK $chan $nick :$rdsb(reasn)" } 
  return 0 
} 

proc rdsb_dobans {chan uhlist} { 
  global rdsb 
  if {![botisop $chan]} return 
  set banList "" 
  set nickList "" 
  foreach ele $uhlist { 
    scan $ele {%[^!]!%[^@]@%s} nick user host 
    set bmask "*!*@$host" 
    if {[lsearch $banList $bmask] == -1} { lappend banList $bmask } 
    if {[lsearch $nickList $nick] == -1} { lappend nickList $nick } 
  } 
  stack_bans $chan $rdsb(maxb) $banList 
  foreach nk $nickList { 
    if {[onchan $nk $chan]} { putquick "KICK $chan $nk :$rdsb(reasn)" } 
  } 


  if {$rdsb(btime) > 0} { 
    set expire [expr {[unixtime] + $rdsb(btime)}] 
    lappend rdsb(rmls) [list $expire $chan $banList] 
  } 

} 

proc stack_bans {chan max banlist {opt +} } { 
  set len [llength $banlist] 
  while {$len > 0} { 
    if {$len > $max} { 
      set mode [string repeat "b" $max] 
      set masks [join [lrange $banlist 0 [expr {$max - 1}]]] 
      set banlist [lrange $banlist $max end] 
      incr len -$max 
    } else { 
      set mode [string repeat "b" $len] 
      set masks [join $banlist] 
      set len 0 
    } 
    putquick "MODE $chan ${opt}$mode $masks" 
  } 
} 

proc rdsb_bque {chan} { 
  global rdsq 
  if {![info exists rdsq($chan)]} { return } 
  if {$rdsq($chan) eq ""} { unset rdsq($chan) ; return } 
  rdsb_dobans $chan $rdsq($chan) 
  unset rdsq($chan) 
} 

proc rdsb_breset {} { 
  global rdsc rdsb 
  set utnow [unixtime] 
  set target [lindex $rdsb(flood) 0] 
  foreach {key val} [array get rdsc] { 
    lassign $val cnt ut 
    set utend [expr {$ut + [lindex $rdsb(flood) 1]}] 
    set expire [expr {$utend + $rdsb(xpire)}] 
    if {$cnt < $target} { 
      if {$utnow > $utend} { unset rdsc($key) } 
    } elseif {$utnow > $expire} { unset rdsc($key) } 
  } 


  if {[info exists rdsb(rmls)]} { 
    while {[llength $rdsb(rmls)]} { 
      set next [lindex $rdsb(rmls) 0] 
      lassign $next expire chan banList 
      if {$expire > $utnow} {  break  } 
      set rdsb(rmls) [lreplace $rdsb(rmls) 0 0] 
      if {![info exists rmAra($chan)]} {  set rmAra($chan) $banList 
      } else {  set rmAra($chan) [concat $rmAra($chan) $banList]  } 
    } 
    foreach {key val} [array get rmAra] { 
      set banList "" 
      foreach mask $val { 
        if {![ischanban $mask $key]} {  continue  } 
        lappend banList $mask 
      } 
      if {$banList eq ""} {  continue  } 
      if {![botisop $key]} { 
        set rdsb(rmls) [linsert $rdsb(rmls) 0 [list $utnow $key $banList]] 
      } else {  stack_bans $key $rdsb(maxb) $banList -  } 
    } 
    if {![llength $rdsb(rmls)]} {  unset rdsb(rmls)  } 
  } 


  utimer 30 [list rdsb_breset] 
} 

if {![info exists rdsb_running]} { 
  utimer 20 [list rdsb_breset] 
  set rdsb_running 1 
} 

set rdsb(flood) [split $rdsb(flood) :] 
set rdsb(btime) [expr {$rdsb(btime) * 60}] 
if {$rdsb(btime)==0 && [info exists rdsb(rmls)]} {  unset rdsb(rmls)  } 

putlog "Loaded remove-damn-spam-bots.tcl v1.4 by SpiKe^^"
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

remove-damn-spam-bots.tcl v1.5 by SpiKe^^

Post by SpiKe^^ »

For complete details on what this script does go here.

F|irT: This might be close to what you're looking for, try it out and let me know.
Be sure to check out the 2 new settings.

Code: Select all

## remove-damn-spam-bots.tcl v1.5 (31Jan2016) by SpiKe^^ ## 


# Spam bots joins, kick-ban on joins:seconds #
set rdsb(flood) 3:10

# Spam bots joins kick-ban reason #
set rdsb(reasn) "Damn Spam Bot!"

# Max number of bans to stack in one mode command #
set rdsb(maxb) 6

# Length of time in minutes to ban damn spam bots #
# - set 0 to disable this script removing bans (ex. set rdsb(btime) 0) #
set rdsb(btime) 5

# After a valid damn spam bot join flood, script will continue #
# to kick-ban offenders for an additional 'x' seconds #
set rdsb(xpire) 10

# Set the type of ban masks to use #                     <- NEW SETTING <-
#  1 = use host/ip specific bans (ex. *!*@some.host.com) #
#  2 = use wide masked host/ip bans (ex. *!*@*.host.com) #
#      note: setting 2 requires eggdrop 1.6.20 or newer. #
set rdsb(btype) 2

# Set protected host(s) that should not be wide masked # <- NEW SETTING <-
# - Example:  set rdsb(phost) "*.undernet.org"
#  Note: this setting only applies to ban type 2 above! #
#  Note: set empty to not protect any hosts (ex. set rdsb(phost) "") #
#  Note: space separated if listing more than one protected host #
set rdsb(phost) ""

# Set channel mode(s) on flood detected. #
# - set empty to disable setting channel modes (ex. set rdsb(mode) "") #
set rdsb(mode) "im"

# Remove these channel modes after how many seconds? #
set rdsb(mrem) 20

# END OF SETTINGS # Don't edit below unless you know what you're doing # 

bind join - * rdsb_bindjoin 

proc rdsb_bindjoin {nick uhost hand chan} { 
  global rdsb rdsc rdsq 

  if {[isbotnick $nick]} { return 0 } 
  if {[matchattr $hand f|f $chan]} { return 0 } 
  if {![string match "~*" $uhost]} { return 0 } 

  set user [string range [lindex [split $uhost @] 0] 1 9] 
  if {$user ne [string range $nick 0 8]} { return 0 } 

  set uhost [string tolower $nick!$uhost] 
  set chan [string tolower $chan] 
  set utnow [unixtime] 
  set target [lindex $rdsb(flood) 0] 

  if {[info exists rdsc($chan)]} { 
    set uhlist [lassign $rdsc($chan) cnt ut] 
    set utend [expr {$ut + [lindex $rdsb(flood) 1]}] 
    set expire [expr {$utend + $rdsb(xpire)}] 
    if {$cnt < $target} { 
      if {$utnow > $utend} { unset rdsc($chan) } 
    } elseif {$utnow > $expire} { unset rdsc($chan) } 
  } 
  if {![info exists rdsc($chan)]} { 
    set rdsc($chan) [list 1 $utnow $uhost] 
    return 0 
  } 

  incr cnt 
  if {$cnt <= $target} { 
    if {[lsearch $uhlist $uhost] == -1} { lappend uhlist $uhost } 
    if {$cnt < $target} { 
      set rdsc($chan) [linsert $uhlist 0 $cnt $ut] 
    } else { 
      set rdsc($chan) [list $cnt $ut] 
      if {$rdsb(mode) ne "" && [string is digit -strict $rdsb(mrem)]} { 
        putquick "MODE $chan +$rdsb(mode)" 
        utimer $rdsb(mrem) [list putquick "MODE $chan -$rdsb(mode)"] 
      } 
      rdsb_dobans $chan $uhlist 
    } 
    return 0 
  } 

  if {![info exists rdsq($chan)]} { 
    utimer 2 [list rdsb_bque $chan] 
    set rdsq($chan) [list $uhost] 
  } elseif {[lsearch $rdsq($chan) $uhost] == -1} { 
    lappend rdsq($chan) $uhost 
  } 

  if {[llength $rdsq($chan)] >= $rdsb(maxb)} { 
    rdsb_dobans $chan $rdsq($chan) 
    set rdsq($chan) "" 
  } elseif {[botisop $chan]} { putquick "KICK $chan $nick :$rdsb(reasn)" } 
  return 0 
} 

proc rdsb_dobans {chan uhlist} { 
  global rdsb 
  if {![botisop $chan]} return 
  set banList "" 
  set nickList "" 
  foreach ele $uhlist { 
    scan $ele {%[^!]!%[^@]@%s} nick user host 


    if {$rdsb(btype) == 2} {
      set type 4

      foreach ph $rdsb(phost) {
        if {[string match -nocase $ph $host]} {
          set type 2  ;  break
        }
      }

      set bmask [maskhost $ele $type]

    } else {  set bmask "*!*@$host"  }


    if {[lsearch $banList $bmask] == -1} { lappend banList $bmask } 
    if {[lsearch $nickList $nick] == -1} { lappend nickList $nick } 
  } 
  stack_bans $chan $rdsb(maxb) $banList 
  foreach nk $nickList { 
    if {[onchan $nk $chan]} { putquick "KICK $chan $nk :$rdsb(reasn)" } 
  } 

  if {$rdsb(btime) > 0} { 
    set expire [expr {[unixtime] + $rdsb(btime)}] 
    lappend rdsb(rmls) [list $expire $chan $banList] 
  } 
} 

proc stack_bans {chan max banlist {opt +} } { 
  set len [llength $banlist] 
  while {$len > 0} { 
    if {$len > $max} { 
      set mode [string repeat "b" $max] 
      set masks [join [lrange $banlist 0 [expr {$max - 1}]]] 
      set banlist [lrange $banlist $max end] 
      incr len -$max 
    } else { 
      set mode [string repeat "b" $len] 
      set masks [join $banlist] 
      set len 0 
    } 
    putquick "MODE $chan ${opt}$mode $masks" 
  } 
} 

proc rdsb_bque {chan} { 
  global rdsq 
  if {![info exists rdsq($chan)]} { return } 
  if {$rdsq($chan) eq ""} { unset rdsq($chan) ; return } 
  rdsb_dobans $chan $rdsq($chan) 
  unset rdsq($chan) 
} 

proc rdsb_breset {} { 
  global rdsc rdsb 
  set utnow [unixtime] 
  set target [lindex $rdsb(flood) 0] 
  foreach {key val} [array get rdsc] { 
    lassign $val cnt ut 
    set utend [expr {$ut + [lindex $rdsb(flood) 1]}] 
    set expire [expr {$utend + $rdsb(xpire)}] 
    if {$cnt < $target} { 
      if {$utnow > $utend} { unset rdsc($key) } 
    } elseif {$utnow > $expire} { unset rdsc($key) } 
  } 

  if {[info exists rdsb(rmls)]} { 
    while {[llength $rdsb(rmls)]} { 
      set next [lindex $rdsb(rmls) 0] 
      lassign $next expire chan banList 
      if {$expire > $utnow} {  break  } 
      set rdsb(rmls) [lreplace $rdsb(rmls) 0 0] 
      if {![info exists rmAra($chan)]} {  set rmAra($chan) $banList 
      } else {  set rmAra($chan) [concat $rmAra($chan) $banList]  } 
    } 
    foreach {key val} [array get rmAra] { 
      set banList "" 
      foreach mask $val { 
        if {![ischanban $mask $key]} {  continue  } 
        lappend banList $mask 
      } 
      if {$banList eq ""} {  continue  } 
      if {![botisop $key]} { 
        set rdsb(rmls) [linsert $rdsb(rmls) 0 [list $utnow $key $banList]] 
      } else {  stack_bans $key $rdsb(maxb) $banList -  } 
    } 
    if {![llength $rdsb(rmls)]} {  unset rdsb(rmls)  } 
  } 

  utimer 30 [list rdsb_breset] 
} 

if {![info exists rdsb_running]} { 
  utimer 20 [list rdsb_breset] 
  set rdsb_running 1 
} 

set rdsb(flood) [split $rdsb(flood) :] 
set rdsb(btime) [expr {$rdsb(btime) * 60}] 
set rdsb(phost) [split [string trim $rdsb(phost)]]
if {$rdsb(btime)==0 && [info exists rdsb(rmls)]} {  unset rdsb(rmls)  } 

putlog "Loaded remove-damn-spam-bots.tcl v1.5 by SpiKe^^"

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
F
F|irT
Voice
Posts: 30
Joined: Thu Apr 30, 2015 11:23 pm
Location: Pakistan

This Is Perfect .. excellent too good..

Post by F|irT »

This Is very good Yeh i wanted this changing ban mask option this is really very good for those who are flooding on my channel.. i save some logs to show ... here u go....

Code: Select all

* Joins: dr-haroon8152 (~dr-haroon@ec2-52-192-145-9.ap-northeast-1.compute.amazonaws.com)
* Joins: Silent_Death6175 (~Silent_De@v133-130-103-8.a02c.g.tyo1.static.cnode.io)
* Joins: kew|-_-ga|8016 (~kew|-_-ga@23.254.164.88)
* Joins: MySecretGarden8003 (~MySecretG@106.75.196.3)
* KriminaL sets mode: +M-k Possible.Flooder
* KriminaL sets mode: +bbb *!*@*.compute.amazonaws.com *!*@*.g.tyo1.static.cnode.io *!*@23.254.164.*
* dr-haroon8152 was kicked by KriminaL (10Possibel/Spammer/Flooder! If Not join #gEtHeLp)
* Silent_Death6175 was kicked by KriminaL (10Possibel/Spammer/Flooder! If Not join #gEtHeLp)
* kew|-_-ga|8016 was kicked by KriminaL (10Possibel/Spammer/Flooder! If Not join #gEtHeLp)
* NoNSt0p sets mode: +M-k Possible.Flooder
* Parts: MySecretGarden8003 (~MySecretG@106.75.196.3)
* Joins: UltimatuM_L0RD (~UltimatuM@li412-207.members.linode.com)
* gEtLoSt sets mode: +b *!*@106.75.196.*
* UltimatuM_L0RD was kicked by NoNSt0p (Possibel/Spammer/Flooder! If Not join #gEtHeLp)
* NoNSt0p sets mode: +b *!*@li412-207.members.linode.com
* KriminaL sets mode: +b *!*@*.linode.com
<^WhyMyWife> Hi all, 38m looking for an open chat about wife. Thanks,
* Parts: AnDhAIrA-UjAaLaA (~GolDeN-HE@119.154.220.114)
<+Truck-driver> aaw
* KriminaL sets mode: -Mk Possible.Flooder
Your tcl is on KriminaL bot . this is much helping to control the flooders. but there is more to warry about it . when they use same nick bot does not protect the channel . here are some other logs

Code: Select all

* Joins: khusra_punjabi-cD (~khusra_pu@83.220.172.53)
* Joins: khusra_punjabi-bM (~khusra_pu@83.220.172.53)
* Joins: khusra_punjabi-Aa (~khusra_pu@83.220.172.53)
* NoNSt0p sets mode: +M-k Possible.Flooder
* NoNSt0p sets mode: +b *!*@83.220.172.53
* khusra_punjabi-cD was kicked by NoNSt0p (Possibel/Spammer/Flooder! If Not join #gEtHeLp)
* khusra_punjabi-bM was kicked by NoNSt0p (Possibel/Spammer/Flooder! If Not join #gEtHeLp)
* KriminaL sets mode: +M-k Possible.Flooder
* KriminaL sets mode: +b *!*@83.220.172.*
* khusra_punjabi-Aa was kicked by gEtLoSt (Excess clones detected. Banned 15 minutes (KiCk No:92545) © X©x©X © For Help Join #gEtHeLp)
* gEtLoSt sets mode: +M-k clone.join.flood
* Joins: khusra_punjabi-NN (~khusra_pu@kz-main.amegaserver.com)
* Joins: khusra_punjabi-CV (~khusra_pu@187.242.163.214)
* Joins: khusra_punjabi-dk (~khusra_pu@192.162.101.84)
* Joins: khusra_punjabi-VZ (~khusra_pu@200.225.1.214)
* Joins: khusra_punjabi-ao (~khusra_pu@200.225.12.133)
* Parts: khusra_punjabi-CV (~khusra_pu@187.242.163.214)
* Parts: khusra_punjabi-dk (~khusra_pu@192.162.101.84)
* Parts: khusra_punjabi-VZ (~khusra_pu@200.225.1.214)
* Parts: khusra_punjabi-ao (~khusra_pu@200.225.12.133)
* Joins: khusra_punjabi-fR (~khusra_pu@84.124.11.114)
* Parts: khusra_punjabi-NN (~khusra_pu@kz-main.amegaserver.com)
* Joins: khusra_punjabi-Ac (~khusra_pu@200.92.100.111)
* Parts: khusra_punjabi-Ac (~khusra_pu@200.92.100.111)
* Joins: khusra_punjabi-Ba (~khusra_pu@197.253.6.200)
* Joins: khusra_punjabi-Hs (~khusra_pu@200.92.13.239)
* Joins: khusra_punjabi-KB (~khusra_pu@200.92.26.65)
* Joins: khusra_punjabi-Dz (~khusra_pu@201.172.105.26)
* Joins: khusra_punjabi-vw (~khusra_pu@201.172.121.111)
* Joins: khusra_punjabi-Kh (~khusra_pu@201.172.123.42)
* Joins: khusra_punjabi-sY (~khusra_pu@190.213.123.252)
* Joins: khusra_punjabi-Ak (~khusra_pu@201.172.137.231)
* Joins: khusra_punjabi-Lo (~khusra_pu@190.213.183.155)
* Joins: khusra_punjabi-yd (~khusra_pu@201.172.138.176)
* Joins: khusra_punjabi-rP (~khusra_pu@201.172.146.36)
* Joins: khusra_punjabi-UH (~khusra_pu@190.213.41.48)
* Joins: khusra_punjabi-db (~khusra_pu@190.213.140.53)
* Joins: khusra_punjabi-Xd (~khusra_pu@190.83.186.106)
* Joins: khusra_punjabi-DS (~khusra_pu@201.172.166.112)
* Joins: khusra_punjabi-Ow (~khusra_pu@190.213.108.241)
* Joins: khusra_punjabi-EO (~khusra_pu@201.172.17.27)
* Joins: khusra_punjabi-Gk (~khusra_pu@201.172.179.215)
* Joins: khusra_punjabi-Tj (~khusra_pu@201.160.151.184)
* Joins: khusra_punjabi-Va (~khusra_pu@201.172.186.20)
* Joins: khusra_punjabi-pi (~khusra_pu@201.172.189.86)
* Joins: khusra_punjabi-pi (~khusra_pu@201.172.189.86)
* Joins: khusra_punjabi-vv (~khusra_pu@201.172.22.148)
* gEtLoSt sets mode: +bb *!*@*.amegaserver.com *!*@187.242.163.*
* Parts: ffg (~77a077dc@host-220-net-119-160-119.mobilinkinfinity.net.pk)
* Parts: khusra_punjabi-KB (~khusra_pu@200.92.26.65)
* Parts: khusra_punjabi-Ba (~khusra_pu@197.253.6.200)
* Parts: khusra_punjabi-sY (~khusra_pu@190.213.123.252)
* Parts: khusra_punjabi-DS (~khusra_pu@201.172.166.112)
* Parts: khusra_punjabi-EO (~khusra_pu@201.172.17.27)
* Parts: khusra_punjabi-vv (~khusra_pu@201.172.22.148)
* Parts: khusra_punjabi-Hs (~khusra_pu@200.92.13.239)
* Parts: khusra_punjabi-Dz (~khusra_pu@201.172.105.26)
* Parts: khusra_punjabi-vw (~khusra_pu@201.172.121.111)
* Parts: khusra_punjabi-fR (~khusra_pu@84.124.11.114)
* Parts: khusra_punjabi-Kh (~khusra_pu@201.172.123.42)
* Parts: khusra_punjabi-Ak (~khusra_pu@201.172.137.231)
* Joins: khusra_punjabi-YJ (~khusra_pu@201.172.233.115)
* Joins: khusra_punjabi-uZ (~khusra_pu@201.172.22.194)
* Joins: khusra_punjabi-vD (~khusra_pu@201.172.233.121)
* Joins: khusra_punjabi-fB (~khusra_pu@201.172.232.79)
* Joins: khusra_punjabi-le (~khusra_pu@201.172.26.225)
* Joins: khusra_punjabi-vk (~khusra_pu@201.164.229.116)
* Joins: khusra_punjabi-aX (~khusra_pu@201.172.53.144)
* Joins: khusra_punjabi-bS (~khusra_pu@201.172.50.73)
* Joins: khusra_punjabi-Or (~khusra_pu@201.172.57.27)
* Joins: khusra_punjabi-uP (~khusra_pu@201.172.54.162)
* Joins: khusra_punjabi-WZ (~khusra_pu@201.172.58.128)
* Joins: khusra_punjabi-eW (~khusra_pu@201.172.60.185)
* Joins: khusra_punjabi-DG (~khusra_pu@201.172.61.193)
* Joins: khusra_punjabi-fQ (~khusra_pu@201.172.71.196)
* Joins: khusra_punjabi-tt (~khusra_pu@201.172.73.224)
* Joins: khusra_punjabi-xY (~khusra_pu@201.172.78.138)
* Joins: khusra_punjabi-qT (~khusra_pu@201.172.71.231)
* Joins: khusra_punjabi-wJ (~khusra_pu@201.172.80.153)
* Joins: khusra_punjabi-rg (~khusra_pu@201.173.120.4)
* Joins: khusra_punjabi-bH (~khusra_pu@201.173.136.247)
* Joins: khusra_punjabi-Th (~khusra_pu@201.173.136.99)
* Parts: khusra_punjabi-Lo (~khusra_pu@190.213.183.155)
* Parts: khusra_punjabi-YJ (~khusra_pu@201.172.233.115)
* Parts: khusra_punjabi-fB (~khusra_pu@201.172.232.79)
* Parts: khusra_punjabi-vk (~khusra_pu@201.164.229.116)
* Parts: khusra_punjabi-yd (~khusra_pu@201.172.138.176)
* Parts: khusra_punjabi-rP (~khusra_pu@201.172.146.36)
* Parts: khusra_punjabi-UH (~khusra_pu@190.213.41.48)
* Parts: khusra_punjabi-db (~khusra_pu@190.213.140.53)
* Parts: khusra_punjabi-Xd (~khusra_pu@190.83.186.106)
* Parts: khusra_punjabi-Ow (~khusra_pu@190.213.108.241)
* Parts: khusra_punjabi-Va (~khusra_pu@201.172.186.20)
* Parts: khusra_punjabi-Gk (~khusra_pu@201.172.179.215)
* Joins: khusra_punjabi-eu (~khusra_pu@201.173.158.221)
* Joins: khusra_punjabi-ad (~khusra_pu@201.173.162.103)
* Joins: khusra_punjabi-Db (~khusra_pu@201.173.159.239)
* Joins: khusra_punjabi-Ls (~khusra_pu@201.173.160.157)
* Joins: khusra_punjabi-oc (~khusra_pu@201.173.162.130)
* Joins: khusra_punjabi-nV (~khusra_pu@201.173.158.78)
* Joins: khusra_punjabi-Zv (~khusra_pu@201.172.189.78)
* Joins: khusra_punjabi-cz (~khusra_pu@201.173.172.78)
* Joins: khusra_punjabi-mh (~khusra_pu@201.173.180.215)
* Joins: khusra_punjabi-zM (~khusra_pu@201.173.186.194)
* Joins: khusra_punjabi-nS (~khusra_pu@201.173.178.120)
* Joins: khusra_punjabi-Rj (~khusra_pu@201.172.80.70)
* Joins: khusra_punjabi-EN (~khusra_pu@201.173.178.48)
* Joins: khusra_punjabi-Mx (~khusra_pu@201.173.207.94)
* Joins: khusra_punjabi-UQ (~khusra_pu@201.173.232.109)
* Joins: khusra_punjabi-wy (~khusra_pu@201.173.235.183)
* Joins: khusra_punjabi-RL (~khusra_pu@201.173.235.210)
* Joins: khusra_punjabi-iP (~khusra_pu@201.173.244.139)
* Joins: khusra_punjabi-qd (~khusra_pu@201.173.24.88)
* Joins: khusra_punjabi-Dr (~khusra_pu@201.173.233.92)
* gEtLoSt sets mode: +bbb *!*@201.172.189.* *!*@201.172.22.* *!*@84.124.11.*
* Parts: khusra_punjabi-Th (~khusra_pu@201.173.136.99)
* Parts: khusra_punjabi-bH (~khusra_pu@201.173.136.247)
* Parts: khusra_punjabi-rg (~khusra_pu@201.173.120.4)
* Parts: khusra_punjabi-wJ (~khusra_pu@201.172.80.153)
* Parts: khusra_punjabi-qT (~khusra_pu@201.172.71.231)
* Parts: khusra_punjabi-xY (~khusra_pu@201.172.78.138)
* Parts: khusra_punjabi-tt (~khusra_pu@201.172.73.224)
* Parts: khusra_punjabi-fQ (~khusra_pu@201.172.71.196)
* Parts: khusra_punjabi-DG (~khusra_pu@201.172.61.193)
* Parts: khusra_punjabi-eW (~khusra_pu@201.172.60.185)
* Parts: khusra_punjabi-WZ (~khusra_pu@201.172.58.128)
* Parts: khusra_punjabi-uP (~khusra_pu@201.172.54.162)
* Parts: khusra_punjabi-Or (~khusra_pu@201.172.57.27)
* Parts: khusra_punjabi-bS (~khusra_pu@201.172.50.73)
* Parts: khusra_punjabi-aX (~khusra_pu@201.172.53.144)
* Parts: khusra_punjabi-le (~khusra_pu@201.172.26.225)
* Parts: khusra_punjabi-vD (~khusra_pu@201.172.233.121)
* Parts: khusra_punjabi-uZ (~khusra_pu@201.172.22.194)
* Joins: khusra_punjabi-Dx (~khusra_pu@201.172.191.102)
* Joins: khusra_punjabi-pP (~khusra_pu@201.173.61.93)
* Joins: khusra_punjabi-aS (~khusra_pu@201.173.76.36)
* Joins: khusra_punjabi-bE (~khusra_pu@201.173.80.131)
* Joins: khusra_punjabi-jz (~khusra_pu@201.173.80.48)
* Joins: khusra_punjabi-pd (~khusra_pu@201.173.205.42)
* Joins: khusra_punjabi-Cv (~khusra_pu@201.173.81.250)
* Joins: khusra_punjabi-VU (~khusra_pu@201.172.139.233)
* Joins: khusra_punjabi-iE (~khusra_pu@201.172.60.227)
* Joins: khusra_punjabi-nA (~khusra_pu@187.246.230.180)
* Joins: khusra_punjabi-Qe (~khusra_pu@201.173.191.245)
* khusra_punjabi-Cv was kicked by NoNSt0p (Possibel/Spammer/Flooder! If Not join #gEtHeLp)
* Parts: khusra_punjabi-Qe (~khusra_pu@201.173.191.245)
* Parts: khusra_punjabi-Dr (~khusra_pu@201.173.233.92)
* Parts: khusra_punjabi-qd (~khusra_pu@201.173.24.88)
* Parts: khusra_punjabi-iP (~khusra_pu@201.173.244.139)
* Parts: khusra_punjabi-RL (~khusra_pu@201.173.235.210)
* Parts: khusra_punjabi-wy (~khusra_pu@201.173.235.183)
* Parts: khusra_punjabi-UQ (~khusra_pu@201.173.232.109)
* Parts: khusra_punjabi-Mx (~khusra_pu@201.173.207.94)
* Parts: khusra_punjabi-EN (~khusra_pu@201.173.178.48)
* Parts: khusra_punjabi-Rj (~khusra_pu@201.172.80.70)
* Parts: khusra_punjabi-nS (~khusra_pu@201.173.178.120)
* Parts: khusra_punjabi-zM (~khusra_pu@201.173.186.194)
* Parts: khusra_punjabi-mh (~khusra_pu@201.173.180.215)
* Parts: khusra_punjabi-cz (~khusra_pu@201.173.172.78)
* Parts: khusra_punjabi-Zv (~khusra_pu@201.172.189.78)
* Parts: khusra_punjabi-nV (~khusra_pu@201.173.158.78)
* Parts: khusra_punjabi-oc (~khusra_pu@201.173.162.130)
* Parts: khusra_punjabi-Ls (~khusra_pu@201.173.160.157)
* Parts: khusra_punjabi-Db (~khusra_pu@201.173.159.239)
* Parts: khusra_punjabi-ad (~khusra_pu@201.173.162.103)
* Parts: khusra_punjabi-eu (~khusra_pu@201.173.158.221)
* Joins: khusra_punjabi-RF (~khusra_pu@201.173.24.236)
* Joins: khusra_punjabi-Rn (~khusra_pu@201.173.27.64)
* gEtLoSt sets mode: +bbb *!*@201.173.235.* *!*@201.173.24.* *!*@201.173.244.*
* Parts: khusra_punjabi-nA (~khusra_pu@187.246.230.180)
* Parts: khusra_punjabi-iE (~khusra_pu@201.172.60.227)
* Parts: khusra_punjabi-VU (~khusra_pu@201.172.139.233)
* Parts: khusra_punjabi-pd (~khusra_pu@201.173.205.42)
* Parts: khusra_punjabi-jz (~khusra_pu@201.173.80.48)
* Parts: khusra_punjabi-bE (~khusra_pu@201.173.80.131)
* Parts: khusra_punjabi-aS (~khusra_pu@201.173.76.36)
* Parts: khusra_punjabi-pP (~khusra_pu@201.173.61.93)
* Parts: khusra_punjabi-Dx (~khusra_pu@201.172.191.102)
* Joins: khusra_punjabi-OY (~khusra_pu@201.173.207.67)
* Parts: khusra_punjabi-Rn (~khusra_pu@201.173.27.64)
* Parts: khusra_punjabi-RF (~khusra_pu@201.173.24.236)
* gEtLoSt sets mode: +bb *!*@201.173.80.* *!*@201.173.81.*
* Parts: khusra_punjabi-OY (~khusra_pu@201.173.207.67)
* Joins: cpl (~cpl@182.180.125.43)
* gEtLoSt sets mode: +b *!*@201.173.207.*
* gEtLoSt sets mode: +b *!*@201.173.76.*
* NoNSt0p sets mode: +bbb *!*@192.162.101.84 *!*@200.225.1.214 *!*@200.225.12.133
* KriminaL sets mode: +bbb *!*@192.162.101.* *!*@200.225.1.* *!*@200.225.12.*
* gEtLoSt sets mode: +bb *!*@201.173.27.* *!*@201.173.61.*
* Joins: khusra_punjabi-uO (~khusra_pu@201.172.62.245)
* Parts: khusra_punjabi-uO (~khusra_pu@201.172.62.245)
* Joins: khusra_punjabi-Be (~khusra_pu@201.172.60.152)
* Parts: khusra_punjabi-Be (~khusra_pu@201.172.60.152)
* Parts: lund (~piii@WimaxUser36176-76.wateen.net)
* gEtLoSt sets mode: +bbbb *!*@201.172.139.* *!*@201.172.191.* *!*@201.172.60.* *!*@201.173.205.*
* gEtLoSt sets mode: +b *!*@201.172.62.*
* NoNSt0p sets mode: +b *!*@200.92.100.111
* KriminaL sets mode: +b *!*@200.92.100.*
* gEtLoSt sets mode: +bb *!*@201.173.232.* *!*@201.173.233.*
* gEtLoSt sets mode: +bb *!*@201.173.180.* *!*@201.173.186.*
* Joins: M4Cpls (uid51641@id-51641.tooting.irccloud.com)
* gEtLoSt sets mode: +bbbb *!*@201.173.160.* *!*@201.173.162.* *!*@201.173.172.* *!*@201.173.178.*
* gEtLoSt sets mode: +bbb *!*@201.172.80.* *!*@201.173.158.* *!*@201.173.159.*
* NoNSt0p sets mode: +bbbbbb *!*@197.253.6.200 *!*@200.92.13.239 *!*@200.92.26.65 *!*@201.172.105.26 *!*@201.172.121.111 *!*@201.172.123.42
<@ZarNaH> Yeah almost done
* KriminaL sets mode: +bbbbbb *!*@197.253.6.* *!*@200.92.13.* *!*@200.92.26.* *!*@201.172.105.* *!*@201.172.121.* *!*@201.172.123.*
* gEtLoSt sets mode: +b *!*@201.173.191.*
* Joins: Amy27 (~u291187@mobile-166-176-56-159.mycingular.net)
* Joins: nainna (~n@182.68.5.197)
* gEtLoSt sets mode: +bb *!*@201.172.78.* *!*@201.173.120.*
* Parts: Drebble (Mibbit@39.57.1.88)
* gEtLoSt sets mode: +bbb *!*@201.172.61.* *!*@201.172.71.* *!*@201.172.73.*
* gEtLoSt sets mode: +bbbb *!*@201.172.53.* *!*@201.172.54.* *!*@201.172.57.* *!*@201.172.58.*
* NoNSt0p sets mode: +bbbbbb *!*@190.213.123.252 *!*@201.172.137.231 *!*@190.213.183.155 *!*@201.172.138.176 *!*@201.172.146.36 *!*@190.213.41.48
* gEtLoSt sets mode: +bbb *!*@201.172.233.* *!*@201.172.26.* *!*@201.172.50.*
* KriminaL sets mode: +bbbbbb *!*@190.213.123.* *!*@201.172.137.* *!*@190.213.183.* *!*@201.172.138.* *!*@201.172.146.* *!*@190.213.41.*
* gEtLoSt sets mode: +b *!*@187.246.230.*
* gEtLoSt sets mode: +b *!*@201.173.136.*
* NoNSt0p sets mode: +bbbbbb *!*@190.213.140.53 *!*@190.83.186.106 *!*@201.172.166.112 *!*@190.213.108.241 *!*@201.172.17.27 *!*@201.172.179.215
-------------------------------------------------------------------------------------
if i ask for more to write tcl wich protect channel those join with same nick
lock the channel mode ban nick or if ident is same ban the ident as u can see in the logs.. so i will be very thankful to you . i use DALnet Network..

Specially thanks to SpiKe^^ helping me to changing ban mask option tcl working very fine ban mask option u made it very perfect as i asked for Ones again thanks to give us ur time and helping me to make it very rite.

F|irT...!
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

remove-damn-spam-bots.tcl v1.6 by SpiKe^^

Post by SpiKe^^ »

See if this helps with that new attack.
Notice the one new setting.

Code: Select all

## remove-damn-spam-bots.tcl v1.6 (7Feb2016) by SpiKe^^ ## 


# Spam bots joins, kick-ban on joins:seconds #
set rdsb(flood) 3:10

# Spam bots joins kick-ban reason #
set rdsb(reasn) "Damn Spam Bot!"

# Max number of bans to stack in one mode command #
set rdsb(maxb) 6

# Length of time in minutes to ban damn spam bots #
# - set 0 to disable this script removing bans (ex. set rdsb(btime) 0) #
set rdsb(btime) 5

# After a valid damn spam bot join flood, script will continue #
# to kick-ban offenders for an additional 'x' seconds #
set rdsb(xpire) 10


# Set the type of ban masks to use #                     <- NEW SETTING <-
#  1 = use host/ip specific bans (ex. *!*@some.host.com) #
#  2 = use wide masked host/ip bans (ex. *!*@*.host.com) #
#      note: setting 2 requires eggdrop 1.6.20 or newer. #
set rdsb(btype) 2

# Set protected host(s) that should not be wide masked # <- NEW SETTING <-
# - Example:  set rdsb(phost) "*.undernet.org"
#  Note: this setting only applies to ban type 2 above! #
#  Note: set empty to not protect any hosts (ex. set rdsb(phost) "") #
#  Note: space separated if listing more than one protected host #
set rdsb(phost) ""

# Enable username bans for botnets with a common username? # <- NEW SETTING <-
# If a botnet was to join with uhosts like this: ~khusra_pu@187.242.163.214
#   ~khusra_pu@192.162.101.84  ~khusra_pu@200.225.1.214
#   should this script set a single uhost ban?  (ex. *!~khusra_pu@*) #
#  0 = username bans off: continue setting host/ip bans #
#  1 = username bans on: set a username ban when that would work #
set rdsb(uban) 1


# Set channel mode(s) on flood detected. #
# - set empty to disable setting channel modes (ex. set rdsb(mode) "") #
set rdsb(mode) "im"

# Remove these channel modes after how many seconds? #
set rdsb(mrem) 20

# END OF SETTINGS # Don't edit below unless you know what you're doing # 

bind join - * rdsb_bindjoin 

proc rdsb_bindjoin {nick uhost hand chan} { 
  global rdsb rdsc rdsq 

  if {[isbotnick $nick]} { return 0 } 
  if {[matchattr $hand f|f $chan]} { return 0 } 
  if {![string match "~*" $uhost]} { return 0 } 

  set user [string range [lindex [split $uhost @] 0] 1 9] 
  if {$user ne [string range $nick 0 8]} { return 0 } 

  set uhost [string tolower $nick!$uhost] 
  set chan [string tolower $chan] 
  set utnow [unixtime] 
  set target [lindex $rdsb(flood) 0] 

  if {[info exists rdsc($chan)]} { 
    set uhlist [lassign $rdsc($chan) cnt ut] 
    set utend [expr {$ut + [lindex $rdsb(flood) 1]}] 
    set expire [expr {$utend + $rdsb(xpire)}] 
    if {$cnt < $target} { 
      if {$utnow > $utend} { unset rdsc($chan) } 
    } elseif {$utnow > $expire} { unset rdsc($chan) } 
  } 
  if {![info exists rdsc($chan)]} { 
    set rdsc($chan) [list 1 $utnow $uhost] 
    return 0 
  } 

  incr cnt 
  if {$cnt <= $target} { 
    if {[lsearch $uhlist $uhost] == -1} { lappend uhlist $uhost } 
    if {$cnt < $target} { 
      set rdsc($chan) [linsert $uhlist 0 $cnt $ut] 
    } else { 
      set rdsc($chan) [list $cnt $ut] 
      if {$rdsb(mode) ne "" && [string is digit -strict $rdsb(mrem)]} { 
        putquick "MODE $chan +$rdsb(mode)" 
        utimer $rdsb(mrem) [list putquick "MODE $chan -$rdsb(mode)"] 
      } 
      rdsb_dobans $chan $uhlist 
    } 
    return 0 
  } 

  if {![info exists rdsq($chan)]} { 
    utimer 2 [list rdsb_bque $chan] 
    set rdsq($chan) [list $uhost] 
  } elseif {[lsearch $rdsq($chan) $uhost] == -1} { 
    lappend rdsq($chan) $uhost 
  } 

  if {[llength $rdsq($chan)] >= $rdsb(maxb)} { 
    rdsb_dobans $chan $rdsq($chan) 
    set rdsq($chan) "" 
  } elseif {[botisop $chan]} { putquick "KICK $chan $nick :$rdsb(reasn)" } 
  return 0 
} 

proc rdsb_dobans {chan uhlist} { 
  global rdsb rdsu
  if {![botisop $chan]} return 
  set banList "" 
  set nickList "" 


  set banned ""
  if {[info exists rdsu($chan)]} {  set banned $rdsu($chan)  }
  set userList $banned


  foreach ele $uhlist { 
    scan $ele {%[^!]!%[^@]@%s} nick user host 


    set bmask ""

    if {$rdsb(uban) == 1} {

      if {[lsearch $userList $user] > -1} {

        if {[lsearch $banned $user] == -1} {

          if {$banned eq ""} {  utimer 10 [list unset rdsu($chan)]  }

          set bmask "*!$user@*"
          lappend banned $user
          set rdsu($chan) $banned

        } else {  set bmask 0  }

      } else {  lappend userList $user  }

    }

    if {$bmask eq "" && $rdsb(btype) == 2} {
      set type 4

      foreach ph $rdsb(phost) {
        if {[string match -nocase $ph $host]} {
          set type 2  ;  break
        }
      }

      set bmask [maskhost $ele $type]

    } elseif {$bmask eq ""} {  set bmask "*!*@$host"  }

    if {$bmask ne "0" && [lsearch $banList $bmask] == -1} {
      lappend banList $bmask
    } 


    if {[lsearch $nickList $nick] == -1} { lappend nickList $nick } 
  } 
  stack_bans $chan $rdsb(maxb) $banList 
  foreach nk $nickList { 
    if {[onchan $nk $chan]} { putquick "KICK $chan $nk :$rdsb(reasn)" } 
  } 

  if {$rdsb(btime) > 0} { 
    set expire [expr {[unixtime] + $rdsb(btime)}] 
    lappend rdsb(rmls) [list $expire $chan $banList] 
  } 
} 

proc stack_bans {chan max banlist {opt +} } { 
  set len [llength $banlist] 
  while {$len > 0} { 
    if {$len > $max} { 
      set mode [string repeat "b" $max] 
      set masks [join [lrange $banlist 0 [expr {$max - 1}]]] 
      set banlist [lrange $banlist $max end] 
      incr len -$max 
    } else { 
      set mode [string repeat "b" $len] 
      set masks [join $banlist] 
      set len 0 
    } 
    putquick "MODE $chan ${opt}$mode $masks" 
  } 
} 

proc rdsb_bque {chan} { 
  global rdsq 
  if {![info exists rdsq($chan)]} { return } 
  if {$rdsq($chan) eq ""} { unset rdsq($chan) ; return } 
  rdsb_dobans $chan $rdsq($chan) 
  unset rdsq($chan) 
} 

proc rdsb_breset {} { 
  global rdsc rdsb 
  set utnow [unixtime] 
  set target [lindex $rdsb(flood) 0] 
  foreach {key val} [array get rdsc] { 
    lassign $val cnt ut 
    set utend [expr {$ut + [lindex $rdsb(flood) 1]}] 
    set expire [expr {$utend + $rdsb(xpire)}] 
    if {$cnt < $target} { 
      if {$utnow > $utend} { unset rdsc($key) } 
    } elseif {$utnow > $expire} { unset rdsc($key) } 
  } 

  if {[info exists rdsb(rmls)]} { 
    while {[llength $rdsb(rmls)]} { 
      set next [lindex $rdsb(rmls) 0] 
      lassign $next expire chan banList 
      if {$expire > $utnow} {  break  } 
      set rdsb(rmls) [lreplace $rdsb(rmls) 0 0] 
      if {![info exists rmAra($chan)]} {  set rmAra($chan) $banList 
      } else {  set rmAra($chan) [concat $rmAra($chan) $banList]  } 
    } 
    foreach {key val} [array get rmAra] { 
      set banList "" 
      foreach mask $val { 
        if {![ischanban $mask $key]} {  continue  } 
        lappend banList $mask 
      } 
      if {$banList eq ""} {  continue  } 
      if {![botisop $key]} { 
        set rdsb(rmls) [linsert $rdsb(rmls) 0 [list $utnow $key $banList]] 
      } else {  stack_bans $key $rdsb(maxb) $banList -  } 
    } 
    if {![llength $rdsb(rmls)]} {  unset rdsb(rmls)  } 
  } 

  utimer 30 [list rdsb_breset] 
} 

if {![info exists rdsb_running]} { 
  utimer 20 [list rdsb_breset] 
  set rdsb_running 1 
} 

set rdsb(flood) [split $rdsb(flood) :] 
set rdsb(btime) [expr {$rdsb(btime) * 60}] 
set rdsb(phost) [split [string trim $rdsb(phost)]]
if {$rdsb(btime)==0 && [info exists rdsb(rmls)]} {  unset rdsb(rmls)  } 

putlog "Loaded remove-damn-spam-bots.tcl v1.6 by SpiKe^^"

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Why not set a ban on their ident like *!~khusra_pu@* ?
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

it also helps to have a chan limiter running

such as one i used and rather effective :

Code: Select all

##############################
## ------------------------ ##
## 10. Channel Limit Script ##
## ------------------------ ##
##############################


#Channels in which to activate limiting, this should be a list like
#"#elephants #wildlife #etc". Leave it set to "" if you wish to activate
#limiting on all channels the bot is on.
set cl_chans ""

#Limit to set (number of users on the channel + this setting)
set cl_limit "5"

#Limit grace (if the limit doesn't need to be changed by more than this,
#don't bother setting a new limit)
set cl_grace "1"

# Frequency of checking whether a new limit needs to be set (in seconds)
set cl_utimer "10"


bind join - "*" limit:chng:on:bot:join

proc limit:chng:on:bot:join {nick uhost hand chan} {
 global cl_chans limit_delay
 if {[isbotnick $nick] && ([lsearch -exact [split [string tolower $cl_chans]] [string tolower $chan]] != -1)} {
  set limit_delay([string tolower $chan]) 1
  utimer 3 [list unset limit_delay([string tolower $chan])]
  }
}

proc cl_dolimit {} {
  global cl_chans cl_limit cl_grace cl_utimer limit_delay
  utimer $cl_utimer cl_dolimit
  foreach chan [string tolower [channels]] {
    if {$cl_chans != ""} {
     if {([lsearch -exact [split [string tolower $cl_chans]] [string tolower $chan]] == -1)} { continue }
    }
    if {[info exists limit_delay($chan)]} { continue }
    if {![botisop $chan]} { continue }
    set numusers [llength [chanlist $chan]]
    set newlimit [expr $numusers + $cl_limit]
    if {[string match "*l*" [lindex [getchanmode $chan] 0]]} {
      set currlimit [string range [getchanmode $chan] [expr [string last " " [getchanmode $chan]] + 1] end]
    } else {
      set currlimit 0
    }
    if {$newlimit == $currlimit} { continue }
    if {$newlimit > $currlimit} {
      set difference [expr $newlimit - $currlimit]
    } elseif {$currlimit > $newlimit} {
      set difference [expr $currlimit - $newlimit]
    }
    if {$difference <= $cl_grace} { continue }
    putnow "MODE $chan +l $newlimit"
    #putquick "MODE $chan +l $newlimit" -next
    }
}

proc cl_startlimit {} {
  global cl_utimer
  if {[string match "*cl_dolimit*" [utimers]]} { return 0 }
  utimer $cl_utimer cl_dolimit
}

cl_startlimit 

if {$cl_chans == ""} {
  putlog "Loaded chanlimit.tcl v1.5 by slennox (active on all channels)"
} else {
  putlog "Loaded chanlimit.tcl v1.5 by slennox (active on: [join $cl_chans ", "])"
}

this is one of many available in the archives

also you might want to set channel mode +j

like mode #channel +j 3:10
Last edited by simo on Tue Feb 09, 2016 1:32 pm, edited 1 time in total.
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tested that latest tcl you posted here on my testnet SpiKe^^ and it didnt seem to work
11:49:55   Join :   ruben   Moffett@ServerNet-s6q.sge.42.121.IP
11:49:55   Join :   castle   Guinn@ServerNet-hh3.liv.128.104.IP
11:49:55   Join :   lin   Hart@ServerNet-7hmpco.static.cnode.io
11:49:55   Join :   lomax   Crutcher@ServerNet-oip.huf.83.112.IP
11:49:55   Join :   johnathan   Brockman@ServerNet-mn5.r3n.198.111.IP
11:49:55   Join :   larry   Mauro@ServerNet-i3m.f0n.43.121.IP
11:49:55   Join :   gutierrez   Purcell@ServerNet-db1.4nr.244.103.IP
11:49:55   Join :   jameson   Delvalle@ServerNet-cgbe88.static.ximdns.com
11:49:55   Join :   gaines   Hanlon@ServerNet-qq0.i6u.72.111.IP
11:49:56   Join :   ike   Guest@ServerNet-rdu.vsj.154.175.IP
11:49:56   Join :   crandall   Casas@ServerNet-dr3.jd7.230.115.IP
11:49:56   Join :   mcgill   Geary@ServerNet-dib.1i6.144.122.IP
11:49:56   Join :   spooner   Sousa@ServerNet-blm.3rj.40.121.IP
11:49:56   Join :   harry   Clemens@ServerNet-hk9.p0n.203.114.IP
11:49:56   Join :   musgrove   Ferry@ServerNet-3uq.ts5.29.115.IP
11:49:57   Join :   correa   Mccall@ServerNet-4db.np3.211.117.IP
11:49:58   Join :   dobbs   Laws@ServerNet-p1u.0hu.183.177.IP
11:49:58   Join :   yajaira   Harrison@ServerNet-meh.84t.200.123.IP
11:50:00   Join :   stubbs   Heim@ServerNet-ejuics.housing.hawaii.edu
11:50:00   Join :   sonja   Shirley@ServerNet-rno.a2b.226.177.IP
11:50:00   Join :   arnett   Sun@ServerNet-qhk.k88.72.120.IP
11:50:00   Join :   sowell   Bair@ServerNet-h1a.b2u.75.106.IP
11:50:01   Join :   onita   Bishop@ServerNet-s6j.6qt.193.177.IP
11:50:01   Join :   orosco   Leeanna@ServerNet-afd.up5.211.117.IP
11:50:03   Join :   steward   Goodwin@ServerNet-du3.50h.193.118.IP
11:50:07   Join :   holland   Liu@ServerNet-4n5.p52.229.177.IP
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tested the script using it like this (but it didnt react at all on mass joins)

Code: Select all

## remove-damn-spam-bots.tcl v1.6 (7Feb2016) by SpiKe^^ ##


# Spam bots joins, kick-ban on joins:seconds #
set rdsb(flood) 3:10

# Spam bots joins kick-ban reason #
set rdsb(reasn) "Damn Spam Bot!"

# Max number of bans to stack in one mode command #
set rdsb(maxb) 15

# Length of time in minutes to ban damn spam bots #
# - set 0 to disable this script removing bans (ex. set rdsb(btime) 0) #
set rdsb(btime) 5

# After a valid damn spam bot join flood, script will continue #
# to kick-ban offenders for an additional 'x' seconds #
set rdsb(xpire) 10


# Set the type of ban masks to use #                     <- NEW SETTING <-
#  1 = use host/ip specific bans (ex. *!*@some.host.com) #
#  2 = use wide masked host/ip bans (ex. *!*@*.host.com) #
#      note: setting 2 requires eggdrop 1.6.20 or newer. #
set rdsb(btype) 2

# Set protected host(s) that should not be wide masked # <- NEW SETTING <-
# - Example:  set rdsb(phost) "*.undernet.org"
#  Note: this setting only applies to ban type 2 above! #
#  Note: set empty to not protect any hosts (ex. set rdsb(phost) "") #
#  Note: space separated if listing more than one protected host #
set rdsb(phost) ""

# Enable username bans for botnets with a common username? # <- NEW SETTING <-
# If a botnet was to join with uhosts like this: ~khusra_pu@187.242.163.214
#   ~khusra_pu@192.162.101.84  ~khusra_pu@200.225.1.214
#   should this script set a single uhost ban?  (ex. *!~khusra_pu@*) #
#  0 = username bans off: continue setting host/ip bans #
#  1 = username bans on: set a username ban when that would work #
set rdsb(uban) 0


# Set channel mode(s) on flood detected. #
# - set empty to disable setting channel modes (ex. set rdsb(mode) "") #
set rdsb(mode) "imN"

# Remove these channel modes after how many seconds? #
set rdsb(mrem) 20

# END OF SETTINGS # Don't edit below unless you know what you're doing #

bind join - * rdsb_bindjoin

proc rdsb_bindjoin {nick uhost hand chan} {
  global rdsb rdsc rdsq

  if {[isbotnick $nick]} { return 0 }
  if {[matchattr $hand f|f $chan]} { return 0 }
  if {![string match "~*" $uhost]} { return 0 }

  set user [string range [lindex [split $uhost @] 0] 1 9]
  if {$user ne [string range $nick 0 8]} { return 0 }

  set uhost [string tolower $nick!$uhost]
  set chan [string tolower $chan]
  set utnow [unixtime]
  set target [lindex $rdsb(flood) 0]

  if {[info exists rdsc($chan)]} {
    set uhlist [lassign $rdsc($chan) cnt ut]
    set utend [expr {$ut + [lindex $rdsb(flood) 1]}]
    set expire [expr {$utend + $rdsb(xpire)}]
    if {$cnt < $target} {
      if {$utnow > $utend} { unset rdsc($chan) }
    } elseif {$utnow > $expire} { unset rdsc($chan) }
  }
  if {![info exists rdsc($chan)]} {
    set rdsc($chan) [list 1 $utnow $uhost]
    return 0
  }

  incr cnt
  if {$cnt <= $target} {
    if {[lsearch $uhlist $uhost] == -1} { lappend uhlist $uhost }
    if {$cnt < $target} {
      set rdsc($chan) [linsert $uhlist 0 $cnt $ut]
    } else {
      set rdsc($chan) [list $cnt $ut]
      if {$rdsb(mode) ne "" && [string is digit -strict $rdsb(mrem)]} {
        putquick "MODE $chan +$rdsb(mode)"
        utimer $rdsb(mrem) [list putquick "MODE $chan -$rdsb(mode)"]
      }
      rdsb_dobans $chan $uhlist
    }
    return 0
  }

  if {![info exists rdsq($chan)]} {
    utimer 2 [list rdsb_bque $chan]
    set rdsq($chan) [list $uhost]
  } elseif {[lsearch $rdsq($chan) $uhost] == -1} {
    lappend rdsq($chan) $uhost
  }

  if {[llength $rdsq($chan)] >= $rdsb(maxb)} {
    rdsb_dobans $chan $rdsq($chan)
    set rdsq($chan) ""
  } elseif {[botisop $chan]} { putquick "KICK $chan $nick :$rdsb(reasn)" }
  return 0
}

proc rdsb_dobans {chan uhlist} {
  global rdsb rdsu
  if {![botisop $chan]} return
  set banList ""
  set nickList ""


  set banned ""
  if {[info exists rdsu($chan)]} {  set banned $rdsu($chan)  }
  set userList $banned


  foreach ele $uhlist {
    scan $ele {%[^!]!%[^@]@%s} nick user host


    set bmask ""

    if {$rdsb(uban) == 1} {

      if {[lsearch $userList $user] > -1} {

        if {[lsearch $banned $user] == -1} {

          if {$banned eq ""} {  utimer 10 [list unset rdsu($chan)]  }

          set bmask "*!$user@*"
          lappend banned $user
          set rdsu($chan) $banned

        } else {  set bmask 0  }

      } else {  lappend userList $user  }

    }

    if {$bmask eq "" && $rdsb(btype) == 2} {
      set type 4

      foreach ph $rdsb(phost) {
        if {[string match -nocase $ph $host]} {
          set type 2  ;  break
        }
      }

      set bmask [maskhost $ele $type]

    } elseif {$bmask eq ""} {  set bmask "*!*@$host"  }

    if {$bmask ne "0" && [lsearch $banList $bmask] == -1} {
      lappend banList $bmask
    }


    if {[lsearch $nickList $nick] == -1} { lappend nickList $nick }
  }
  stack_bans $chan $rdsb(maxb) $banList
  foreach nk $nickList {
    if {[onchan $nk $chan]} { putquick "KICK $chan $nk :$rdsb(reasn)" }
  }

  if {$rdsb(btime) > 0} {
    set expire [expr {[unixtime] + $rdsb(btime)}]
    lappend rdsb(rmls) [list $expire $chan $banList]
  }
}

proc stack_bans {chan max banlist {opt +} } {
  set len [llength $banlist]
  while {$len > 0} {
    if {$len > $max} {
      set mode [string repeat "b" $max]
      set masks [join [lrange $banlist 0 [expr {$max - 1}]]]
      set banlist [lrange $banlist $max end]
      incr len -$max
    } else {
      set mode [string repeat "b" $len]
      set masks [join $banlist]
      set len 0
    }
    putquick "MODE $chan ${opt}$mode $masks"
  }
}

proc rdsb_bque {chan} {
  global rdsq
  if {![info exists rdsq($chan)]} { return }
  if {$rdsq($chan) eq ""} { unset rdsq($chan) ; return }
  rdsb_dobans $chan $rdsq($chan)
  unset rdsq($chan)
}

proc rdsb_breset {} {
  global rdsc rdsb
  set utnow [unixtime]
  set target [lindex $rdsb(flood) 0]
  foreach {key val} [array get rdsc] {
    lassign $val cnt ut
    set utend [expr {$ut + [lindex $rdsb(flood) 1]}]
    set expire [expr {$utend + $rdsb(xpire)}]
    if {$cnt < $target} {
      if {$utnow > $utend} { unset rdsc($key) }
    } elseif {$utnow > $expire} { unset rdsc($key) }
  }

  if {[info exists rdsb(rmls)]} {
    while {[llength $rdsb(rmls)]} {
      set next [lindex $rdsb(rmls) 0]
      lassign $next expire chan banList
      if {$expire > $utnow} {  break  }
      set rdsb(rmls) [lreplace $rdsb(rmls) 0 0]
      if {![info exists rmAra($chan)]} {  set rmAra($chan) $banList
      } else {  set rmAra($chan) [concat $rmAra($chan) $banList]  }
    }
    foreach {key val} [array get rmAra] {
      set banList ""
      foreach mask $val {
        if {![ischanban $mask $key]} {  continue  }
        lappend banList $mask
      }
      if {$banList eq ""} {  continue  }
      if {![botisop $key]} {
        set rdsb(rmls) [linsert $rdsb(rmls) 0 [list $utnow $key $banList]]
      } else {  stack_bans $key $rdsb(maxb) $banList -  }
    }
    if {![llength $rdsb(rmls)]} {  unset rdsb(rmls)  }
  }

  utimer 30 [list rdsb_breset]
}

if {![info exists rdsb_running]} {
  utimer 20 [list rdsb_breset]
  set rdsb_running 1
}

set rdsb(flood) [split $rdsb(flood) :]
set rdsb(btime) [expr {$rdsb(btime) * 60}]
set rdsb(phost) [split [string trim $rdsb(phost)]]
if {$rdsb(btime)==0 && [info exists rdsb(rmls)]} {  unset rdsb(rmls)  }

putlog "Loaded remove-damn-spam-bots.tcl v1.6 by SpiKe^^" 
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

simo wrote:i tested the script using it like this (but it didnt react at all on mass joins)
Correct, this script as wrote above Will Not trigger on all mass join attacks.
It targets a specific bot net that the requester is having trouble with.
This is the original post where the bot net specifics are explained -> here

The short description of what will trigger this script is:
1) The bots never properly ident, their uhost always starts with a ~
2) The bots always use the same username as their nick.
Ex. Joins: MeReDeath (~MeReDeath@185.76.35.65)
Ex. Joins: faded2dust (~faded2dus@180.250.88.174)
Ex. Joins: Nicedoctor7325 (~Nicedocto@109-207-54-34.ronus.pl)

This script IS NOT a generic join flood script, and does not monitor any joins that don't fit the above rules.

This script does work exactly as designed, for the bots it is designed to target!
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
g
gamble27
Halfop
Posts: 71
Joined: Tue Aug 05, 2008 7:51 am

Post by gamble27 »

this code is working fine, i was wondering if we do not match the nick and ident and use it just for mass join such as if the 5 floodbots join in 2 seconds it will set modes and ban kick them, exactly the same as what this script is doing but no need for matching the nick and ident. We may also need to add in the component of exempting netsplit users as it happens frequently.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Try the new edited version of this script @ Here.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
F
F|irT
Voice
Posts: 30
Joined: Thu Apr 30, 2015 11:23 pm
Location: Pakistan

Result..

Post by F|irT »

Code: Select all

* Joins: Fisher`htu (~dRFee@91.218.30.17)
* Joins: Fisher`OxS (~vwJ@92.222.237.45)
* Joins: Fisher`lsE (~ian@ns239535.ip-192-99-160.net)
* Joins: Fisher`fvN (~FG@postfix.cec-ntic.com)
* Joins: Fisher`yVK (~cNeGh@46.209.216.108)
* Joins: Fisher`nzJ (~IjRM@46.209.81.201)
* Joins: Fisher`nVY (~hJPhW@85.133.171.122)
* Joins: Fisher`qpk (~sQxaG@181.189.249.133)
* Joins: Fisher`NXr (~SM@216.218.133.217)
* Joins: Fisher`Bvq (~kFbcL@216.218.133.217)
* Joins: Fisher`TVC (~uq@92.46.122.98)
* Joins: Fisher`Hfo (~ykfdX@186.227.208.162)
* Joins: Fisher`nxk (~YnPg@101.255.51.47)
* Joins: Fisher`oQy (~YD@92.222.237.7)
* Joins: Fisher`cgu (~RlkO@183.91.68.88)
* Joins: Fisher`ojm (~erSg@92.222.237.60)
* Joins: Fisher`hHl (~xGLs@183.91.68.88)
* Joins: Fisher`jHW (~tKZ@183.237.19.23)
* Joins: Fisher`HPi (~eQ@116.90.163.5)
* Joins: fariha-- (~qwebirc@39.55.25.64)
<mumbai_ammi> hi
* Parts: KrissKross (~KrssKros@39.55.134.21)
* Joins: t4nk (~qwebirc@182.69.120.99)
* Parts: Care__Taker_Friend (~Care_Take@103.4.92.226)
* Quits: bi^hubby (bi_hubby@182.185.17.185) (Quit: )
* Joins: Care__Taker_Friend (~Care_Take@103.4.92.226)
<Fisher`yVK> [censored]
<Fisher`nzJ> [censored]
<Fisher`htu> [censored]
<Fisher`OxS> [censored]
<Fisher`lsE> [censored]
<Fisher`fvN> [censored]
<Fisher`NXr> [censored]
<Fisher`Bvq> [censored]
<Fisher`qpk> [censored]
<Fisher`TVC> [censored]
<Fisher`nxk> [censored]
<Fisher`cgu> [censored]
<Fisher`Hfo> [censored]
<Fisher`yVK> [censored]
<Fisher`nzJ> [censored]
<Fisher`htu> [censored]
<Fisher`OxS> [censored]
<Fisher`lsE> [censored]
<Fisher`fvN> [censored]
<Fisher`NXr> [censored]
<Fisher`Bvq> [censored]
<Fisher`qpk> [censored]
<Fisher`TVC> [censored]
<Fisher`nxk> [censored]
<Fisher`cgu> [censored]
<Fisher`Hfo> [censored]
<Fisher`oQy> [censored]
<Fisher`ojm> [censored]
<Fisher`hHl> [censored]
<Fisher`jHW> [censored]
<Fisher`HPi> [censored]
* NoNSt0p sets mode: +M-k FLood
* NoNSt0p sets mode: +bbb *!*@46.209.216.108 *!*@46.209.81.201 *!*@91.218.30.17
* Fisher`yVK was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #gethelp)
* Fisher`nzJ was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #gethelp)
* Fisher`htu was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #gethelp)
* Fisher`OxS was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* Fisher`lsE was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* Fisher`fvN was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* Fisher`NXr was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* Fisher`Bvq was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* NoNSt0p sets mode: +bbbbb *!*@92.222.237.45 *!*@ns239535.ip-192-99-160.net *!*@postfix.cec-ntic.com *!*@216.218.133.217 *!*@181.189.249.133
* Joins: naila1 (~naila1@mbl-82-51-102.dsl.net.pk)
* Fisher`qpk was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* Fisher`TVC was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* Fisher`nxk was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* Fisher`cgu was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* Fisher`Hfo was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* Fisher`oQy was kicked by NoNSt0p (Ban Reason Repeat Flood! For Help Join #getHelp)
* NoNSt0p sets mode: +bbbbbb *!*@92.46.122.98 *!*@101.255.51.47 *!*@183.91.68.88 *!*@186.227.208.162 *!*@92.222.237.7 *!*@92.222.237.60
sorry it took long time to reply . was waiting for flood now it happend and the tcl i ask for u wirte for is not working.. same nick flood this tcl is add on my bot and it just protect multi txt msg no same nick protection ..

here is some result to show ..
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Different bots, the rules keep changing.

There is no way the script in this thread could ever work with these last bots.
They don't fit one of the base rules you stated for this script:
F|irT wrote:if user join the channel with same nick same ident
Please notice the nick and username are not the same here.

Also, the last script patch is targeting the common username.
These last bots don't use a common username.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

SpiKe^^ wrote:Different bots, the rules keep changing.

There is no way the script in this thread could ever work with these last bots.
You mean the Fisher ones or you are talking about the ones simo said?

Cos if you do about the last, then indeed there's little that can be done, or at least I at this point have no idea.

Still, the best option in my honest opinion is limiting the damage with a chan limiter and locking it if the bots force their way in by raising the channel limit faster then it should normally be raised.
Once the game is over, the king and the pawn go back in the same box.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

I was referring to F|irT's last attack from the Fisher bots.

Simo's bots present much the same issue though, as they also don't trigger the script at all.
The simo bots don't fit either of the base checks done by this script:
1) the bots ident, the uhosts don't start with a ~
2) the bots don't use the same username as their nick

F|irT's last attack they only fail rule number 2, but failing either rule exempts the bot from this script.

Use the generic mass join flood script @ HERE OR any other mass join flood script.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Post Reply