egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tcl Issue..

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
F|irT
Voice


Joined: 30 Apr 2015
Posts: 14
Location: Pakistan

PostPosted: Tue Mar 01, 2016 3:26 pm    Post subject: Tcl Issue.. Reply with quote

yeh the same nick with same ident tcl is diffrent and that is working very nice u update it with ban option no problem with that ..

now was talking about the new tcl wich was writen by i asked if flooder jion with only with same nick or with same ident so u give me this tcl to add it was not working.. as i give u result in paste subject..
Code:

## 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) "10Possibel/Spammer/Flooder! 1If Not join #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) 60


# 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) "M-k Flood"

# 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^^"

Code:

## mass-join-protection.tcl v1.5.1 (25Feb2016) by SpiKe^^ ##


# Mass joins, kick-ban on joins:seconds #
set mjp(flood) 5:2

# Mass joins kick-ban reason #
set mjp(reasn) "10Mass Join Flood. Need HeLp Join 1#gethelp!"

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

# Length of time in minutes to ban mass join flooders #
# - set 0 to disable this script removing bans (ex. set mjp(btime) 0) #
set mjp(btime) 10

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

# Set the type of ban masks to use #
#  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 mjp(btype) 2

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

# Set channel mode(s) on flood detected. #
# - set empty to disable setting channel modes (ex. set mjp(mode) "") #
set mjp(mode) "R-k MaSs-JoIn"

# Remove these channel modes after how many seconds? #
set mjp(mrem) 15

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

bind join - * mjp_bindjoin

proc mjp_bindjoin {nick uhost hand chan} {
  global mjp mjpc mjpq

  if {[isbotnick $nick]} { return 0 }
  if {[matchattr $hand f|f $chan]} { return 0 }

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

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

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

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

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

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


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

      foreach ph $mjp(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 $mjp(maxb) $banList
  foreach nk $nickList {
    if {[onchan $nk $chan]} { putquick "KICK $chan $nk :$mjp(reasn)" }
  }

  if {$mjp(btime) > 0} {
    set expire [expr {[unixtime] + $mjp(btime)}]
    lappend mjp(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 mjp_bque {chan} {
  global mjpq
  if {![info exists mjpq($chan)]} { return }
  if {$mjpq($chan) eq ""} { unset mjpq($chan) ; return }
  mjp_dobans $chan $mjpq($chan)
  unset mjpq($chan)
}

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

  if {[info exists mjp(rmls)]} {
    while {[llength $mjp(rmls)]} {
      set next [lindex $mjp(rmls) 0]
      lassign $next expire chan banList
      if {$expire > $utnow} {  break  }
      set mjp(rmls) [lreplace $mjp(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 mjp(rmls) [linsert $mjp(rmls) 0 [list $utnow $key $banList]]
      } else {  stack_bans $key $mjp(maxb) $banList -  }
    }
    if {![llength $mjp(rmls)]} {  unset mjp(rmls)  }
  }

  utimer 30 [list mjp_breset]
}

if {![info exists mjp_running]} {
  utimer 20 [list mjp_breset]
  set mjp_running 1
}

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

putlog "Loaded mass-join-protection.tcl v1.5.1 by SpiKe^^"

now there is another issue with mass join tcl this is good tcl 5 nick with in 2 sec bot ban lock the channel mode ban ips kick user till 10 sec but there is a problem i just watch today it was netsplit server when server up see what happend here are some logs

Code:

* Joins: nicefriends (~nicefrien@39.48.101.190)
* Joins: shahidjee (~Mibbit@119.159.192.112)
* Joins: iffi^-^ (Major@Moody.Person.ignorelist.com)
* Joins: nobody- (~Billi@p5DCE911B.dip0.t-ipconnect.de)
* Joins: HAndsomerob (S@2602:ffea:1:36f::157)
* Joins: KriminaL (MaStEr@2602:ffca:a::194c:8bd4)
* Joins: InsErT (Sky@2602:ffca:a::489a:af9b)
* Joins: UHUb (InCeSt@chan-stats.tk)
* Joins: Renix (~DeMoN@2602:ffea:1001:919::122)
* Joins: NoNSt0p (NoNStOp@NoNStOp-AlcohoL.unixguru.tk)
* Joins: whynot (Khan@Buddy.of.ChannelLaHoRe.bestforever.com)
* Joins: sarpino (City@I.Hate.Rules.hacked.jp)
* underworld.se.eu.dal.net sets mode: +ovov iffi^-^ UHUb NoNSt0p whynot
* NoNSt0p sets mode: +R-k MaSs-JoIn
* NoNSt0p sets mode: +bbbbb *!*@39.48.89.* *!*@119.159.192.* *!*@39.48.101.* *!*@39.47.42.* *!*@119.153.166.*
* ZoR^AaWar was kicked by NoNSt0p (Mass Join Flood. Need HeLp Join #getHeLp!)
* shahidjee was kicked by NoNSt0p (Mass Join Flood. Need HeLp Join #getHeLp!)
* nicefriends was kicked by NoNSt0p (Mass Join Flood. Need HeLp Join #gettHeLp!)
* uff-meri-mature-ami was kicked by NoNSt0p (Mass Join Flood. Need HeLp Join #gettHeLp!)
* Taimur_ was kicked by NoNSt0p (Mass Join Flood. Need HeLp Join #gettHeLp!)
* sarim-dubai-hard was kicked by NoNSt0p (Mass Join Flood. Need HeLp Join #gettHeLp!)
* You were kicked by NoNSt0p (Mass Join Flood. Need HeLp Join #gethelp!)

Spicily Thanks to SpiKe^^ to be always around to make it always rite what i asked for . and thanks to all senior tcl maker administrator Supporters to active on this site. to help other's

i have issue with mass join after server split mass join protection is on lit has to be changed.
and in other tcl flooder with same nick tcl script does not ban flooder with same nick .
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber