All pastes #373809 Raw Edit

Miscellany

public text v1 · immutable
#373809 ·published 2007-02-27 00:49 UTC
rendered paste body
array set fxp_bannedips {
NGZ             "213.202.0.0 2"
LeaseWeb        "83.149.0.0 2"
NA              "195.56.151.100 4"
}

set fxp_excluded_ips ""
set fxp_excluded_users "crusher Zero-X"

################################################################################
proc wstools:prebind {event command} { global precommand
 if {[info exists precommand($event)]} {
  if {[lsearch $precommand($event) $command] == -1} { set precommand($event) [linsert $precommand($event) 0 $command] }
 } else { set precommand($event) [list $command] }
}
wstools:prebind "SYSOP" "wstools:pre:sysop"
################

proc wstools:pre:sysop {event section line} {
 global glroot staffchan fxp_bannedips fxp_excluded_users fxp_excluded_ips
 set text [join $line " "]
 if {[string match "*foreign*" $text]} {
  set user [string map {"\'" ""} [lindex $text 0]]
  if {[string match "*$user*" $fxp_excluded_users]} {return 0}
  set transmode [lindex $text 2]
  set fxpip [lindex $text 7]
  set fxpblocks [split $fxpip "."]
  foreach ban_entry [array names fxp_bannedips] {
   set banblocks [split [lindex $fxp_bannedips($ban_entry) 0] "."]
   set checkcount [lindex $fxp_bannedips($ban_entry) 1]
   if {[string match "*$fxpip*" $fxp_excluded_ips]} {set denied 0} else {set denied 1}
   for {set count 0} {$count<$checkcount} {incr count} {
    if {[lindex $banblocks $count] != [lindex $fxpblocks $count] && $denied==1} {set denied 0}
   }
   if {$denied==1} {
    exec $glroot/bin/zx-sitekick.sh $user &
    putserv "PRIVMSG $staffchan :( \002SYSOP\002 )-( \002\00304FXP BANNED\003\002 )-( User: \002$user\002 )-( Mode: \002$transmode\002 )-( Provider/Site: \002$ban_entry\002 )"
   }
  }
  return 0
 } else {
  return 1
 }
}

putlog ":: fxp-chegg0r v0.2b by Zero-X loaded"