Mirc anti-spam

Soyez le premier à donner votre avis sur cette source.

Vue 9 897 fois - Téléchargée 575 fois

Description

Systeme d'anti spam pour mIRC avec gestion des filtres et multi profiles

Source / Exemple :


;If you don't mean to respect my job, just delete those lines...
;mIRc anti-spam system v1.0 by seregon
;seregon@wanadoo.fr

dialog spam_m {
  title "Anti-Spam"
  size -1 -1 394 131
  option pixels
  box "Connection", 1, 2 4 200 86
  text "Pop3 Server:", 2, 8 20 66 16
  edit "", 3, 78 18 120 20, autohs
  text "User ID:", 4, 8 42 66 16
  edit "", 5, 78 40 120 20
  text "Password:", 6, 8 64 66 16
  edit "", 7, 78 62 120 20, pass autohs
  box "Filers (Wilcards allowed)", 11, 208 4 182 124
  text "Objects filter:", 12, 214 20 94 16
  edit "", 13, 212 38 122 20, autohs
  button "Add", 14, 336 40 50 16
  edit "", 15, 212 80 122 20, autohs
  button "Add", 16, 336 82 50 16
  text "Sender filer:", 17, 214 60 132 16
  button "Expand >", 18, 249 103 93 18
  button "Start Anti-Spam", 20, 50 97 104 25
  box "Filters", 19, 396 4 196 260
  box "Log", 21, 2 132 390 132
  list 22, 8 148 378 112, size
  list 23, 400 20 186 240, size
  menu "Anti spam", 25
  item "Launch anti spam", 26, 25
  item break, 24, 25
  item "New Profile", 32, 25
  item "Load profile", 27, 25
  item "Save profile", 33, 25
  item break, 30, 25
  item "Exit", 31, 25, ok
}
dialog spam_p {
  title "Loading profile"
  size -1 -1 126 205
  option pixels
  list 1, 2 4 120 173, size
  button "Load", 2, 2 182 121 20
  button "boo", 3, 900 900 1 1, ok
}
alias -l spam_ex {
  dialog -s spam_m $dialog(spam_m).x $dialog(spam_m).y 593 285
  did -r spam_m 18
  did -a spam_m 18 Narrow <
}
alias -l spam_unex {
  dialog -s spam_m $dialog(spam_m).x $dialog(spam_m).y 394 151
  did -r spam_m 18
  did -a spam_m 18 Expand >
}
on 1:dialog:spam_m:init:0:{
  echo -j $dll(popups.dll, New, spam 16 16)
  dll popups.dll LoadImg spam 1 icon small 1,icons.dll
  echo -j $dll(popups.dll, AddItem, spam 1 1 1 Remove $cr remove)
  dll  mdx.dll SetMircVersion $version
  dll mdx.dll MarkDialog $dname
  dll mdx.dll SetDialog spam_m icon 22 icons.dll
  dll mdx.dll SetControlMDX spam_m 23  treeview haslines linesatroot hasbuttons showsel > views.mdx
  did -i $dname 23 1 iconsize normal small
  did -i $dname 23 1 seticon normal 19,icons.dll
  did -a $dname 23 +e 1 1 Objects Filer $+ $chr(9) $+ Filter Objects content
  did -a $dname 23 +e 1 1 Sender Filer $+ $chr(9) $+ Filter sender's mail content
  if ($hfind(spam,prof_*,0,w) == 0) { set -u %p $?="No profile has been founded:please set a profile" | $iif(%p != $null, hadd spam prof_ $+ $hfind(spam,prof_*,0,w) %p, dialog -x spam_m spam_m) | unset %p }
  hadd prov spp_act $hget(spam,prof_0)
  prof_load
  loadlist
  did -a spam_m 22 > Ready to contact server <
}
alias -l prof_load {
  did -r spam_m 3,5,7
  did -a spam_m 3 $hget(spam,$hget(prov,spp_act) $+ _serv)
  did -a spam_m 5 $hget(spam,$hget(prov,spp_act) $+ _id)
  did -a spam_m 7 $hget(spam,$hget(prov,spp_act) $+ _pass)
  dialog -t spam_m Anti-Spam - Profile: $+(',$hget(prov,spp_act),')
}
on 1:dialog:spam_m:menu:33: {
  hadd spam $hget(prov,spp_act) $+ _serv $did(3)
  hadd spam $hget(prov,spp_act) $+ _id $did(5)
  hadd spam $hget(prov,spp_act) $+ _pass $did(7)
}
on 1:dialog:spam_m:menu:32: {
  set -u %p $?="Set new profile name"
  if (Prof_* iswm $hfind(spam,%p,1).data) { echo -j $dll(common.dll, MsgBox, Profile name already exists > MB_OK + MB_ICONWARNING > Error) }
  elseif (%p != $null) { hadd spam prof_ $+ $hfind(spam,prof_*,0,w) %p }
  dialog -t spam_m Anti-Spam - Profile: $+(',$hget(spam,prof_ $+ $calc($hfind(spam,prof_*,0,w) - 1)),')
  hadd prov spp_act $hget(spam,prof_ $+ $calc($hfind(spam,prof_*,0,w) - 1))
  prof_load
  unset %p
}
on 1:dialog:spam_m:menu:27: {
  dialog -mo spam_p spam_p
}
on 1:dialog:spam_p:init:0: {
  %n = 1
  while (%n <= $hfind(spam,prof_*,0,w)) { did -i spam_p 1 %n $hget(spam,$hfind(spam,prof_*,%n,w)) | inc %n 1 }
  unset %n
}
on 1:dialog:spam_p:sclick:2: {
  hadd prov spp_act $did(1).seltext
  prof_load
  dialog -x spam_p spam_p
}
on 1:dialog:spam_m:sclick:18: {
  if ($did(18) == Expand >) { spam_ex }
  else { spam_unex }
}

