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.

small modification to badrealname.tcl

Old posts that have not been replied to for several years.
Locked
s
saerd
Voice
Posts: 21
Joined: Wed Feb 11, 2004 12:33 pm

small modification to badrealname.tcl

Post by saerd »

hi all, i found on this forum this script to ban "bad realname" :D

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 :D

Code: Select all

# 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."
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

I wonder what your problem would be as it's just replacing one line.

Code: Select all

newchanban $chan "*!*@[lindex [split $arg] 3]" $::botnick $::badr(reason) $::badr(time)
to

Code: Select all

putserv "PRIVMSG chanserv :BAN $chan [lindex [split $arg] 0] $::badr(reason)
Or atleast my guess would be it should work
s
saerd
Voice
Posts: 21
Joined: Wed Feb 11, 2004 12:33 pm

Post by saerd »

no, he autoban himself..lol

[18:25:30] * ChanServ sets mode: +b *!*@xxxxxx.xxxxxxx.xxxxxxx
[18:25:30] * Eggdrop was kicked by ChanServ (Bye! (Eggdrop))

Why ?
s
saerd
Voice
Posts: 21
Joined: Wed Feb 11, 2004 12:33 pm

Post by saerd »

MeTroiD wrote:I wonder what your problem would be as it's just replacing one line.

Code: Select all

newchanban $chan "*!*@[lindex [split $arg] 3]" $::botnick $::badr(reason) $::badr(time)
to

Code: Select all

putserv "PRIVMSG chanserv :BAN $chan [lindex [split $arg] 0] $::badr(reason)
Or atleast my guess would be it should work
Now Work!!
But i used this code

Code: Select all

putserv "PRIVMSG chanserv :BAN $chan [lindex [split $arg] 1] $::badr(reason)
eheheh MANY THANKS!! Have a GOOOD DAYYY!! CIAO!!!!
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

because metroid made a mistake

change [lindex [split $arg] 0] to [lindex [split $arg] 3]
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Here's the latest version.. if anyone is interested.

Code: Select all

## ¤ 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.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

caesar wrote: Any feedbacks will be appreciated. :)
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
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

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.
==================================
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
Locked