IntelliBan — File Browser
IntelliBanv1.1b / IntelliBanv1.1b / intelliban11.mrc
intelliban11.mrc — 12.82 KB — Download this file
;IntelliBan v1.1b by Treekiller - http://tree.k1ller.info for more info
#ib on
alias IntelliBan {
if ($1 = -o) {
iboptions
halt
}
if ((!$1) || (!$2)) {
if (($active !ischan) || ($1 !ison $active)) {
echo $color(info text) -at * IntelliBan: incorrect syntax, correct syntax: /IntelliBan #channel nickname [kick message]
halt
}
}
if ($1 ison $active) {
var %ban-channel = $active
var %ban-nick = $1
if ($2) { var %ban-message = $2- }
}
else {
var %ban-channel = $1
var %ban-nick = $2
if ($3) { var %ban-message = $3- }
}
if (%ban-nick !ison %ban-channel) {
echo $color(info text) -at * IntelliBan: $+(,%ban-nick,) is not on %ban-channel
halt
}
if (!$address(%ban-nick,5)) {
set -u30 %ibhaltwho yes
echo $color(info text) -at * IntelliBan: fetching the address of $+(,%ban-nick,)
who %ban-channel
.timer 1 10 echo $color(info text) -at * Trying to IntelliBan $+(,%ban-nick,) again
.timer 1 10 IntelliBan %ban-channel %ban-nick %ban-message
halt
}
echo $color(info2 text) -at * IntelliBan: analyzing the address of $+(,%ban-nick,)
var %ban-full = $address(%ban-nick,5)
var %ban-identd = $gettok($gettok(%ban-full,1,64),2,33)
var %ban-address = $gettok(%ban-full,2,64)
if ($replace($remove(%ban-address,-),.,a) isalpha) {
echo $color(info2 text) -at * IntelliBan: it seems that $+(,%ban-nick,) is using a Vhost, therefor we ban the identity only (*!ident@*)
var %ban-todo = %ban-todo $+(*!,%ban-identd,@*)
}
if ($replace(%ban-address,.,1) isnum) {
echo $color(info2 text) -at * IntelliBan: the address of $+(,%ban-nick,) is an IP-adres (xxx.xxx.xxx.xxx), therefor we ban the identity and the IP (*!ident@xxx.xxx.xxx.*)
var %ban-todo = %ban-todo $address(%ban-nick,13)
}
if ($remove($replace(%ban-address,.,-),-) !isnum) {
echo $color(info2 text) -at * IntelliBan: the address of $+(,%ban-nick,) is a hostname (host.name.com), therefor we ban the hostname only (*!*@host.name.com)
var %ban-todo = %ban-todo $address(%ban-nick,2)
}
if (*dial* iswm $remove(%ban-address,-)) {
echo $color(info2 text) -at * IntelliBan: the address of $+(,%ban-nick,) doesn't seem to be static ("dial" is in the hostname), therefor we ban the domain and identity (*!ident@dialup??.host.name.com)
var %ban-todo = %ban-todo $address(%ban-nick,13)
}
if (*pool* iswm $remove(%ban-address,-)) {
echo $color(info2 text) -at * IntelliBan: the address of $+(,%ban-nick,) doesn't seem to be static ("pool" is in the hostname), therefor we ban the domain and identity (*!ident@dialup??.host.name.com)
var %ban-todo = %ban-todo $address(%ban-nick,13)
}
if ($count(%ban-address,.) == 1) {
echo $color(info2 text) -at * IntelliBan: the address of $+(,%ban-nick,) is a Vhost (vhost.com), therefor we ban the identity only (*!ident@*)
var %ban-todo = %ban-todo $+(*!,%ban-identd,@*)
}
var %loop = 1
var %totalbans = $ibl(%ban-channel,0)
while (%loop <= %totalbans) {
if ($+(*!*,%ban-identd,@,$gettok(%ban-address,1-2,46),.*) iswm $ibl(%ban-channel,%loop)) {
echo $color(ctcp text) -at * IntelliBan: seems $+(,%ban-nick,) is ban evading, setting an extra wide ban (*!*ident@XX.XX.*)
var %ban-todo = %ban-todo $+(*!*,%ban-identd,@,$gettok(%ban-address,1-2,46),.*)
}
if ($+(*!*,%ban-identd,@,*) iswm $ibl(%ban-channel,%loop)) {
echo $color(ctcp text) -at * IntelliBan: seems $+(,%ban-nick,) is ban evading (identd was already banned), setting an extra wide ban (*!*ident@*)
var %ban-todo = %ban-todo $+(*!*,%ban-identd,@*)
}
inc %loop
}
echo $color(info2 text) -at * IntelliBan: done, banning $+(,%ban-nick,) now
set -u15 %intelliban yes
mode %ban-channel $+(+,$str(b,$numtok(%ban-todo,32))) %ban-todo
if ($readini(ibconfig.ini,kick,kick) == always) {
kick %ban-channel %ban-nick $iif(%ban-message,%ban-message,$iif($readini(ibconfig.ini,kick,message),$readini(ibconfig.ini,kick,message),Powered by IntelliBan v1.1 - get it from 12http://tree.k1ller.info))
}
if (($readini(ibconfig.ini,kick,kick) == specified) && (%ban-message)) {
kick %ban-channel %ban-nick %ban-message
}
}
alias ib {
intelliban $1-
}
alias ib_clonekick {
var %clonematches = $ialchan($2,$1,0)
while (%clonematches) {
kick $chan $ialchan($2,$1,%clonematches).nick Matching02 $1 - Clonekick
dec %clonematches
}
}
#ib end
alias ibupdate {
var %x = 1
var %scripts = $script(0)
while (%x <= %scripts) {
if ($script(%x) = intelliban.mrc) {
echo $color(info text) -at * IntelliBan: unloaded $script(%x)
!unload -rs $script(%x)
}
if ($script(%x) = intelliban11.mrc) && ($gettok($read($script(%x),1),2,32) != v1.1b) {
echo $color(info text) -at * IntelliBan: unloaded $nopath($script(%x))
!unload -rs $script(%x)
}
inc %x
}
echo $color(info text) -at * IntelliBan: updated to $gettok($read($script,1),2,32)
}
alias iboptions {
dialog -m iboptions iboptions
}
dialog iboptions {
title "IntelliBan v1.1"
size -1 -1 210 133
option dbu
check "Enable Intelliban", 2, 10 10 50 10
box "Kick options", 1, 8 20 104 50
radio "Kick if kick message is supplied", 3, 10 28 85 10, group
radio "Always kick", 4, 10 37 85 10
button "Save", 5, 8 111 37 12, ok
edit "Enter your default kick message here", 6, 10 47 100 20, multi return
box "Clones", 7, 8 72 104 29
radio "Kick all clones", 8, 10 80 50 10, group
radio "Ignore clones", 9, 10 89 50 10
box "Banlist management", 10, 116 20 85 40
text "If banlist is full:", 11, 120 28 37 8
radio "Do nothing", 12, 120 37 50 10, group
radio "Unban", 13, 120 47 26 10
edit "", 14, 146 47 13 10, limit 2 center
text "ban(s)", 15, 162 49 16 8
box "Help", 16, 116 72 85 29
text "", 17, 120 80 76 20
}
on *:DIALOG:iboptions:sclick:2:{
if ($did($dname,$did).state = 1) {
did -e $dname 1,3,4,7,8,9,10,11,12,13,14,15
if ($readini(ibconfig.ini,kick,kick)) {
did -c $dname $iif($readini(ibconfig.ini,kick,kick) == always,4,3)
if ($readini(ibconfig.ini,kick,kick) != always) {
did -b $dname 6
}
}
if ($readini(ibconfig.ini,kick,message)) {
did -r $dname 6
did -a $dname 6 $readini(ibconfig.ini,kick,message)
}
if ($readini(ibconfig.ini,kick,clones)) {
did -c $dname $iif($readini(ibconfig.ini,kick,clones) == all,8,9)
}
if ($readini(ibconfig.ini,banmanagement,action)) {
did -c $dname $iif($readini(ibconfig.ini,banmanagement,action) == nothing,12,13)
did -r $dname 14
did -a $dname 14 $iif($readini(ibconfig.ini,banmanagement,number),$readini(ibconfig.ini,banmanagement,number),5)
}
}
else {
did -b $dname 1,3,4,6,7,8,9,10,11,12,13,14,15
}
}
on *:DIALOG:iboptions:sclick:3:{
if ($did($dname,$did).state = 1) {
did -b $dname 6
}
}
on *:DIALOG:iboptions:sclick:4:{
if ($did($dname,$did).state = 1) {
did -e $dname 6
}
}
on 1:dialog:iboptions:mouse:*: {
if ($did == 5) { did -r $dname 17 | did -a $dname 17 Save settings and close dialog | halt }
if ($mouse.x isnum 1-3) && ($mouse.y isnum 1-3) { did -r $dname 17 | did -a $dname 17 test }
if ($mouse.x isnum 20-115) && ($mouse.y isnum 23-35) { did -r $dname 17 | did -a $dname 17 Enables or disables Intelliban | halt }
if ($mouse.x isnum 21-178) && ($mouse.y isnum 60-70) { did -r $dname 17 | did -a $dname 17 Only kick the user if you specify a kickmessage in the /intelliban command | halt }
if ($mouse.x isnum 20-155) && ($mouse.y isnum 78-88) { did -r $dname 17 | did -a $dname 17 Always kick the user; if no kickmessage is supplied, use the default kickmessage | halt }
if ($mouse.x isnum 22-216) && ($mouse.y isnum 100-127) { did -r $dname 17 | did -a $dname 17 Enter your default kick message here | halt }
if ($mouse.x isnum 20-100) && ($mouse.y isnum 164-174) { did -r $dname 17 | did -a $dname 17 Kick all clones which match the ban | halt }
if ($mouse.x isnum 20-112) && ($mouse.y isnum 182-192) { did -r $dname 17 | did -a $dname 17 Only kick the nick which you're banning | halt }
if ($mouse.x isnum 240-307) && ($mouse.y isnum 77-87) { did -r $dname 17 | did -a $dname 17 Intelliban won't ban the user, but will still kick (if enabled) | halt }
if ($mouse.x isnum 240-285) && ($mouse.y isnum 96-108) { did -r $dname 17 | did -a $dname 17 Intelliban unbans the specified number of bans (oldest first) | halt }
if ($mouse.x isnum 294-315) && ($mouse.y isnum 93-114) { did -r $dname 17 | did -a $dname 17 Number of bans to unban | halt }
did -r $dname 17
}
on *:DIALOG:iboptions:init:0:{
if (!$exists(ibconfig.ini)) {
did -b $dname 1,3,4,6,7,8,9,10,11,12,13,14,15
did -a $dname 17 No config file found
.disable #ib
halt
}
if ($readini(ibconfig.ini,general,version) != 1.1) {
did -a $dname 17 Old config file found, converting config file to v1.1
writeini ibconfig.ini general version 1.1
if ($readini(ibconfig.ini,ib,enable)) {
writeini ibconfig.ini general status $iif($readini(ibconfig.ini,ib,enable) == yes,enabled,disabled)
remini ibconfig.ini ib
}
if ($readini(ibconfig.ini,kick,dokick)) {
writeini ibconfig.ini kick kick $iif($readini(ibconfig.ini,kick,dokick) == no,specified,always)
remini ibconfig.ini kick dokick
}
if ($readini(ibconfig.ini,kick,custom)) {
remini ibconfig.ini kick custom
}
writeini ibconfig.ini kick clones ignore
writeini ibconfig.ini banmanagement action nothing
writeini ibconfig.ini banmanagement number 3
}
if ($readini(ibconfig.ini,general,status) == disabled) {
did -b $dname 1,3,4,6,7,8,9,10,11,12,13,14,15
did -a $dname 17 Config file loaded
halt
}
if ($readini(ibconfig.ini,general,status) == enabled) {
did -c $dname 2
}
if ($readini(ibconfig.ini,kick,kick)) {
did -c $dname $iif($readini(ibconfig.ini,kick,kick) == always,4,3)
if ($readini(ibconfig.ini,kick,kick) != always) {
did -b $dname 6
}
}
if ($readini(ibconfig.ini,kick,message)) {
did -r $dname 6
did -a $dname 6 $readini(ibconfig.ini,kick,message)
}
if ($readini(ibconfig.ini,kick,clones)) {
did -c $dname $iif($readini(ibconfig.ini,kick,clones) == all,8,9)
}
if ($readini(ibconfig.ini,banmanagement,action)) {
did -c $dname $iif($readini(ibconfig.ini,banmanagement,action) == nothing,12,13)
did -r $dname 14
did -a $dname 14 $iif($readini(ibconfig.ini,banmanagement,number),$readini(ibconfig.ini,banmanagement,number),5)
}
did -a $dname 17 Config file loaded
}
on *:DIALOG:iboptions:sclick:5:{
writeini ibconfig.ini general status $iif($did($dname,2).state = 1,enabled,disabled)
if ($readini(ibconfig.ini,general,status) == enabled) {
.enable #ib
writeini ibconfig.ini kick kick $iif($did($dname,4).state = 1,always,$iif($did($dname,3).state = 1,specified,unknown))
if ($did($dname,6).edited) { writeini ibconfig.ini kick message $iif($did($dname,6).text,$did($dname,6).text,Powered by IntelliBan v1.1 - get it from 12http://tree.k1ller.info) }
writeini ibconfig.ini kick clones $iif($did($dname,8).state = 1,all,$iif($did($dname,9).state = 1,ignore,unknown))
writeini ibconfig.ini banmanagement action $iif($did($dname,12).state = 1,nothing,$iif($did($dname,13).state = 1,unban,unknown))
if ($did($dname,14).text) { writeini ibconfig.ini banmanagement number $did($dname,14).text }
}
if ($readini(ibconfig.ini,general,status) == disabled) {
.disable #ib
}
}
on @*:BAN:#:{
if (%intelliban) && ($nick == $me) && ($readini(ibconfig.ini,kick,clones) == all) {
if (!$chan($chan).ial) {
echo $color(info text) -at * IntelliBan: can't check for clones, since the IAL of $chan isn't updated. Updating and checking again..
set -u15 %ibhaltwho yes
.who $chan
.timer 1 15 ib_clonekick $chan $banmask
}
var %clonematches = $ialchan($banmask,$chan,0)
while (%clonematches) {
kick $chan $ialchan($banmask,$chan,%clonematches).nick Matching02 $banmask - Clonekick
dec %clonematches
}
}
unset %intelliban
}
raw 478:*:{
if (!%unbanning) && ($readini(ibconfig.ini,banmanagement,action) == unban) {
var %y = $iif($readini(ibconfig.ini,banmanagement,number),$readini(ibconfig.ini,banmanagement,number),$modespl)
var %total = $ibl($2,0)
while (%y) {
var %temp = %temp $ibl($2,$calc($ibl($2,0) - %y))
dec %y
}
mode $2 $+(-,$str(b,$modespl)) %temp
set -u5 %unbanning yes
}
mode $2 +b $3
haltdef
}
raw 352:*:{
if (%ibhaltwho) { haltdef }
}
raw 315:*:{
if (%ibhaltwho) {
haltdef
unset %ibhaltwho
}
}
ctcp *:version:*:{
.ctcpreply $nick VERSION IntelliBan v1.1b - by Treekiller (get IntelliBan at http://tree.k1ller.info)
}