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.

Ban certain Realnames

Help for those learning Tcl or writing their own scripts.
Post Reply
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Ban certain Realnames

Post by juanamores »

Ones I found a script to ban certain RealNames (no nicks).
I do not remember that post was published and can not find it.
If someone remembers a script to control RealNames users on joining the channel, thank you.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Re: Ban certain Realnames

Post by willyw »

juanamores wrote:Ones I found a script to ban certain RealNames (no nicks).
I do not remember that post was published and can not find it.
If someone remembers a script to control RealNames users on joining the channel, thank you.
I believe AllProtection does.

Visit this thread:
http://forum.egghelp.org/viewtopic.php? ... start=1305

and ask the author of AP about it.
He is active again. He just released a new version today.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
BLaCkShaDoW
Op
Posts: 117
Joined: Sun Jan 11, 2009 4:50 am
Location: Romania
Contact:

badrealname

Post by BLaCkShaDoW »

BLaCkShaDoW Production @ WwW.TclScripts.Net
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Re: badrealname

Post by juanamores »

Why not work?
I activated the script for the party line

Code: Select all

.chanset #mychanel +badfullname
channel set #mychanel +udef-flag-badfullname
Tcl error [badrealname]: can not find channel named "#mychanel"

Code: Select all

#######################################################################
#
# BadFullname vers 1.1
# 
#
#                                    BLaCkShaDoW Productions
#######################################################################

#######################################################################
#
#On join, if a user`s realname contains any of the restricted words #that are written in this script, the BoT will ban the user :)
#Contains protection for users who have access on the boT :)
#
#      TO ACTIVATE TYPE IN DCC .chanset #canal +badfullname
#######################################################################



#Here You can set the words that are forbidden

set bad(fullnames) {
"*Radio Pepe*"
}

#Here you can set the reason for the kick / ban

set bad(reason) "Bad Fullname"

#Here you can set the time for the ban (hours)

set bad(time) "2"

#Here you can set the flags that are excepted

set bad(flags) "n|n"
set mychan "#mychanel"

########################################################################
#                         Here starts the config
#
#
#######################################################################

setudef flag badfullname
set Autor "BLaCkShaDoW"
set vers "1.1"

bind join -|- "* *" badrealname

proc badrealname {nick host hand chan} { 
global botnick mychan
if {$chan != $mychan} { return }
set ::cchan $chan
set ::nnick $nick
set ::hhost $host
if { [chan get $chan badfullname] } {
if {![botisop $chan]} { return 0 }
if {[onchan $nick $chan]} {
putserv "WHOIS $nick $nick"
putlog "doing WHOIS to $nick..."
bind RAW - 311 badfullnames
}
}
}

proc badfullnames { from keyword arguments } {
global botnick bad mychan
set channel $::cchan
if {$channel != $mychan} { return }
set nickname $::nnick
set host $::hhost
set handle "[nick2hand $nickname]"
set fullname [string range [join [lrange $arguments 5 end]] 1 end]
if {[onchan $nickname $channel]} {
    		set banmask *!*@[lindex [split [getchanhost $nickname $channel] "@"] 1] 
	}
  foreach realname [string tolower $bad(fullnames)] {
if {[string match $realname [string tolower $fullname]]} {
if {[matchattr $handle $bad(flags) $channel]} { return 0 }
newchanban $channel $banmask $botnick $bad(reason) [expr $bad(time) * 60]
}
}
unbind RAW - 311 badfullnames
}

putlog "Bad Fullname $vers by $Autor Loaded !"
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
BLaCkShaDoW
Op
Posts: 117
Joined: Sun Jan 11, 2009 4:50 am
Location: Romania
Contact:

badrealname

Post by BLaCkShaDoW »

You should try the *unmodified* version. Do not try to modify, just add the tcl and activate it with the specific flag on the chan you desire.
BLaCkShaDoW Production @ WwW.TclScripts.Net
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Re: badrealname

Post by juanamores »

BLaCkShaDoW wrote:You should try the *unmodified* version. Do not try to modify, just add the tcl and activate it with the specific flag on the chan you desire.
Ok , it works.
What I have to change for the Ban is the type nick!ident@host ?
Currently, the BAN gives it to the virtual IP (host) *!*@host.bla.bla

Thus , I give the user the opportunity to change your fullname is and can enter immediately.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
BLaCkShaDoW
Op
Posts: 117
Joined: Sun Jan 11, 2009 4:50 am
Location: Romania
Contact:

badrealname 1.2

Post by BLaCkShaDoW »

Code: Select all

####################################################################### 
# 
# BadFullname vers 1.1 
# 
# 
#                                    BLaCkShaDoW Productions 
####################################################################### 

