Searching Gban Script

Do you have script in mind but no ability to make it, type in what it should do, and you might be lucky.

Searching Gban Script

Postby StareX » Sun Nov 22, 2009 10:18 am

Hello,

I'm searching a Global Ban script TCL that will global ban a user..

like:

$ban Jolet -global Sweet Ban

or like $gban add nick
commands like that..

like blacklist script

I mean i need a script that can ban a user forever....

like r0ten script:
[12:16:13] <@St4reX> Botnick ban *!*@Hostname.users.quakenet.org 0
[12:16:14] * Botnick sets mode: +b *!*@hostname.users.quakenet.org
[12:16:15] -botnick- Banmask (*!*@hostname.users.quakenet.org) added to my banlist (Expires: Never!).

Im searching on egghelp.org but i cant find.
Somebody can give me a script like that? something like that?

Thanks... :)
StareX
 

Re: Searching Gban Script

Postby ohwait » Fri Jan 01, 2010 11:06 pm

U could use a script from perpleXa:

Code: Select all
#  $Id: blacklist.tcl,v 0.3 2004/07/26 20:06:03 perpleXa Exp $  #
#                                                               #
#  Commands:                                                    #
#  $blackadd <mask> <reason>                                    #
#  $blackdel <mask|#id>                                         #
#  $blacklist                                                   #
#################################################################


set blacklist_file "scripts/dbase/blacklist"


bind PUB  m|- \$blacklist  blacklist:list
bind PUB  m|- \$blackadd   blacklist:add
bind PUB  m|- \$blackdel   blacklist:del
bind TIME -|- "0* * * * *" blacklist:sentry
bind JOIN -|- *            blacklist:join


proc blacklist:list {nickname hostname handle channel arguments} {
 global blacklist
  set entrys 0
  puthelp "NOTICE $nickname :Blacklist entrys"
  puthelp "NOTICE $nickname :Nr. Owner           Hostmask"
  foreach entry [array names blacklist] {
    incr entrys
    set owner [lindex $blacklist($entry) 0]
    while {[string length $owner] < 15} {
      set owner "$owner "
    }
    if {[string length $entrys] < 2} {
      set target "$entrys "
    } else {
      set target $entrys
    }
    puthelp "NOTICE $nickname :#$target $owner $entry"
  }
  puthelp "NOTICE $nickname :End of list."
}


proc blacklist:add {nickname hostname handle channel arguments} {
 global blacklist
  set arguments [blacklist:clean $arguments]
  set banmask [blacklist:validate:host [lindex $arguments 0]]
  if {([regexp -all -- {!} $banmask] > 1) || ([regexp -all -- {@} $banmask] > 1)} {
    puthelp "NOTICE $nickname :Sorry, couldn't add that hostmask."
    return
  }
  set owner $handle
  if {[regexp {^(\d{1,2}|[0-3][0-6][0-5])$} [lindex $arguments 1]]} {
   set expire [expr ([lindex $arguments 1] * 86400) + [unixtime]]
   set reason [join [lrange $arguments 2 end]]
  } else {
   set expire 0
   set reason [join [lrange $arguments 1 end]]
  }
  if {[llength $reason] >= 1} {
    if {![info exists blacklist($banmask)]} {
      set blacklist($banmask) "$owner $expire $reason"
      puthelp "NOTICE $nickname :Done. $banmask blacklisted successfully (reason: $reason)."
      blacklist:sentry
    } else {
      puthelp "NOTICE $nickname :Sorry, couldn't add that hostmask."
    }
  } else {
    puthelp "NOTICE $nickname :You forgot to type a blacklist reason."
  }
}


