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.

Anti Control Code & Long Character on PUBLIC & NOTICE [Error

Old posts that have not been replied to for several years.
Locked
G
Guest

Post by Guest »

set chktsu 1

set chkltx 0

set tsu_maxchar 255

set ltx_maxchar 325

set tsu_hostallow {
"@dal.net"
}

set tsu_kmsgs {
"excess control codes"
}

set tsu_amsgs {
"too many control codes! lessen your use of control codes.."
}

set ltx_kmsgs {
"excessive long text"
}

set ltx_amsgs {
"You've phrased too much long characters.. decrease it please.."
}

set tsu_banop 0

set tsu_bantime 2

set tsu_ignoretime 1

set ltx_bantime 2

set ltx_ignoretime 1

set tsu_lockchan 1

set tsu_locktime 15

# This is for your benefit hehe :wink:, you can either set your own LOGO here, your logo will appear-
# when the bot notice you, or when it makes msgs/notices/kicks or scripts loading. So keep smiling-
# and set this variable as you wish :wink:, you can either set this to "" to leave it blank.
set pltxlg "[Bc]:"

proc bottsutrig {nick uhost hand rest} {
global botnick chktsu chkltx tsu_maxchar ltx_maxchar tsu_hostallow tsu_kmsgs tsu_amsgs ltx_kmsgs ltx_amsgs tsu_bantime tsu_ignoretime tsu_lockchan tsu_locktime ltx_bantime ltx_ignoretime pltxlg
if {[isbotnick $nick] || [matchattr $hand o]} {return 0}
foreach tallowhost [string tolower $tsu_hostallow] {if {[string match *$tallowhost* [string tolower $uhost]]} {return 0}}
if {[string match "#*" [lindex $rest 0]]} {set chan [lindex $rest 0] ; set tvictim $chan ; set rest [lrange $rest 1 end]} else {set chan "" ; set tvictim $botnick}
if {$chktsu} {
if {[string match ** $rest] || [string match ** $rest] || [string match ** $rest]} {
set tlength [string length $rest] ; set bcode 0 ; set ucode 0 ; set kcode 0
for {set i 0} {$i < $tlength} {incr i} {
if {[string index $rest $i] == ""} {incr bcode}
if {[string index $rest $i] == ""} {incr ucode}
if {[string index $rest $i] == ""} {incr kcode}
}
if {$bcode >= $tsu_maxchar/3 || $ucode >= $tsu_maxchar/3 || $kcode >= $tsu_maxchar/3} {
set banhost *!*@[lindex [split $uhost @] 1]
set tsu_reason "$pltxlg Control Codes Exceed (BC: $bcode - UC: $ucode - CC: $kcode) to $tvictim from: $nick."
set tsu_kmsg "4$pltxlg $nick: (BC: $bcode - UC: $ucode - CC: $kcode): [lindex $tsu_kmsgs [rand [llength $tsu_kmsgs]]]"
set tsu_amsg "$pltxlg $nick: (BC: $bcode - UC: $ucode - CC: $kcode): [lindex $tsu_amsgs [rand [llength $tsu_amsgs]]]"
dotsuban $nick $uhost $banhost $chan $tsu_reason $tsu_kmsg $tsu_amsg $tsu_bantime $tsu_ignoretime
putlog "$pltxlg Control Codes Exceed (BC: $bcode - UC: $ucode - CC: $kcode) to $tvictim from: $nick." ; return 0
}
}
}
if {$chkltx} {
if {[string length $rest] >= $ltx_maxchar} {
set banhost *!*@[lindex [split $uhost @] 1]
set ltx_reason "$pltxlg Long Text ([string length $rest]) to $tvictim from: $nick."
set ltx_kmsg "4$pltxlg $nick: [lindex $ltx_kmsgs [rand [llength $ltx_kmsgs]]]"
set ltx_amsg "$pltxlg $nick: ([string length $rest]): [lindex $ltx_amsgs [rand [llength $ltx_amsgs]]]"
dotsuban $nick $uhost $banhost $chan $ltx_reason $ltx_kmsg $ltx_amsg $ltx_bantime $ltx_ignoretime
putlog "$pltxlg Long Text ([string length $rest]) to $tvictim from: $nick." ; return 0
}
} ; return 0
}

proc dotsuban {nick uhost tbanhost tchan treason tkickmsg topmsg tbantime tignoretime} {
global botnick tsu_banop tsu_lockchan tsu_locktime pltxlg
if {$tchan != ""} {
if {[botisop $tchan]} {
if {[isop $nick $tchan]} {if {!$tsu_banop} {putquick "PRIVMSG $tchan :$topmsg" ; return 0}}
newignore $tbanhost $botnick $treason $tignoretime
putlog "$pltxlg Placing in Ignore on: $tbanhost for $tignoretime minute(s)."
if {$tsu_lockchan} {
putquick "MODE $tchan +mc" ; if {$tsu_locktime <= 0} {set tsu_locktime 5}
putlog "$pltxlg Activating Channel lock in channel: $tchan for $tsu_locktime sec(s)." ; utimer $tsu_locktime "utsulock $tchan"
}
newchanban $tchan $tbanhost $botnick $treason $tbantime
set lmembers [chanlist $tchan]
foreach tsumember $lmembers {
set lselectedhost [getchanhost $tsumember $tchan]
set tsubanhost *!*@[lindex [split $lselectedhost @] 1]
if {$tbanhost == $tsubanhost} {
if {[isop $tsumember $tchan]} {putquick "MODE $tchan -o+b $tsumember $tsumember!*@*"
} else {if {[isvoice $tsumember $tchan]} {putquick "MODE $tchan -v+b $tsumember $tsumember!*@*"} else {putquick "MODE $tchan +b $tsumember!*@*"}
} ; newchanban $tchan $tsumember!*@* $botnick $treason $tbantime ; putkick $tchan $tsumember $tkickmsg
}
}
} else {
newignore $tbanhost $botnick $treason $tignoretime
putlog "$pltxlg Placing in Ignore on: $tbanhost for $tignoretime minute(s). Reason: $treason."
}
} else {
newignore $tbanhost $botnick $treason $tignoretime
putlog "$pltxlg Placing in Ignore on: $tbanhost for $tignoretime minute(s). Reason: $treason."
} ; return 0
}

proc chntsutrig {nick uhost hand chan rest} {global botnick ; append chars "$chan $rest" ; bottsutrig $nick $uhost $hand $chars}

proc utsulock {tsu_chan} {
global botnick pltxlg
if {[validchan $tsu_chan]} {
if {[botisop $tsu_chan]} {
set tcurrmode [getchanmode $tsu_chan]
if {[string match "*m*" $tcurrmode] || [string match "*c*" $tcurrmode]} {putquick "MODE $tsu_chan -mc" ; putlog "$pltxlg Opening Channel lock on: $tsu_chan."}
}
} ; return 0
}

proc nottsutrig {from keyword arg} {
global botnick
set nick [lindex [split $from !] 0] ; set uhost [lindex [split $from !] 1]
if {[string match "*.*" $from]} {return 0} ; set chan ""
if {[string match "#*" [lindex $arg 0]]} {
# if {[string match "*@*" [lindex $arg 0]]} {set chan [lindex [split [string tolower [lindex $arg 0]] @] 1]}
set chan [lindex $arg 0] ; set rest [lrange $arg 1 end]
} else {set rest $arg}
if {$chan != ""} {append chars "$chan $rest"} else {set chars $rest}
bottsutrig $nick $uhost $uhost $chars ; return 0
}

set tsuprotloaded 1

if {[info exist tsuprotloaded]} {
if {${tsuprotloaded}} {
bind msgm - * bottsutrig
bind pubm - * chntsutrig
bind raw - NOTICE nottsutrig
} else {
unbind msgm - * bottsutrig
unbind pubm - * chntsutrig
unbind raw - NOTICE nottsutrig
}
putlog "*** ${pltxlg} Protection, Control Codes + Long Text Blocker. Loaded."
}


please help me with this tcl, it can't detect any notice flood with control code and can you make it so it can determine wether are there Long Text and Long Notice.
i would like to set the tsunami character into 50 each control code (b,c,u) and 300 characters for long text and 150 characters for long notice. thanks :smile:

Locked