/*
### ### ### ### ### ### ### ### ### ### ###
### ### ### ### ### ### ### ### ### ### ###
### ###
### "Protect Script" by genius_at_work ###
### ###
### ### ### ### ### ### ### ### ### ### ###
### ### ### ### ### ### ### ### ### ### ###
*/
alias protchan return [color:red]#channel_name[/color]
on *:START:protect.load
on *:CONNECT:.timer 1 20 protect.reset
on *:JOIN:$($protchan):protect.join $1-
on *:NICK:protect.nick $1-
on *:TEXT:*:$($protchan):protect.text $1-
on *:ACTION:*:$($protchan):protect.text $1-
on *:NOTICE:*:$($protchan):protect.text $1-
on *:PART:*:protect.part $nick
on *:KICK:*:protect.part $knick
on *:QUIT:protect.part $nick
alias protect.load {
echo 3 -st Startup: Loaded protection values
[color:blue]set %join.maxtotal 12
set %join.maxaddress 5
set %join.maxnick 3
set %nick.maxtotal 5
set %nick.maxaddress 3
set %nick.maxlength 20
set %text.maxrepeat 5
set %text.maxscroll 10
set %text.maxchars 1000
set %mass.maxscroll 30
set %mass.maxchars 3000
set %spec.maxchars 200
set %spec.maxcharsline 75
set %spam.lines 3
set %spam.regex /(http|\.com|\.net|\.org|\.php|\.html)/i
set %rant.length 200
set %prot.ignore [color:red]list,of,nicks,here[/color]
set %time.unban 8m
set %time.allclear 5m[/color]
if (*m iswm %time.unban) %time.unban = $calc($remove(%time.unban,m) * 60)
if (*m iswm %time.allclear) %time.allclear = $calc($remove(%time.allclear,m) * 60)
protect.reset
}
alias protect.reset {
if ($hget(protect)) hdel -w protect *
}
alias protect.send {
[color:green]notice $+(@,$protchan) $1-[/color]
}
alias protect.join {
if ($prot.ignore($nick)) return
if ($nick isop $protchan) return
if ($nick == $me) return
if ($me !isop $protchan) { .msg chanserv op $protchan $me | return }
if (!%protect.en) return
if (!$hget(protect)) hmake protect 5
var %address = $address($nick,2)
if ($hget(protect,$+(spam~,$nick)) == $null) hadd -u300 protect $+(spam~,$nick) %spam.lines
hinc -u10 protect join.~
if ($hget(protect,join.~) > %join.maxtotal) {
if (!$hget(protect,join.wait.~)) {
Protect.Send Mass Join Flood Detected
lockdown
if (%time.allclear > 0) .timer 1 %time.allclear allclear
hadd -u8 protect join.wait.~ 1
}
}
hinc -u10 protect $+(join.a.,%address)
if ($hget(protect,$+(join.a.,%address)) > %join.maxaddress) {
if (!$hget(protect,$+(join.wait.,%address))) {
Protect.Send Join Flood Detected from %address
mode $protchan +b %address
if (%time.unban > 0) $+(.timer.unban.,%address) 1 %time.unban mode $protchan -b %address
hadd -u8 protect $+(join.wait.,%address) 1
}
}
hinc -u15 protect $+(join.,$nick)
if ($hget(protect,$+(join.,$nick)) > %join.maxnick) {
if (!$hget(protect,$+(join.wait.,$nick))) {
Protect.Send Join Flood Detected from $nick ( $+ %address $+ )
mode $protchan +b %address
if (%time.unban > 0) $+(.timer.unban.,%address) 1 %time.unban mode $protchan -b %address
hadd -u8 protect $+(join.wait.,$nick) 1
}
}
if ($len($nick) > %nick.maxlength) {
Protect.Send Excessive Nick Length from $nick ( $+ %address $+ )
mode $protchan +b $+($nick,!*@*)
kick $protchan $nick Excessive Nickname Length. Max: %nick.maxlength
if (%time.unban > 0) $+(.timer.unban.nick.,$nick) 1 %time.unban mode $protchan -b $+($nick,!*@*)
}
}
alias protect.part {
;*** $1=nick
if ($1 == $me) return
if (!%protect.en) return
if ($hget(protect,$+(spam~,$1)) != $null) hdel protect $+(spam~,$1)
}
alias protect.nick {
if ($prot.ignore($nick)) return
if ($nick isop $protchan) return
if ($nick == $me) return
if ($me !isop $protchan) { .msg chanserv op $protchan $me | return }
if (!%protect.en) return
if (!$hget(protect)) hmake protect 5
hinc -u5 protect nick.~
if ($hget(protect,nick.~) > %nick.maxtotal) {
if (!$hget(protect,nick.wait.~)) {
Protect.Send Mass Nick Change Flood Detected
lockdown
if (%time.allclear > 0) .timer 1 %time.allclear allclear
hadd -u5 protect nick.wait.~ 1
}
}
var %address = $address($newnick,2)
hinc -u8 protect $+(nick.a.,%address)
if ($hget(protect,$+(nick.a.,%address)) > %nick.maxaddress) {
if (!$hget(protect,$+(nick.wait.,%address))) {
Protect.Send Nick Change Flood Detected from %address
mode $protchan +b %address
if (%time.unban > 0) $+(.timer.unban.,%address) 1 %time.unban mode $protchan -b %address
hadd -u5 protect $+(nick.wait.,%address) 1
}
}
if ($len($newnick) > %nick.maxlength) {
Protect.Send Excessive Nick Length from $newnick ( $+ %address $+ )
mode $protchan +b $+($newnick,!*@*)
kick $protchan $newnick Excessive Nickname Length. Max: %nick.maxlength
if (%time.unban > 0) $+(.timer.unban.nick.,$newnick) 1 %time.unban mode $protchan -b $+($newnick,!*@*)
}
}
alias protect.text {
if ($prot.ignore($nick)) return
if ($nick isop $protchan) return
if ($nick == $me) return
if ($me !isop $protchan) { .msg chanserv op $protchan $me | return }
if (!%protect.en) return
if (!$hget(protect)) hmake protect 5
var %address = $address($nick,2)
var %jsaddress = $address($nick,2)
if (%jsaddress == $null) %jsaddress = $nick $+ !*@*
if ($hget(protect,$+(spam~,$nick)) > 0) {
if ((%spam.regex != $null) && ($regex(js,$1-,%spam.regex))) {
mode $chan +b %jsaddress
set -u10 %prot.kicked 1
kick $chan $nick Spamming is not allowed on $protchan
}
elseif ((%rant.length > 0) && ($len($1-) > %rant.length)) {
mode $chan +b %jsaddress
set -u10 %prot.kicked 1
kick $chan $nick Ranting is not allowed on $protchan
$+(.timer.rant.,$nick) 1 300 mode $chan -b %js.address
}
else {
hdec -u300 protect $+(spam~,$nick) 1
}
}
if ($hget(protect,$+(spam~,$nick)) <= 0) {
hdel protect $+(spam~,$nick)
}
var %last.time = $hget(protect,text.time.~)
if (!%last.time) {
hadd -u5 protect text.time.~ 1
hadd -u5 protect text.lines.~ 0
hadd -u5 protect text.chars.~ 0
}
else {
hinc -u5 protect text.lines.~
hinc -u5 protect text.chars.~ $len($1-)
}
var %mass.lines = $hget(protect,text.lines.~)
var %mass.chars = $hget(protect,text.chars.~)
var %mreason
if (%mass.lines > %mass.maxscroll) %mreason = Text Scroll
elseif (%mass.chars > %mass.maxchars) %mreason = Text Flood
if (%mreason != $null) {
if (!$hget(protect,text.waits.~)) {
Protect.Send Mass %mreason Detected
lockdown
if (%time.allclear > 0) .timer 1 %time.allclear allclear
hadd -u3 protect text.waits.~ 1
}
}
;###
var %last.said = $hget(protect,$+(text.said.,$nick))
if ($1- != %last.said) {
hadd -u5 protect $+(text.said.,$nick) $1-
hadd -u5 protect $+(text.reps.,$nick) 1
}
else {
hadd -u5 protect $+(text.said.,$nick) $1-
hinc -u5 protect $+(text.reps.,$nick)
}
var %last.time = $hget(protect,$+(text.time.,$nick))
if (!%last.time) {
hadd -u5 protect $+(text.time.,$nick) 1
hadd -u5 protect $+(text.lines.,$nick) 1
hadd -u5 protect $+(text.chars.,$nick) $len($1-)
hadd -u5 protect $+(spec.chars.,$nick) $count($1-,,,,)
}
else {
hinc -u5 protect $+(text.lines.,$nick)
hinc -u5 protect $+(text.chars.,$nick) $len($1-)
hinc -u5 protect $+(spec.chars.,$nick) $count($1-,,,,)
}
var %text.reps = $hget(protect,$+(text.reps.,$nick))
var %text.lines = $hget(protect,$+(text.lines.,$nick))
var %text.chars = $hget(protect,$+(text.chars.,$nick))
var %spec.chars = $hget(protect,$+(spec.chars.,$nick))
var %spec.charsline = $count($1-,,,,)
var %kreason
if (%text.reps > %text.maxrepeat) %kreason = Text Repeat
elseif (%text.lines > %text.maxscroll) %kreason = Text Scroll
elseif (%text.chars > %text.maxchars) %kreason = Text Flood
elseif (%spec.chars > %spec.maxchars) %kreason = Attribute Flood
elseif (%spec.charsline > %spec.maxcharsline) %kreason = Attribute Abuse
if (%kreason != $null) {
if (!$hget(protect,$+(text.waits.,$nick))) {
Protect.Send %kreason Detected from $nick ( $+ %address $+ )
hadd -u4 protect $+(text.waits.,$nick) 1
}
hinc -u180 protect $+(text.offs.,$nick)
var %text.offs = $hget(protect,$+(text.offs.,$nick))
if (%text.offs == 1) {
set -u10 %prot.kicked 1
kick $protchan $nick %kreason
}
if (%text.offs > 3) {
if (!$hget(protect,$+(text.waitb.,$nick))) {
mode $protchan +b %address
if (%time.unban > 0) $+(.timer.unban.,%address) 1 %time.unban mode $protchan -b %address
set -u10 %prot.kicked 1
.timer -m 1 200 kick $protchan $nick %kreason
hadd -u5 protect $+(text.waitb.,$nick) 1
}
}
if (%text.offs > 8) {
$+(.timer.unban.,%address) off
}
}
}
alias protect {
if (!$1) {
notice $nick Protection status: $iif(%protect.en,Enabled,Disabled)
notice $nick Syntax: /protect <on/off/reset/reload>
return
}
if ($1 == on) {
notice $nick Protection is now Enabled
%protect.en = $true
return
}
if ($1 == off) {
notice $nick Protection is now Disabled
%protect.en = $false
return
}
if ($1 == reset) {
notice $nick Protection has been reset
protect.reset
return
}
if ($1 == reload) {
notice $nick Protection settings have been reloaded
protect.load
return
}
}
alias -l lockdown {
var %chan = $protchan
if (%LD.chan == %chan) return
; Enabled -> (x && 1)
if ($me !isop %chan && 1) {
msg chanserv OP $protchan $me
return
}
set %LD.chan %chan
msg $protchan %chan has been placed in SECURE MODE
mode %chan +mitnRN
}
alias -l allclear {
var %chan = $protchan
if (%LD.chan != %chan) return
; Enabled -> (x && 1)
if ($me !isop %chan && 1) {
msg chanserv OP $protchan $me
return
}
msg $protchan %chan has been returned to NORMAL MODE
mode %chan -miRN
unset %LD.chan
}