Code: Select all
set exchost {
"*.irccloud.com"
}
set threshold 5
bind nick - * nick:check_drone
proc nick:check_drone {nick uhost hand chan newnick} {
check_drone $newnick $uhost $hand $chan
}
bind join - * check_drone
proc check_drone {nick uhost hand chan} {
global exchost
if {[isbotnick $nick]} return
if {([regexp {^guest.+[0-9]{4}$} [string tolower $nick]])} { return }
foreach phx $exchost { if {[string match -nocase $phx $uhost]} { return 0 } }
if [matchattr $hand of|of $chan] return
putserv "privmsg $chan :[sb:score $nick] - $nick"
if {[sb:score $nick] >= $::threshold} {
set chost [getchanhost $nick $chan]
set bmask [maskhost "$nick!$chost" 2]
pushmode $chan +b $bmask
}
}
proc sb:score {str} {
set score 0
set vowel "aeiouyxq"
set other "{}\\\[\\\]-_^`|\\\\"
set digit "0123456789"
set caps "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set str [string tolower $str]
incr score [llength [regexp -all -inline \[$caps\]{2,} $str]]
incr score [llength [regexp -all -inline \[$vowel\]{2,} $str]]
incr score [llength [regexp -all -inline \[$other\]{2,} $str]]
incr score [llength [regexp -all -inline \[$digit\]{2,} $str]]
incr score [llength [regexp -all -inline \[$caps$digit\]{2,} $str]]
incr score [llength [regexp -all -inline \[$caps$other\]{2,} $str]]
incr score [llength [regexp -all -inline \[$vowel$other\]{2,} $str]]
incr score [llength [regexp -all -inline \[$caps$other\]{2,} $str]]
incr score [llength [regexp -all -inline \[$vowel$digit\]{2,} $str]]
incr score [llength [regexp -all -inline \[$caps$digit\]{2,} $str]]
incr score [llength [regexp -all -inline \[$other$digit\]{2,} $str]]
# incr score $score
}
Code: Select all
foreach phx $exchost { if {[string match -nocase $phx $uhost]} { return 0 } }
Code: Select all
if [matchattr $hand of|of $chan] return
Code: Select all
set chost [getchanhost $nick $chan]
set bmask [maskhost "$nick!$chost" 2]
Code: Select all
proc check {ustring} {
set score 0
if { [string length $ustring]<3 } { return 0 }
set digits [llength [regexp -all -inline -- {[0-9]} $ustring]]
set consonants [llength [regexp -all -inline -nocase -- {[bcdfghjklmnpqrstvwxz]} $ustring]]
set vowels [llength [regexp -all -inline -nocase -- {[aeiuoy]} $ustring]]
set others [llength [regexp -all -inline -- {[\{\}\[\]\-\_\^\`\|\\]} $ustring]]
set caps [llength [regexp -all -inline -- {[A-Z]} $ustring]]
if {$digits >= 5 } { incr score $digits }
if {$consonants >= 4} { incr score $consonants }
if {$vowels >= 4} { incr score $vowels }
if {$others >= 5 } { incr score $others }
if {$caps >= 5 } { incr score $caps }
putlog "DBG : $digits digits, $consonants consonants, $vowels vowels, $others others, $caps caps"
set two [string range $ustring 0 1]
if {[info exists ::antirand::triple($two)]} {
foreach l [split [string range $ustring 2 end] {}] {
if {[string first $l $::antirand::triple($two)]!=-1} { incr score }
}
}
return $score
}