Spam Audiotel : mauvaise détection
#1
Je me suis permis de jeter un oeil sur le script Spam Audiotel et j'ai été assez surpris par son fonctionnement

tcl
set numbers { 06 09 08 07 01 05 04 03 02 }
 
bind pubm - * spam
 
proc spam {nick uhost handle channel args} {
    global numbers reason banmask botnick
    set handle [nick2hand $nick]
    set banmask "*!*@[lindex [split $uhost @] 1]"
    set duration 5m
    for { set number 0 } { $number < [llength $numbers] } { incr number } {
        if { [string match *[lindex $numbers $number]* *$args* ] } {
            if {[matchattr $handle +f]} {
                putlog "-Anti Spam Audiotel- $nick ($handle) with +f flags said $args on $channel"
            } elseif {[matchattr $handle +o]} {
                putlog "-Anti Spam Audiotel- $nick ($handle) with +o flags said $args on $channel"
            } else {
                putlog "-Anti Spam Audiotel- KICKED $nick on $channel matched by $args"
                putquick "KICK $channel $nick :$reason"
                newchanban $channel $banmask $botnick $reason 5m
            }
        }
    }
}


Donc en gros, tu poses un ban sitôt qu'il y a un des chiffres contenu dans $numbers dans une ligne.
Un peu génant, non ?

Alors qu'avec une simple expression régulière, tu vas pouvoir vraiment tester que ça a le format d'un numéro de téléphone:
tcl
proc spam {nick uhost handle channel args} {
    global reason banmask botnick
    set handle [nick2hand $nick]
    set banmask "*!*@[lindex [split $uhost @] 1]"
    set duration 5m
    if { [regexp {\y0[1-9]([\-\.\ ]?\d{2}){4}\y} $args] } {
         if {[matchattr $handle +f]} {
             putlog "-Anti Spam Audiotel- $nick ($handle) with +f flags said $args on $channel"
         } elseif {[matchattr $handle +o]} {
             putlog "-Anti Spam Audiotel- $nick ($handle) with +o flags said $args on $channel"
         } else {
             putlog "-Anti Spam Audiotel- KICKED $nick on $channel matched by $args"
             putquick "KICK $channel $nick :$reason"
             newchanban $channel $banmask $botnick $reason 5m
        }
    }
}



My 2 cents.
Répondre


Messages dans ce sujet
Spam Audiotel : mauvaise détection - par CrazyCat - 25/06/2014, 10:47

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté