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.

Bad-Nick script with stack bans.

Help for those learning Tcl or writing their own scripts.
Post Reply
F
F|irT
Voice
Posts: 30
Joined: Thu Apr 30, 2015 11:23 pm
Location: Pakistan

Bad-Nick script with stack bans.

Post by F|irT »

Code: Select all

bind join - * join:badnick

proc join:badnick {nick host hand chan} {
	global botnick badnicks badnickchans badnickexempt badnicktime badnicktimer
	if {(([lsearch -exact [string tolower $badnickchans] [string tolower $chan]] != -1) || ($badnickchans == "*")) && ($nick != $botnick)} {
		foreach badnick [string tolower $badnicks] {
			set badnickban1 "*$badnick*!*@*"
			if {[string match *$badnick* [string tolower $nick]]} {
				if {([botisop $chan]) && (![isop $nick $chan]) && (![isvoice $nick $chan]) && (![matchattr $hand $badnickexempt $chan]) && ([onchan $nick $chan])} {
					putquick "MODE $chan +b $badnickban1"
					putquick "KICK $chan $nick :4Bad Nick 14Type /nick New-Nick 4& rejoin The Channel ."
					timer $badnicktime "pushmode $chan -b $badnickban1"
					return 0
				}
			}
		}
	}
}
This is bad nickname kicker working fine ... but when flooder join with ban nick bot make ban one by one .. it's possible to make bot ban max in the raw ... ..

like this ...

Code: Select all

+bbbbb *!*@103.111.54.* *!*@103.73.225.* *!*@103.124.236.* *!*@103.117.228.* *!*@101.51.141.*
+bbbbbb *s*x*!*@* *pimp*!*@* *suck*!*@* ...
if any scripter help me kindly it will be gr8 help .. thanks..
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Try this and let me know.

Code: Select all

# advanced badnick script v. 0.1 by SpiKe^^ #

# list of badnicks #
set bnik(nicks) "sumbadword notherbadword"

# list badnick channel(s) or "*" for all channels #
set bnik(chans) "#sumChannel #notherChan"

# max number of bans to stack in one mode command (1 or more) #
set bnik(maxban) 6

# set seconds to wait before removing bans or 0 to not remove #
set bnik(btime) 30

# max number of kicks to stack in one kick command (1 or more) #
set bnik(maxkick) 3

# set the kick-ban reason #
set bnik(reasn) "\00304Bad Nick \00314Type: \002/nick New-Nick\002\00304 & rejoin the channel."

# set exempt userfile flags or "" for none #
set bnik(xflag) "bmno|o"

# exempt all users with +o in the channel ?? #
# ! this will add a brief delay (2 second minimum) ! #
#  0 = disabled: don't exempt users with +o #
#  1 = exempt all users with +o   #
#  2 = also exempt users with +v  #
set bnik(xops) 2

# set seconds to wait before checking the channel for +o or +v #
set bnik(otime) 2   ;# (0 = no delay) OR 2+ secs #

# set seconds to wait to gather a queue (1 or more) #
set bnik(qtime) 2



#### !End of Settings! !End of Settings! !End of Settings! ####
set bnik(nicks) [split [string tolower $bnik(nicks)]]
set bnik(chans) [split [string tolower $bnik(chans)]]
if {$bnik(xops)!=1 && $bnik(xops)!=2} { set bnik(xops) 0 }

bind join - * join:badnick

proc join:badnick {nk uh hn ch} {  global bnik bnop
  if {[isbotnick $nk]} { return }

  set ch [string tolower $ch]
  if {[lsearch -exact $bnik(chans) $ch] == -1 && $bnik(chans)!="*"} { return }
  if {$bnik(xflag)!="" && [matchattr $hn $bnik(xflag) $ch]} { return }

  foreach badnk $bnik(nicks) {
    if {[string match -nocase *$badnk* $nk]} {  set isbad $badnk  ;  break  }
  }
  if {![info exists isbad]} { return }

  set tid $ch,[unixtime]
  lappend bnop($tid) [string tolower $nk!$uh!$isbad]

  if {$bnik(otime)==0} {  check:badnick $tid
  } elseif {[llength $bnop($tid)]==1} {
    utimer $bnik(otime) [list check:badnick $tid]
  }
  return
}


proc check:badnick {tid} {  global bnik bnop bnqu
  lassign [split $tid ","] ch ut
  if {![info exists bnop($tid)]} { return }

  foreach nkuh $bnop($tid) {  lassign [split $nkuh "!"] nk uh isbad
    if {$bnik(xops)>0 && [isop $nk $ch]} { continue }
    if {$bnik(xops)>1 && [isvoice $nk $ch]} { continue }

    if {![info exists bnqu($ch)]} {
      utimer $bnik(qtime) [list queue:badnick $ch]
    }
    lappend bnqu($ch) $nkuh
  }
  unset bnop($tid)
}


proc queue:badnick {ch} {  global bnik bnqu
  if {![info exists bnqu($ch)]} { return }
  if {![botisop $ch]} { unset bnqu($ch) ; return }

  set banList ""  ;  set nickList ""
  foreach nkuh $bnqu($ch) {  lassign [split $nkuh "!"] nk uh isbad
    if {![onchan $nk $ch]} { continue }
    set bmask "*$isbad*!*@*"
    if {[lsearch $banList $bmask] == -1} { lappend banList $bmask }
    if {[lsearch $nickList $nk] == -1} { lappend nickList $nk }
  }
  unset bnqu($ch)

  set len [llength $banList]  ;  set max $bnik(maxban)
  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 $ch +$mode $masks"
    if {$bnik(btime) > 0} {
      utimer $bnik(btime) [list putquick "MODE $ch -$mode $masks"]
    }
  }

  set len [llength $nickList]  ;  set max $bnik(maxkick)
  while {$len > 0} {
    if {$len > $max} {
      set nicks [join [lrange $nickList 0 [expr {$max - 1}]] ,]
      set nickList [lrange $nickList $max end]
      incr len -$max
    } else {
      set nicks [join $nickList]
      set len 0
    }
    putquick "KICK $ch $nicks :$bnik(reasn)"
  }
}

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: 1071
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tested it somewhat it seems to not kick all stacked bans the stacked bans part seem to work fine tho
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

hi SpiKe^^
interesting its writing but it would be good to also have an example warning set that warns 3 times and of bankick and that also recognizes the variant of nickname changes is to say that when the offender changes the nickname he still recognizes it and applies the warning set..

example; description; that the bot warns 2 times and the third one that ban kick /// if the set is 0 then it is direct ban when entering the channel
set warnings 3

it would be great if your writing has that already mentioned
set of warnings and nickname acknowledgments when you have changed to another nickname;
* symors (~Apna@181.115.129.223) has joined #beni2
* symors is now known as horny
eggdrop in channel; horny, change your nick please, 1 warning
eggdrop in channel; horny, if you don't change your nickname you will be ejected last warning.
in channel; * horny was kicked by eggdrop (sorry on this channel badnicks are not allowed)
or -----
* horny (~Apna@181.115.129.223) has joined #beni2
eggdrop in channel; horny, change your nick please, 1 warning
eggdrop in channel; horny, if you don't change your nickname you will be ejected last warning.
in channel; * horny was kicked by eggdrop (sorry on this channel badnicks are not allowed)
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
Post Reply