on 1:dialog:spam_m:sclick:14: {
  if ($did(13) != $null) {
    did -i spam_m 23 1 cb root
    did -i spam_m 23 1 cb 2
    if ($didwm(spam_m,23,+* 1 1 0 0 0 $did(13)) > 0) { echo -j $dll(common.dll, MsgBox, Already in the list > MB_OK + MB_ICONWARNING > Error) }
    else {
      writeini filter.ini objects $calc($ini(filter.ini,objects,$ini(filter.ini,objects,0)) + 1) $did(13)
      did -a spam_m 23 1 1 $did(13)
    }
  }
}
on 1:dialog:spam_m:sclick:16: {
  if ($did(15) != $null) {
    did -i spam_m 23 1 cb root
    did -i spam_m 23 1 cb 3
    if ($didwm(spam_m,23,+* 1 1 0 0 0 $did(15)) > 0) { echo -j $dll(common.dll, MsgBox, Already in the list > MB_OK + MB_ICONWARNING > Error) }
    else {
      writeini filter.ini send $calc($ini(filter.ini,send,$ini(filter.ini,send,0)) + 1) $did(15)
      did -a spam_m 23 1 1 $did(15)
    }
  }
}
on 1:dialog:spam_m:sclick:23: {
  if ($gettok($did(23,1),1,32) == rclick) { 
    tokenize 32 $dll(popups.dll,Popup,spam +R $mouse.dx $mouse.dy)
    if ($1- = OK spam 1 remove) {
      did -i spam_m 23 1 cb root
      did -i spam_m 23 1 cb $gettok($did(23,1),3,32)
      remini filter.ini $iif($gettok($did(23,1),3,32) == 2, objects, send) $ini(filter.ini, $iif($gettok($did(23,1),3,32) == 2, objects, send), $calc($gettok($did(23,1),4,32) - 1))
      did -d spam_m 23 $gettok($did(23,1),4,32)
    }
  }
}
alias -l loadlist {
  did -i spam_m 23 1 cb 2
  %n = 1
  while (%n <= $ini(filter.ini,objects,0)) { did -a spam_m 23 1 1 $readini(filter.ini,objects,$ini(filter.ini,objects,%n)) | inc %n }
  did -i spam_m 23 1 cb root
  did -i spam_m 23 1 cb 3
  %n = 1
  while (%n <= $ini(filter.ini,send,0)) { did -a spam_m 23 1 1 $readini(filter.ini,send,$ini(filter.ini,send,%n)) | inc %n }
  unset %n
}
alias sp_open {
  sockopen spam $did(spam_m,3) 110
  hdel -w prov sp_*
  hadd prov sp_sock 1
  did -a spam_m 22 > Contacting server
}
on 1:sockclose:spam: {
  if ($dialog(spam_m) != $null) { did -r spam_m 22 | did -a spam_m 22 > Ready to contact server < }
}
on 1:dialog:spam_m:sclick:20: { sp_open }
on 1:sockread:spam: {
  if ($sockerr > 0) { echo 4 -ag error }
  :spam.n
  sockread %sp
  if ($sockbr == 0) { return }
  elseif (%sp == $null) { return }
  else { 
    tokenize 32 %sp
    did -a spam_m 22 < $1-
    if ($hget(prov,sp_state) == parsing) {
      if ($1 == From:) { hadd prov sp_from $2- }
      if ($1 == Subject:) { hadd prov sp_subj2 $2- }
      if (: !isin $1) && ($hget(prov,sp_subj2) != $null) { hadd prov sp_subj2 $hget(prov,sp_subj2) $2- }
      if (: isin $1) && ($hget(prov,sp_subj2) != $null) { hadd prov sp_subj $hget(prov,sp_subj2) | hdel prov sp_subj2 }
      if ($1- == .) { .signal filter }
    }
    elseif ($hget(prov,sp_state) == deleting) {
      if ($1 == +OK) {
        hdec prov sp_remn 1
        if ($hget(prov,sp_remn) > 0) { sockwrite -nt spam DELE $remove($gettok($hget(prov,sp_rem),$hget(prov,sp_remn),32),$chr(9)) }
        else { .signal sp_end }
      }
    }
    else {
      if ($1 == +OK) && ($hget(prov,sp_sock) == 1) { sockwrite -nt spam USER $did(spam_m,5) }
      elseif ($1 == +OK) && ($hget(prov,sp_sock) == 2) { sockwrite -nt spam PASS $did(spam_m,7) }
      elseif ($1 == +OK) && ($hget(prov,sp_sock) == 3) { sockwrite -nt spam STAT }
      elseif ($1 == +OK) && ($hget(prov,sp_sock) == 4) { did -a spam_m 22 Got $2 unread mails ( $+ $int($calc($3 / 1000)) $+ ko $+ ) | hadd prov sp_unr $2 | sockwrite -nt spam LIST } 
      elseif ($1- == .) && ($hget(prov,sp_sock) == 6) { 
        hadd prov sp_state parsing
        if ($hget(prov,sp_unr) > 0) { sockwrite -nt spam TOP $hget(prov,sp_unr) 1 }
        else { sockwrite -nt spam QUIT }
      }
      elseif ($1 == -ERR) && ($hget(prov,sp_sock) == 1) { did -a spam_m 22 *** Error occured during communication process: closing connection | soclckose spam }
      if ($1 == +OK) && ($hget(prov,sp_sock) < 6) { hinc prov sp_sock 1 }
    }
  }
  goto spam.n
  unset %sp
}
alias -l sockwrite {
  sockwrite $1-
  if ($dialog(spam_m) != $null) { did -a spam_m 22 > $replace($3-,$hget(spam,$hget(prov,spp_act) $+ _pass), $str(*,$len($hget(spam,$hget(prov,spp_act) $+ _pass)))) }
}
on 1:signal:filter: {
  if ($filobj($hget(prov,sp_subj)) == $true) || ($filfrom($hget(prov,sp_from)) == $true) { 
    hadd prov sp_del- $+ $hget(prov,sp_unr) $+($hget(prov,sp_unr),$chr(1),$hget(prov,sp_subj),$chr(1),$hget(prov,sp_from))
  }
  hdel prov sp_subj
  hdec prov sp_unr 1
  if ($hget(prov,sp_unr) > 0) { hadd prov sp_state parsing | sockwrite -nt spam TOP $hget(prov,sp_unr) 1 }
  if ($hget(prov,sp_unr) == 0) { 
    if ($hfind(prov,sp_del-*,0,w) > 0) {
      dialog -ma spam_d spam_d
      %n = 1
      while (%n <= $hfind(prov,sp_del-*,0,w)) {
        tokenize 1 $hget(prov,$hfind(prov,sp_del-*,%n,w))
        did -a spam_d 1 + 0 0 2 $chr(32) $+ $chr(9) $1 $+ $chr(9) $3 $+ $chr(9) $2
        inc %n
      }
      unset %n
    }
    else { 
      echo -ag boo
      sockwrite -nt spam QUIT
      echo -j $dll(common.dll, MsgBox, No mails needed to be deleted > MB_OK + MB_ICONWARNING > Anti-Spam)
    }
  }
}
alias -l filobj {
  %n = $ini(filter.ini,objects,0)
  while (%n > 0) {
    if ($readini(filter.ini,objects,$ini(filter.ini,objects,%n)) iswm $1) { hadd prov filobj $true | break }
    dec %n
  }
  unset %n
  if ($hget(prov,filobj) == $true) { hdel prov filobj | return $true }
  else { return $false }
}
alias -l filfrom {
  %n = $ini(filter.ini,send,0)
  while (%n > 0) {
    if ($readini(filter.ini,send,$ini(filter.ini,send,%n)) iswm $1) { hadd prov filsend $true | break }
    dec %n
  }
  unset %n
  if ($hget(prov,filsend) == $true) { hdel prov filsend | return $true }
  else { return $false }
}
dialog spam_d {
  title "Anti-Spam deleting selection"
  size -1 -1 106 163
  option dbu
  list 1, 1 1 103 149, size
  button "Proceed", 2, 66 152 37 10
}
on 1:dialog:spam_d:init:0: {
  dll mdx.dll SetMircVersion $version
  dll mdx.dll MarkDialog $dname
  echo -j $dll(mdx.dll, SetControlMDX, 1 listview showsel infotip report sortascending checkboxes > views.mdx)
  did -i $dname 1 1 headerdims 20 30 110 110
  did -i $dname 1 1 headertext + 0 $chr(32) $+ $chr(9) ID $+ $chr(9) From $+ $chr(9) Subject
}
on 1:dialog:spam_d:sclick:2: {
  %n = 2
  hdel -w prov sp_rem*
  while (%n <= $did(1).lines) {
    tokenize 32 $did(1,%n).text
    if ($5 == 2) { hadd prov sp_rem $hget(prov,sp_rem) $lasttok($gettok($1-,3,43),32) }
    inc %n
  }
  hadd prov sp_state deleting
  hadd prov sp_remn $numtok($hget(prov,sp_rem),32)
  sockwrite -nt spam DELE $remove($gettok($hget(prov,sp_rem),$hget(prov,sp_remn),32),$chr(9))
  unset %n
}
on 1:signal:sp_end: {
  hdel prov sp_state
  dialog -x spam_d
  sockwrite -nt spam QUIT
  echo -j $dll(common.dll, MsgBox, Mails successfully deleted > MB_OK + MB_ICONWARNING > Anti-Spam)
}
on 1:start: { 
  hmake Prov 50
  hmake spam 5
  if ($exists(Hash\spam.tos) == $true) { hload spam "Hash\spam.tos" }
}
on 1:exit: {
  hsave -o spam hash\spam.tos
  hfree Prov
  hfree spam
}
alias -l echo { if ($regex($1, ^-j) == 0) { echo $1- } | else { haltdef } }