proc blacklist:del {nickname hostname handle channel arguments} {
 global blacklist
  set arguments [blacklist:clean $arguments]
  set banmask [lindex $arguments 0]
  set success 0
  if {[regexp {^#([0-9]+)$} $banmask tmp number]} {
    set item 0
    foreach entry [array names blacklist] {
      incr item
      if {$item == $number} {
        unset blacklist($entry)
        set success 1
      }
    }
  } else {
    if {[info exists blacklist($banmask)]} {
      unset blacklist($banmask)
      set success 1
    }
  }
  if {$success == 0} {
    puthelp "NOTICE $nickname :Couldn't delete the requested ban. Use \$blacklist to view them."
  } else {
    puthelp "NOTICE $nickname :Done."
  }
}


proc blacklist:sentry {{minute "0"} {hour "0"} {day "0"} {week "0"} {year "0"}} {
 global blacklist
  foreach channel [channels] {
    if {![botisop $channel]} {continue}
    foreach target [chanlist $channel] {
      set userhost [blacklist:weirdclean "$target![getchanhost $target]"]
      foreach entry [array names blacklist] {
        set expire [lindex $blacklist($entry) 1]
        if {$expire >= [unixtime] || ($expire == 0)} {
          set reason [lrange [blacklist:clean $blacklist($entry)] 2 end]
          set blackhost [blacklist:weirdclean $entry]
          if {[string match -nocase $blackhost $userhost]} {
            putquick "MODE $channel -o+b $target $entry"
            putquick "KICK $channel $target :[join $reason]"
          }
        } else {
          unset blacklist($entry)
        }
      }
    }
  }
  blacklist:save
}


proc blacklist:join {nickname hostname handle channel} {
 global blacklist
  if {![botisop $channel]} {return}
  set userhost [blacklist:weirdclean "$nickname![getchanhost $nickname]"]
  foreach entry [array names blacklist] {
    set reason [lrange [blacklist:clean $blacklist($entry)] 2 end]
    set blackhost [blacklist:weirdclean $entry]
    if {[string match -nocase $blackhost $userhost]} {
      putquick "MODE $channel -o+b $nickname $entry"
      putquick "KICK $channel $nickname :[join $reason]"
    }
  }
}


proc blacklist:validate:host {i} {
  regsub -all {\*+} $i {*} i
  array set ban {
    ident *
    host *
  }
  set ban(nick) $i
  if {[regexp -- {!} $i]} {
    regexp -- {^(.+?)!(.*?)(@(.*))?$} $i tmp ban(nick) ban(ident) tmp ban(host)
  } elseif {[regexp -- {@} $i]} {
    regexp -- {^(.+!)?(.*?)(@(.*))?$} $i tmp ban(nick) ban(ident) tmp ban(host)
  }
  foreach item [array names ban] {
    if {[string length $ban($item)] < 1} {
      set ban($item) *
    }
  }
  return $ban(nick)!$ban(ident)@$ban(host)
}


proc blacklist:load {} {
 global blacklist blacklist_file
  regexp {(\S+/)?} $blacklist_file tmp blacklist_dir
  if {$blacklist_dir != ""} {
    if {![file isdirectory $blacklist_dir]} {
      file mkdir $blacklist_dir
      putlog "Created directory: $blacklist_dir"
    }
  }
  if {![file exists $blacklist_file]} {
    array set blacklist {}
    return
  }
  if {[array exists blacklist]} {
    array unset blacklist
  }
  set file [open $blacklist_file r]
  while {![eof $file]} {
    gets $file line
    if {[regexp -- {(\S+)\s(\S+)\s(\S+)\s(.+)} $line tmp banmask owner expire reason]} {
      if {$expire >= [unixtime] || ($expire == 0)} {
        set blacklist($banmask) "$owner $expire $reason"
      }
    }
  }
  close $file
}


proc blacklist:save {} {
 global blacklist blacklist_file
  set file "[open $blacklist_file w]"
  foreach entry [array names blacklist] {
    puts $file "$entry $blacklist($entry)"
  }
  close $file
}


proc blacklist:weirdclean {i} {
  regsub -all -- \\\\ $i \001 i
  regsub -all -- \\\[ $i \002 i
  regsub -all -- \\\] $i \003 i
  regsub -all -- \\\} $i \004 i
  regsub -all -- \\\{ $i \005 i
  return $i
}


proc blacklist:clean {i} {
  regsub -all -- \\\\ $i \\\\\\\\ i
  regsub -all -- \\\[ $i \\\\\[ i
  regsub -all -- \\\] $i \\\\\] i
  regsub -all -- \\\} $i \\\\\} i
  regsub -all -- \\\{ $i \\\\\{ i
  regsub -all -- \\\" $i \\\\\" i
  return $i
}


blacklist:load
ohwait
 

Re: Searching Gban Script

Postby StareX » Thu Jan 21, 2010 4:31 pm

well thanks m8,
I'll try it out :)
StareX
 

Re: Searching Gban Script

Postby Razor » Thu Sep 30, 2010 5:41 am

Heya.

I need some help with this script please. It works fine, but I would like to add a timestamp on the kick message.

Here is the minor-change I made to the code :

Code: Select all
#  $Id: blacklist.tcl,v 0.3 2004/07/26 20:06:03 perpleXa Exp $  #

#                                                               #

#  Commands:                                                    #

#  $blackadd <mask> <reason>                                    #

#  $blackdel <mask|#id>                                         #

#  $blacklist                                                   #

#################################################################





set blacklist_file "scripts/dbase/blacklist"





bind PUB  o|o \$blacklist  blacklist:list

bind PUB  o|o \$blackadd   blacklist:add

bind PUB  o|o \$blackdel   blacklist:del

bind TIME -|- "0* * * * *" blacklist:sentry

bind JOIN -|- *            blacklist:join





proc blacklist:list {nickname hostname handle channel arguments} {

 global blacklist

  set entrys 0

  puthelp "NOTICE $nickname :Blacklist Entries:"

  puthelp "NOTICE $nickname :Num      Owner        Hostmask"

  foreach entry [array names blacklist] {

    incr entrys

    set owner [lindex $blacklist($entry) 0]

    while {[string length $owner] < 15} {

      set owner "$owner "

    }

    if {[string length $entrys] < 2} {

      set target "$entrys "

    } else {

      set target $entrys

    }

    puthelp "NOTICE $nickname :#$target $owner $entry"

  }

  puthelp "NOTICE $nickname :End of list."

}





proc blacklist:add {nickname hostname handle channel arguments} {

 global blacklist

  set arguments [blacklist:clean $arguments]

  set banmask [blacklist:validate:host [lindex $arguments 0]]

  if {([regexp -all -- {!} $banmask] > 1) || ([regexp -all -- {@} $banmask] > 1)} {

    puthelp "NOTICE $nickname :Sorry, couldn't add that hostmask."

    return

  }

  set owner $handle

  if {[regexp {^(\d{1,2}|[0-3][0-6][0-5])$} [lindex $arguments 1]]} {

   set expire [expr ([lindex $arguments 1] * 86400) + [unixtime]]

   set reason [join [lrange $arguments 2 end]]

  } else {

   set expire 0

   set reason [join [lrange $arguments 1 end]]

  }

  if {[llength $reason] >= 1} {

    if {![info exists blacklist($banmask)]} {

      set blacklist($banmask) "$owner $expire $reason"

      puthelp "NOTICE $nickname :Done. $banmask blacklisted successfully."

      blacklist:sentry

    } else {

      puthelp "NOTICE $nickname :Sorry, couldn't add that hostmask."

    }

  } else {

    puthelp "NOTICE $nickname :You forgot to type a blacklist reason."

  }

}





proc blacklist:del {nickname hostname handle channel arguments} {

 global blacklist

  set arguments [blacklist:clean $arguments]

  set banmask [lindex $arguments 0]

  set success 0

  if {[regexp {^#([0-9]+)$} $banmask tmp number]} {

    set item 0

    foreach entry [array names blacklist] {

      incr item

      if {$item == $number} {

        unset blacklist($entry)

        set success 1

      }

    }

  } else {

    if {[info exists blacklist($banmask)]} {

      unset blacklist($banmask)

      set success 1

    }

  }

  if {$success == 0} {

    puthelp "NOTICE $nickname :Couldn't delete the requested ban. Use \$blacklist to view them."

  } else {

    puthelp "NOTICE $nickname :Done."

  }

}





proc blacklist:sentry {{minute "0"} {hour "0"} {day "0"} {week "0"} {year "0"}} {

 global blacklist

  foreach channel [channels] {

    if {![botisop $channel]} {continue}

    foreach target [chanlist $channel] {

      set userhost [blacklist:weirdclean "$target![getchanhost $target]"]

      foreach entry [array names blacklist] {

        set expire [lindex $blacklist($entry) 1]

        if {$expire >= [unixtime] || ($expire == 0)} {

          set reason [lrange [blacklist:clean $blacklist($entry)] 2 end]

          set blackhost [blacklist:weirdclean $entry]

          if {[string match -nocase $blackhost $userhost]} {

            putquick "KICK $channel $target :[join $reason] (Set by $handle on [strftime %d/%m/%Y@%H:%M])"
            putquick "MODE $channel -o+b $target $entry"

          }

        } else {

          unset blacklist($entry)

        }

      }

    }

  }

  blacklist:save

}





proc blacklist:join {nickname hostname handle channel} {

 global blacklist

  if {![botisop $channel]} {return}

  set userhost [blacklist:weirdclean "$nickname![getchanhost $nickname]"]

  foreach entry [array names blacklist] {

    set reason [lrange [blacklist:clean $blacklist($entry)] 2 end]

    set blackhost [blacklist:weirdclean $entry]

    if {[string match -nocase $blackhost $userhost]} {

      putquick "KICK $channel $nickname :[join $reason] (Set by $handle on [strftime %d/%m/%Y@%H:%M])"
      putquick "MODE $channel -o+b $nickname $entry"

    }

  }

}





proc blacklist:validate:host {i} {

  regsub -all {\*+} $i {*} i

  array set ban {

    ident *

    host *

  }

  set ban(nick) $i

  if {[regexp -- {!} $i]} {

    regexp -- {^(.+?)!(.*?)(@(.*))?$} $i tmp ban(nick) ban(ident) tmp ban(host)

  } elseif {[regexp -- {@} $i]} {

    regexp -- {^(.+!)?(.*?)(@(.*))?$} $i tmp ban(nick) ban(ident) tmp ban(host)

  }

  foreach item [array names ban] {

    if {[string length $ban($item)] < 1} {

      set ban($item) *

    }

  }

  return $ban(nick)!$ban(ident)@$ban(host)

}





proc blacklist:load {} {

 global blacklist blacklist_file

  regexp {(\S+/)?} $blacklist_file tmp blacklist_dir

  if {$blacklist_dir != ""} {

    if {![file isdirectory $blacklist_dir]} {

      file mkdir $blacklist_dir

      putlog "Created directory: $blacklist_dir"

    }

  }

  if {![file exists $blacklist_file]} {

    array set blacklist {}

    return

  }

  if {[array exists blacklist]} {

    array unset blacklist

  }

  set file [open $blacklist_file r]

  while {![eof $file]} {

    gets $file line

    if {[regexp -- {(\S+)\s(\S+)\s(\S+)\s(.+)} $line tmp banmask owner expire reason]} {

      if {$expire >= [unixtime] || ($expire == 0)} {

        set blacklist($banmask) "$owner $expire $reason"

      }

    }

  }

  close $file

}





proc blacklist:save {} {

 global blacklist blacklist_file

  set file "[open $blacklist_file w]"

  foreach entry [array names blacklist] {

    puts $file "$entry $blacklist($entry)"

  }

  close $file

}





proc blacklist:weirdclean {i} {

  regsub -all -- \\\\ $i \001 i

  regsub -all -- \\\[ $i \002 i

  regsub -all -- \\\] $i \003 i

  regsub -all -- \\\} $i \004 i

  regsub -all -- \\\{ $i \005 i

  return $i

}





proc blacklist:clean {i} {

  regsub -all -- \\\\ $i \\\\\\\\ i

  regsub -all -- \\\[ $i \\\\\[ i

  regsub -all -- \\\] $i \\\\\] i

  regsub -all -- \\\} $i \\\\\} i

  regsub -all -- \\\{ $i \\\\\{ i

  regsub -all -- \\\" $i \\\\\" i

  return $i

}





blacklist:load



putlog "Script loaded: Blacklist :O by perpleXa"


I have tried changing:
putquick "KICK $channel $nickname :[join $reason] (Set by $handle on [strftime %d/%m/%Y@%H:%M])"

($handle = The Op's partyline nickname that set the blacklist-ban.)

But it is not working, even tried $hand, $nick etc. As I'm not handly with TCL, I would appreciate if someone could help me with this. Thank you.
Razor
 


Return to TCL Scripting Request

Who is online

Users browsing this forum: No registered users and 0 guests

cron