hi all, i found on this forum this script to ban "bad realname"
it's possible to modify it to ban via chanserv privmsg chanserv :BAN $chan $nick $reason ???
i tried to modify it, but i have problems with variables
THANKS IN ADVANCE
# What bad realnames should be banned?
set badr(list) {
"*mahoo*"
"*blowjob*"
"*hot?dot*"
"*smile*"
"*tricky*"
"*bmw??ever*"
"*URENS*HN*"
"*I WILL CLEAN HOUSE*"
}
# For how many minutes whould you like the ban?
set badr(time) 60
# What reason will be used when an person is found using an bad realname?
set badr(reason) "Mag dich net ciao :)"
# binds #
bind join - * badrealname:join
bind raw - 311 badrealname:check
# join #
proc badrealname:join {nick host hand chan} {
if {![validuser $hand] || [strlwr $nick] != [strlwr $::botnick]} {
putserv "WHOIS $nick"
}
}
# check #
proc badrealname:check {from key arg} {
set realname [strlwr [ctrl:filter [string range [lindex [split $arg] end] 1 end]]]
foreach bah $::badr(list) {
if {![string match $bah $realname]} {
continue
}
foreach chan [channels] {
if {![onchan [lindex $arg 1]]} {
continue
}
newchanban $chan "*!*@[lindex [split $arg] 3]" $::botnick $::badr(reason) $::badr(time)
}
break
}
}
proc ctrl:filter {str} {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $str "" str
return $str
}
putlog "badrealname.tcl.. loaded."
## ¤ BadRealname
# version 1.5
# original code by Papillon
# modified and adjusted by caesar <cezarica [at] prietenii [dot] com>
# #eggdrop @ Undernet.org
# http://www.r0x0ring.com/
## ¤ Description:
# Performs a whois on join and places a *!*@host ban if mathes a banned realname.
## ¤ Available commands:
#
# Where Flag Command Description
# ----- ---- ------- -----------
# PUB : N/A
#
# MSG : N/A
#
# DCC : n|n .chanset Use .chanset to set what protections to active for the particular channel or not.
# Example: .chanset #mychan +brealname
# .chanset #otherchan -brealname
## ¤ Custom channel flags:
#
# Flag: Description:
# ----- ------------
# +brealname Channels marked with this flag will be "checked" for bad realnames on join.
#
# Attention!
# By default the channel flag (brealname) is disabled. Enable it on the channels you wish.
## ¤ Thanks:
# Many thanks to ppslim for the ctrl:filter proc.
##
# Adjust the folowing things to suit your needs!
# .1. What bad realnames should be banned?
set badr(list) {
"foo bar"
"bla bla"
"*moo*"
"???"
"*http://*"
"*www.*"
}
# .2. For how many minutes whould you like the ban?
set badr(time) 60
# .3. What reason will be used when an person is found using an bad realname?
set badr(reason) "You norteh norteh boy!"
# .4. Protection settings joins/seconds against a join flood:
set badr(flud) "3:5"
#
## ¤ Don't edit past here unless you know TCL! ¤
#
setudef flag brealname
##
# binds
bind join * * brealname:join
bind part - * brealname:part
bind raw - 311 brealname:check
##
# join
proc brealname:join {nick host hand chan} {
global bflud badr
if {![channel get $chan brealname] || [isbotnick $nick ] || [matchattr $hand of|fo $chan] || ![botisop $chan]} {
return
}
if {![info exists bflud($chan)]} {
set bflud($chan) 0
}
set bla [split $badr(flud) ":"]
set nojoins [lindex $bla 0]
set insec [lindex $bla 1]
incr bflud($chan)
utimer $insec [list brealname:reset $chan]
if {$bflud($chan) <= $nojoins} {
putserv "WHOIS $nick"
}
}
##
# check
proc brealname:check {from key txt} {
global badr botnick
set realname [ctrl:filter [string range [join [lrange [split $txt] 5 end]] 1 end]]
foreach bla $badr(list) {
if {![string match -nocase $bla $realname]} {
continue
}
newchanban $badr(chan) "*!*@[lindex [split $txt] 3]" $botnick $badr(reason) $badr(time)
break
}
}
##
# ppslim's filter
proc ctrl:filter {str} {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $str "" str
return $str
}
##
# reset
proc brealname:reset {chan} {
global bflud
incr bflud($chan) -1
return
}
##
# array remove
proc brealname:part {nick uhost hand chan msg} {
global bflud
if {![isbotnick $nick]} {
return
}
foreach arr_part [array names bflud] {
if {[string match $chan $arr_part]} {
array unset bflud $chan
}
}
}
putlog "badrealname.tcl.. loaded."
Any feedbacks will be appreciated.
Once the game is over, the king and the pawn go back in the same box.
WHOIS'ing on join should be done via puthelp, since the "help" queue has the lowest output priority and hence least likely to cause sendq overflow problems in case of join flood
even better, it would be nice to implement some sort of caching that stuff (WHOIS results); I thought about that when writing spambuster.tcl (it also does WHOIS on join), but ended up in lazyness hehe
I guess puthelp will do better than putserv but anyway I've added a "flood" control thing. Imagine 100 bots join your channel and do a lot of whois.. Eeeek! nightmare!
And what should I do with the whois results since the script is interested only in the realname of the user? The next thing I should do is store the nicknames of the users that join the channel when it's "join flood protection" kicks in and do the whois after a few moments. Anyway.. Thanks for your feedback.
Once the game is over, the king and the pawn go back in the same box.
caesar, just an idea: implement also bans by "bad server" and "bad channels" (user is on forbidden server/chans) - you have the WHOIS replies anyway, so why not use all that stuff
Aaaye, this script looks like a combination of njf.tcl (mode locker) combined with the badrealname one. Atleast that's what I see from the proc's some similarities.
And there are many scripts for badserver name, (unforbidden - I have one) or bad channels (have them too). You can just bind the same proc on whois to the specific raw numbers and that should do the job.
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee) PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Yes, something like this awyeah, it's kind of the same "flood protection" thing. As for implementing a "bad server" and "bad channels" I think there are lots of scripts that allready do this, so I don't want to "complicate" it too much.
Once the game is over, the king and the pawn go back in the same box.