####################################################################### 
# 
#On join, if a user`s realname contains any of the restricted words #that are written in this script, the BoT will ban the user :) 
#Contains protection for users who have access on the boT :) 
# 
#      TO ACTIVATE TYPE IN DCC .chanset #canal +badfullname 
####################################################################### 



#Here You can set the words that are forbidden 

set bad(fullnames) { 
"*Radio Pepe*" 
} 

#Here you can set the reason for the kick / ban 

set bad(reason) "Bad Fullname" 

#Here you can set the time for the ban (hours) 

set bad(time) "2" 

#Here you can set the flags that are excepted 

set bad(flags) "n|n"

######################################################################## 
#                         Here starts the config 
# 
# 
####################################################################### 

setudef flag badfullname 
set Autor "BLaCkShaDoW" 
set vers "1.1" 

bind join -|- "* *" badrealname 

proc badrealname {nick host hand chan} { 
global botnick bad
set ::cchan $chan 
set ::nnick $nick 
set ::hhost $host 
if { [channel get $chan badfullname] } { 
if {![botisop $chan]} { return 0 } 
if {[onchan $nick $chan]} { 
putserv "WHOIS $nick $nick" 
bind RAW - 311 badfullnames 
} 
} 
} 

proc badfullnames { from keyword arguments } { 
global botnick bad
set channel $::cchan 
set nickname $::nnick 
set host $::hhost 
set handle "[nick2hand $nickname]" 
set fullname [string range [join [lrange $arguments 5 end]] 1 end] 
if {[onchan $nickname $channel]} {
          set ident [string tolower [lindex [split $host "@"] 0]]
          set banmask  $nickname!$ident@[lindex [split [getchanhost $nickname $channel] "@"] 1] 
   } 
  foreach realname [string tolower $bad(fullnames)] { 
if {[string match $realname [string tolower $fullname]]} { 
if {[matchattr $handle $bad(flags) $channel]} { return 0 } 
newchanban $channel $banmask $botnick $bad(reason) [expr $bad(time) * 60] 
} 
} 
unbind RAW - 311 badfullnames 
} 

putlog "Bad Fullname $vers by $Autor Loaded !"
BLaCkShaDoW Production @ WwW.TclScripts.Net
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

Work perfectly! :D

Thanks, BLaCkShaDoW.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

  foreach realname [string tolower $bad(fullnames)] {
if {[string match $realname [string tolower $fullname]]} {
if {[matchattr $handle $bad(flags) $channel]} { return 0 }
newchanban $channel $banmask $botnick $bad(reason) [expr $bad(time) * 60]
}
} 
The matchattr check should be outside of the foreach loop. You should use continue when inside the loop you wish to continue with the loop or break when want to stop, not return.

You can get the nick from the reply with something crazy like:

Code: Select all

set realName [lindex [split [lassign $arguments bot nick user host] :] 1]
inside the badfullnames and will get the bot's nick and nick, user (ident), host and his real name from the person it whois-ed with just one line.

If the bot dose a whois on user X and shortly member Y joins and if the raw 311 reply is late then the ::nnick will be replaced in the badrealname proc before it's seen by the badfullnames proc, so when the reply comes it will see member Y instead of X.

Haven't tested anything, just saying from what could happen in theory.
Once the game is over, the king and the pawn go back in the same box.
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 caesar ..
the correct thing of that time as he would be a friend, with its suggestions for this tcl.
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

Thanks for the input caesar.
I had undergone some small correction.

Code: Select all

foreach realname [string tolower $bad(fullnames)] {
if {[string match $realname [string tolower $fullname]]} {
if {[matchattr $handle $bad(flags) $channel]} { continue }
newchanban $channel $banmask $botnick $bad(reason) [expr $bad(time) * 60]
} else {continue}
}
In this way it has worked properly.
Not if I'm being very repetitive with the continue command, but it works for me .
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Move the

Code: Select all

if {[matchattr $handle $bad(flags) $channel]} { continue } 
outside the foreach loop and make it return instead of continue. Also, in newchanban the the time is in minutes, not in seconds so you don't need the [expr $bad(time) * 60]
lifetime is specified in minutes. If lifetime is not specified, ban-time usually 60) is used. Setting the lifetime to 0 makes it a permanent ban.

Code: Select all

if {[matchattr $handle $bad(flags) $channel]} return
foreach realname [string tolower $bad(fullnames)] {
	if {[string match $realname [string tolower $fullname]]} {
		newchanban $channel $banmask $botnick $bad(reason) $bad(time)
		break
	}
}
I added a break so if a match has been found you don't need to proceed any further with trying to match the rest of banned real names with what the user has, cos he was already found using one he/she shouldn't and was banned for it.
Once the game is over, the king and the pawn go back in the same box.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

I believe caesar's corrections are logicals.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
Post Reply