Tcl that make's the eggdrop ban the onjoin users that have the CTCP version reply as in the saved list or if no version received.
Enable it with : .chanset #channel +bversion
Enable it with : .chanset #channel +bversion
###############################################################################
#
#Enable it with .chanset #channel +bversion
#
#It will ban the users that have the CTCP version reply as in the list specified
#below
#
# BLaCkShaDoW Production
###############################################################################
###
#Set here the reason for bad Version
set bversion(ban_reason) "Your script isn't allowed here or no version reply."
###
#Set here the version forbidden
set bversion(forbidden) {
"KiwiIRC (0.9.4)"
}
###
#Set here except flags ("" for none)
set bversion(except_flags) "-|bm"
###
#Host bantype
#1 - *!*@$host
#2 - *!$ident@$host
#3 - $user!$ident@$host
#4 - $user!*@*
#5 - *!$ident@*
set bversion(user_ban_type) "1"
###
#How much time for the eggdrop to wait for a VERSION reply, if not receive
#it will ban the user. (seconds) (0 to disable)
set bversion(wait_time) "10"
###############################################################################
setudef flag bversion
bind ctcr - VERSION bversion:reply
bind join - * bversion:join
###
proc bversion:join {nick host hand chan} {
global bversion
if {![channel get $chan bversion]} {
return
}
if {[isbotnick $nick]} {return}
if {$bversion(except_flags) != ""} {
if {[matchattr $hand $bversion(except_flags) $chan]} {
return
}
}
putserv "PRIVMSG $nick :\001VERSION\001"
if {$bversion(wait_time) > 0} {
set bversion(wait:for_reply:$nick) 1
foreach tmr [utimers] {
if {[string match "*bversion:check_reply $nick*" [join [lindex $tmr 1]]]} {
killutimer [lindex $tmr 2]
}
}
utimer $bversion(wait_time) [list bversion:check_reply $nick $hand]
}
}
###
proc bversion:check_reply {nick hand} {
global bversion
if {[info exists bversion(wait:for_reply:$nick)]} {
bversion:ban $nick $hand
unset bversion(wait:for_reply:$nick)
}
}
###
proc bversion:reply {nick uhost hand dest key arg} {
global bversion
if {[isbotnick $nick]} {return}
if {[info exists bversion(wait:for_reply:$nick)]} {
unset bversion(wait:for_reply:$nick)
}
set found_it 0
foreach v $bversion(forbidden) {
if {[string match -nocase "*$v*" $arg]} {
set found_it 1
break
}
}
if {$found_it == 1} {
bversion:ban $nick $hand
}
}
proc bversion:ban {nick hand} {
global bversion
foreach chan [channels] {
if {[channel get $chan bversion]} {
if {[onchan $nick $chan]} {
if {$bversion(except_flags) != ""} {
if {[matchattr $hand $bversion(except_flags) $chan]} {
continue
}
}
set hostname [bversion:host_return $bversion(user_ban_type) $nick [getchanhost $nick $chan]]
putserv "MODE $chan +b $hostname"
putserv "KICK $chan $nick :$bversion(ban_reason)"
}
}
}
}
###
proc bversion:host_return {type user host} {
global bversion
set ident [lindex [split $host "@"] 0]
set uhost [lindex [split $host @] 1]
switch $type {
1 {
return "*!*@$uhost"
}
2 {
return "*!$ident@$uhost"
}
3 {
return "$user!$ident@$uhost"
}
4 {
return "$user!*@*"
}
5 {
return "*!$ident@*"
}
}
}
putlog "BadVersion 1.1 tcl by BLaCkShaDoW Loaded."