Communauté Eggdrop
Spam Audiotel : mauvaise détection - Version imprimable

+- Communauté Eggdrop (https://forum.eggdrop.fr)
+-- Forum : Eggdrop et TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=8)
+--- Forum : Scripts TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=4)
+--- Sujet : Spam Audiotel : mauvaise détection (/showthread.php?tid=1540)



Spam Audiotel : mauvaise détection - CrazyCat - 25/06/2014

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.


RE: Spam Audiotel : mauvaise détection - BaGrift - 25/06/2014

Salut CrazyCat, Smile

Merci pour ta suggestion j'ai codée cela comme ca pck je savais pas comment faire autrement si ta un exemple me montrer je prend avec plaisir Smile


RE: Spam Audiotel : mauvaise détection - CrazyCat - 25/06/2014

Ben... mon code est l'exemple.


RE: Spam Audiotel : mauvaise détection - BaGrift - 25/06/2014

Oui sorry Jvais pas regardé le code correctement crazy je vais testé cela et je te dis ce quil en n"est apres


RE: Spam Audiotel : mauvaise détection - CrazyCat - 26/06/2014

(25/06/2014, 23:18)BaGrift a écrit : Merci pour ta suggestion j'ai codéecodé cela comme caça pckparce que je ne savais pas comment faire autrement si tatu as un exemple meà me montrer je prendprends avec plaisir Smile

(25/06/2014, 23:49)BaGrift a écrit : Oui sorry JvaisJe n'avais pas regardé le code correctement crazy je vais testétester cela et je te dis ce quilqu'il en n"est apresaprès

Condoléances à la langue française.


RE: Spam Audiotel : mauvaise détection - BaGrift - 26/06/2014

Salut Crazy Smile

Donc j'ai fais qu'elle que test et cela fonctionne comme tu ma dis je vais corrigé le code et le remettre en ligne !


RE: Spam Audiotel : mauvaise détection - CrazyCat - 26/06/2014

Merci de faire un effort pour l'écriture. Je compte au moins 5 fautes dans ta phrase.
Et la ponctuation fait aussi parti des règles de français.