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.

Add ban after 1-2 kicks?

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
D
DJmart
Voice
Posts: 21
Joined: Wed Mar 08, 2006 8:32 pm

Add ban after 1-2 kicks?

Post by DJmart »

Code: Select all

####################################################################
#                                                                  #
# Based on BadWord.tcl by TheGhost and/or Rajeh Alharithi          #
#                                                                  #
# Stripped out most of the original, for basic kick on 'bad' words #
#                                                                  #
#                                                                  #
#                                        Cobratek                  #
####################################################################

## The bad word list
bind pubm - "!list" badword
bind pub - "!list" badword
bind pubm - "@find" badword
bind pub - "@find" badword
bind pub - "!find" badword
bind pubm - "!find" badword



## Main script

proc badword {nick uhost hand chan rest} {
  global botnick bword
    if {([ matchattr $hand f ])} {
      	putserv "PRIVMSG $chan : $nick  >:-| "

        return 1
	} else { 
        putserv "KICK $chan $nick : There are NO files here, and this is not a warez server."
        return 0
	}
}
putlog "!list kicker v0.1 loaded"

How do I add a "ban" after either 1 or two kicks for the same offence? and Time it?

Thanks fellas.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

That script seems rather buggy/crap in many ways, obv. made by some newbie by the looks of it.

Try this:

Code: Select all

set badwords(chans) "#chan1 #chan2"
set badwords(excempt) "f|f"
set badwords(words) {
  "!find"
  "@find"
  "!list"
  "@list"
}
set badwords(banon) "2"; # 1 = on first instance, 2 = on second instance etc
set badwords(bantime) "2"; # in minutes
set badwords(kickmsg) "Badword found!"

bind pubm - {*} pub:badwords

proc pub:badwords {nick host hand chan text} {
  global badwords
  if {[lsearch -exact "$badwords(chans)" $chan] == -1} { return }
  if {[matchattr $hand $badwords(excempt) $chan]} { return }
  set bword 0
  foreach word $text {
    if {$word == ""} { return }
    if {[lsearch -exact "$badwords(words)" $word] != -1} {
      set bword 1
      break
    }
  }
  if {$bword} {
    if {![info exists badwords($chan:$host)]} {   
      set badwords($chan:$host) "1"
    } else {
      incr badwords($chan:$host) 1
    }
    if {$badwords($chan:$host) >= $badwords(banon)} {
      putserv "MODE $chan +b $host"
      putserv "KICK $chan $nick :$badwords(kickmsg)"
      newchanban $chan $host $nick "$badwords(kickmsg)" $badwords(bantime)
      utimer [expr {$badwords(bantime)*60}] [list unset badwords($chan:$host)]
    } else {
      putserv "KICK $chan $nick :$badwords(kickmsg)"
    }
  }
}
NOT TESTED!!
r0t3n @ #r0t3n @ Quakenet
D
DJmart
Voice
Posts: 21
Joined: Wed Mar 08, 2006 8:32 pm

Post by DJmart »

It works, but the ban is incorrect. The user can rejoin...

Code: Select all

[11:03am] * ExCuRSion sets mode: +b *!DJmart@elite-FF83EB81.dyn.optonline.net
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

After the line:

Code: Select all

if {$badwords($chan:$host) >= $badwords(banon)} {
Put:

Code: Select all

set host *!*@[lindex [split $host @] 1]
It will then ban *!*@some.host.com
r0t3n @ #r0t3n @ Quakenet
D
DJmart
Voice
Posts: 21
Joined: Wed Mar 08, 2006 8:32 pm

Post by DJmart »

Code: Select all

[12:32pm] * Xeon sets mode: +o ExCuRSion
[12:32pm] * ExCuRSion sets mode: +b *!*@elite-FF83EB81.dyn.optonline.net
[12:32pm] * You were kicked by ExCuRSion (Banned: Badword found!)
[12:32pm] * Attempting to rejoin channel #phatlogic
[12:32pm] * Now talking in #phatlogic
Oh no!

Its still not working correctly... any idea?

Its not banning the correct host/IP
D
DJmart
Voice
Posts: 21
Joined: Wed Mar 08, 2006 8:32 pm

Post by DJmart »

i realized the "split" is incorrect. it says "elite" insted of "irc"

not sure how to fix that either :D
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

It will ban *!ident@host.com if the host has phatlogic.com in it, else it will ban *!ident@*.rest.of.host.com

EDIT: Fixed banmask to actually ban *!ident@*.rest.of.host.com

Code: Select all

set badwords(chans) "#chan1 #chan2"
set badwords(excempt) "f|f"
set badwords(words) {
  "!find"
  "@find"
  "!list"
  "@list"
}
set badwords(banon) "2"; # 1 = on first instance, 2 = on second instance etc
set badwords(bantime) "2"; # in minutes
set badwords(kickmsg) "Badword found!"

bind pubm - {*} pub:badwords

proc pub:badwords {nick host hand chan text} {
  global badwords
  if {[lsearch -exact "$badwords(chans)" $chan] == -1} { return }
  if {[matchattr $hand $badwords(excempt) $chan]} { return }
  set bword 0
  foreach word $text {
    if {$word == ""} { return }
    if {[lsearch -exact "$badwords(words)" $word] != -1} {
      set bword 1
      break
    }
  }
  if {$bword} {
    if {![info exists badwords($chan:$host)]} {   
      set badwords($chan:$host) "1"
    } else {
      incr badwords($chan:$host) 1
    }
    if {$badwords($chan:$host) >= $badwords(banon)} {
      if {[string match -nocase *phatlogic.com $host]} {
        set host *!$host
      } else {
        set host [lindex [split $host @] 0]@*.[join [lrange [split [lindex [split $host @] 1] .] end-[expr [llength [split [lindex [split $host @] 1] .]] - 2] end] .]
      }
      putserv "MODE $chan +b $host"
      putserv "KICK $chan $nick :$badwords(kickmsg)"
      newchanban $chan $host $nick "$badwords(kickmsg)" $badwords(bantime)
      utimer [expr {$badwords(bantime)*60}] [list unset badwords($chan:$host)]
    } else {
      putserv "KICK $chan $nick :$badwords(kickmsg)"
    }
  }
}
r0t3n @ #r0t3n @ Quakenet
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Eggdrop doesn't invent host names. If it's banning the wrong host, the irc server must be lying to it.
.jump to a better network.
Have you ever read "The Manual"?
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

User:

The irc network changes the host for 'privacy' and so the only option is to ban via ident or *!ident@*.end.of.host.com

Tosser@irc-C01B49CA.asfd.broadband.ntl.com -> Tosser@*.asfd.broadband.ntl.com
r0t3n @ #r0t3n @ Quakenet
D
DJmart
Voice
Posts: 21
Joined: Wed Mar 08, 2006 8:32 pm

Post by DJmart »

Its working correctly with the bans but I see this in the status window when the ban is to expire:

Code: Select all

[10:45am] <ExCuRSion> [10:45] Tcl error in script for 'timer1286':
[10:45am] <ExCuRSion> [10:45] can't unset "badwords(#phatlogic:DJmart@*.dyn.optonline.net)": no such element in array
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Use:

Code: Select all

set badwords(chans) "#chan1 #chan2"
set badwords(excempt) "f|f"
set badwords(words) {
  "!find"
  "@find"
  "!list"
  "@list"
}
set badwords(banon) "2"; # 1 = on first instance, 2 = on second instance etc
set badwords(bantime) "2"; # in minutes
set badwords(kickmsg) "Badword found!"

bind pubm - {*} pub:badwords

proc pub:badwords {nick host hand chan text} {
  global badwords
  if {[lsearch -exact "$badwords(chans)" $chan] == -1} { return }
  if {[matchattr $hand $badwords(excempt) $chan]} { return }
  set bword 0
  foreach word $text {
    if {$word == ""} { return }
    if {[lsearch -exact "$badwords(words)" $word] != -1} {
      set bword 1
      break
    }
  }
  if {$bword} {
    if {![info exists badwords($chan:$host)]} {   
      set badwords($chan:$host) "1"
    } else {
      incr badwords($chan:$host) 1
    }
    if {$badwords($chan:$host) >= $badwords(banon)} {
      utimer [expr {$badwords(bantime)*60}] [list unset badwords($chan:$host)]
      if {[string match -nocase *phatlogic.com $host]} {
        set host *!$host
      } else {
        set host [lindex [split $host @] 0]@*.[join [lrange [split [lindex [split $host @] 1] .] end-[expr [llength [split [lindex [split $host @] 1] .]] - 2] end] .]
      }
      putserv "MODE $chan +b $host"
      putserv "KICK $chan $nick :$badwords(kickmsg)"
      newchanban $chan $host $nick "$badwords(kickmsg)" $badwords(bantime)
    } else {
      putserv "KICK $chan $nick :$badwords(kickmsg)"
    }
  }
}
r0t3n @ #r0t3n @ Quakenet
Post Reply