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 

Ban certain Realnames

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Thu Sep 15, 2016 1:24 pm    Post subject: Ban certain Realnames Reply with quote

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 Smile
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Thu Sep 15, 2016 2:32 pm    Post subject: Re: Ban certain Realnames Reply with quote

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?t=9721&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 !
Back to top
View user's profile Send private message
BLaCkShaDoW
Op


Joined: 11 Jan 2009
Posts: 115
Location: Romania

PostPosted: Sun Sep 18, 2016 12:13 pm    Post subject: badrealname Reply with quote

try this one

http://www.egghelp.org/cgi-bin/tcl_archive.tcl?mode=download&id=1574
_________________
BLaCkShaDoW Production @ WwW.TclScripts.Net
Back to top
View user's profile Send private message Send e-mail Visit poster's website
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Mon Sep 19, 2016 12:15 am    Post subject: Re: badrealname Reply with quote

BLaCkShaDoW wrote:
try this one

http://www.egghelp.org/cgi-bin/tcl_archive.tcl?mode=download&id=1574


Why not work?
I activated the script for the party line
Code:
.chanset #mychanel +badfullname

Quote:
channel set #mychanel +udef-flag-badfullname

Tcl error [badrealname]: can not find channel named "#mychanel"
Code:
#######################################################################
#
# 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 Smile
Back to top
View user's profile Send private message
BLaCkShaDoW
Op


Joined: 11 Jan 2009
Posts: 115
Location: Romania

PostPosted: Mon Sep 19, 2016 2:10 am    Post subject: badrealname Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Mon Sep 19, 2016 9:38 am    Post subject: Re: badrealname Reply with quote

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 Smile
Back to top
View user's profile Send private message
BLaCkShaDoW
Op


Joined: 11 Jan 2009
Posts: 115
Location: Romania

PostPosted: Mon Sep 19, 2016 1:21 pm    Post subject: badrealname 1.2 Reply with quote

Code:
#######################################################################
#
# 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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Mon Sep 19, 2016 1:36 pm    Post subject: Reply with quote

Work perfectly! Very Happy

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 Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Sep 20, 2016 1:10 am    Post subject: Reply with quote

Code:

  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:

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.
Back to top
View user's profile Send private message
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Tue Sep 20, 2016 12:24 pm    Post subject: Reply with quote

hi caesar ..
the correct thing of that time as he would be a friend, with its suggestions for this tcl.
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Tue Sep 20, 2016 2:08 pm    Post subject: Reply with quote

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

Code:
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 Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Sep 21, 2016 12:49 am    Post subject: Reply with quote

Move the
Code:

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]
Quote:

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:

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.
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Wed Sep 21, 2016 12:58 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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