Conclusion :


J'ai torché ce script en 2 jours donc vous etonnez pas si ia pa des bugs hein :p
Sinon j'ai laissé la librairie icons.dll entiere a koz d'une légère flemme de séparer bien els icones, en plus ca fais pas 3000 fichier pi vous avez meme droi a d zolie icones en prime :)

Codes Sources

A voir également

Ajouter un commentaire Commentaires
griffondorr
Messages postés
427
Date d'inscription
dimanche 6 juillet 2008
Statut
Membre
Dernière intervention
4 mai 2009

31 mai 2009 à 17:04
pas mal du tout pour un scripteur ;)
tipexx94
Messages postés
60
Date d'inscription
vendredi 12 novembre 2004
Statut
Membre
Dernière intervention
20 juin 2007

13 août 2005 à 02:22
je viens de voir ta source : c'est très bien


si tu te mettais au francais sa serait encore mieux lol

bv :) +
Kerrigan
Messages postés
708
Date d'inscription
lundi 15 juillet 2002
Statut
Membre
Dernière intervention
17 mars 2005

20 mars 2004 à 00:30
méchant très méchant je trouve
cs_Seregon
Messages postés
126
Date d'inscription
mercredi 30 avril 2003
Statut
Membre
Dernière intervention
29 août 2004

18 mars 2004 à 14:39
Win XP sp1 et pr les curieu mon theme XP c'est MacOS X dlable sur www.themexp.org et installable avec TGT Soft StyleXP
ChAnG-Fu
Messages postés
165
Date d'inscription
dimanche 2 novembre 2003
Statut
Membre
Dernière intervention
1 juillet 2006

17 mars 2004 à 23:01
Bien scripter...

Tu troune sous quel OS?
Afficher les 10 commentaires

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.