home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / s0ftpj / orodruin.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-12-17  |  5.3 KB  |  198 lines

  1. /************************************************************************
  2. *                                    *
  3. * ORODRUIN.c            Il Monte del Fato, la forgia entro cui    *
  4. *                l' Uno e' stato creato, nella terra di    *
  5. *                Mordor, dove l'ombra nera attende.    *
  6. *                                    *
  7. *                    Uno Spoof per regnarli,        *
  8. *                    Uno Spoof per trovarli,     *
  9. *                Uno Spoof per ghermirli, e nel buio    *
  10. *                 incatenarli, nella terra di Redmond    *
  11. *                    dove il nero hacker attende ... *
  12. *                                    *
  13. *                 (C)1999 FuSyS TCP/IP Tools Unlimited    *
  14. ************************************************************************/
  15.  
  16. #include <stdio.h>
  17. #include <string.h>
  18. #include <unistd.h>
  19. #include <ctype.h>
  20. #include <sys/types.h>
  21. #include <sys/socket.h>
  22. #include <netinet/in.h>
  23. #include <time.h>
  24.  
  25. unsigned short ip_fast_csum(unsigned char *iph,unsigned long ihl) {
  26.         unsigned long sum;
  27.  
  28.         __asm__ __volatile__("
  29.             movl (%1), %0
  30.             subl $4, %2
  31.             jbe 2f
  32.             addl 4(%1), %0
  33.             adcl 8(%1), %0
  34.             adcl 12(%1), %0
  35. 1:          adcl 16(%1), %0
  36.             lea 4(%1), %1
  37.             decl %2
  38.             jne 1b
  39.             adcl $0, %0
  40.             movl %0, %2
  41.             shrl $16, %0
  42.             addw %w2, %w0
  43.             adcl $0, %0
  44.             notl %0
  45. 2:
  46.          "
  47.         : "=r" (sum), "=r" (iph), "=r" (ihl)
  48.         : "1" (iph), "2" (ihl));
  49.         return(sum);
  50. }
  51.  
  52. struct pseudo {
  53.     unsigned long saddr, daddr;
  54.     unsigned char zero, proto;
  55.     unsigned short len;
  56. };
  57.  
  58. unsigned long in_aton(const char *str)
  59. {
  60.         unsigned long l;
  61.         unsigned long val;
  62.         int i;
  63.  
  64.         l = 0;
  65.         for (i = 0; i < 4; i++)
  66.         {
  67.            l <<= 8;
  68.            if (*str != '\0')
  69.            {
  70.                val = 0;
  71.                while (*str != '\0' && *str != '.')
  72.                {
  73.                         val *= 10;
  74.                         val += *str - '0';
  75.                                 str++;
  76.                         }
  77.                         l |= val;
  78.                         if (*str != '\0')
  79.                                 str++;
  80.                 }
  81.         }
  82.         return(htonl(l));
  83. }
  84.  
  85. void uff(void) {
  86.     printf("\nUso: Orodruin sourceIP destIP ");
  87.     printf("[-h -s -d -n -F -S -R -P -A -U]\n");
  88.     printf("        -h       questa litania di Angmar ...\n");
  89.     printf("    -s porta l' origine dell' Uno\n");
  90.     printf("        -d porta la destinazione dell' Uno\n");
  91.     printf("        -n x     il numero delle creazioni\n");
  92.     printf("        -FSRPAU  le bandiere dell'Uno\n\n");
  93.     exit(1);
  94. }
  95. int main(int argc, char **argv) {
  96.  
  97.     unsigned char pkt[1500], *x0F, b, flags=0;
  98.     struct sockaddr_in sin;
  99.     struct pseudo psp;
  100.     int fd, fdo, ln, i, snt, opt, hz=1, os=0, od=0;
  101.     unsigned long saddr, daddr;
  102.     unsigned short src=0, dest=0;
  103.  
  104.     if(argc<3) {
  105.         uff();
  106.         exit(1);
  107.     }
  108.  
  109.     saddr=in_aton(argv[1]);daddr=in_aton(argv[2]);
  110.  
  111.     while ((opt = getopt(argc, (char**)argv, "hs:d:n:FSRPAU")) != EOF )
  112.         {
  113.                 switch(opt)
  114.                 {
  115.             case 'h':
  116.             uff();
  117.             exit(0);
  118.             break;
  119.  
  120.             case 's':
  121.             src=(unsigned short)atoi(optarg);
  122.             os++;
  123.             break;
  124.  
  125.             case 'd':
  126.             dest=(unsigned short)atoi(optarg);
  127.             od++;
  128.             break;
  129.     
  130.             case 'n':
  131.                         hz=atoi(optarg);
  132.                         break;
  133.         
  134.             case 'F':
  135.             flags|=0x01;
  136.             break;
  137.  
  138.             case 'S':
  139.                         flags|=0x02;
  140.                         break;
  141.  
  142.             case 'R':
  143.                         flags|=0x04;
  144.                         break;
  145.  
  146.             case 'P':
  147.                         flags|=0x08;
  148.                         break;
  149.  
  150.             case 'A':
  151.                         flags|=0x10;
  152.                         break;
  153.  
  154.             case 'U':
  155.                         flags|=0x20;
  156.                         break;
  157.  
  158.             default:
  159.             break;
  160.         }
  161.     }
  162.     if((fd=socket(AF_INET, SOCK_RAW, IPPROTO_RAW))<0) {
  163.         fprintf(stderr, "\nSOCK_RAW Died\n");
  164.         exit(2);
  165.     }
  166.     fdo=1;
  167.     if(setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &fdo, sizeof(fdo))<0) {
  168.         fprintf(stderr, "\nHDRINCL Died\n");
  169.         exit(3);
  170.     }
  171.     srand(time(NULL));
  172.     printf("\n\033[1;34m----] \033[1;32mO R O D R U I N\033[0m");
  173.         printf("\033[1;34m [----\033[0m");
  174.         printf("\n\033[1;34m    TCP Forger by FuSyS\033[0m");
  175.         printf("\n\033[1;34m   TCP/IP Tools Unlimited\033[0m");
  176.         printf("\n\033[1;34m------------][-------------\033[0m\n\n");
  177.  
  178.  
  179.      /* Magia Nera Del Re Stregone di Minas Morgul, Signore Dei Nazgul */
  180.  
  181. while(hz){if(!os)src=1024+(rand()%2000);if(!od)dest=rand()%2000;if(flags==0)
  182. flags|=0x20|0x08;sin.sin_family=AF_INET;sin.sin_addr.s_addr=daddr;sin.sin_port=
  183. dest;ln=sizeof(sin);x0F=pkt;memset((unsigned char*)x0F,0,1500);psp.saddr=saddr;
  184. psp.daddr =daddr;psp.len=htons(20);psp.zero=0;psp.proto=6;b=0x45;memcpy(x0F,&b,
  185. sizeof(unsigned char));x0F+=2;*((unsigned short*)x0F)=htons(40);x0F+=2;*((
  186. unsigned short*)x0F)=0xFFFF;x0F+=2;*(( unsigned short*)x0F)=0x0000;x0F+=2;*((
  187. unsigned char*)x0F)=0xFF;x0F+=1;b=6;memcpy(x0F,&b,sizeof(unsigned char));x0F+=3
  188. ;*((unsigned long*)x0F)=saddr;x0F+=4;*((unsigned long*)x0F)=daddr;x0F+=4;*((
  189. unsigned short*)x0F)=htons(src);x0F+=2;*((unsigned short*)x0F)=htons(dest);x0F
  190. +=2;*((unsigned long*)x0F)=htonl(rand());x0F+=4;*((unsigned long*)x0F)=htonl(
  191. rand());x0F+=4;b=0x50;memcpy(x0F,&b,sizeof(unsigned char));x0F+=1;memcpy(x0F,
  192. &flags,sizeof(unsigned short));x0F+=1;*((unsigned short*)x0F)=htons(1024);x0F+=
  193. 2;*((unsigned short*)x0F)=ip_fast_csum((unsigned char*)&psp,32);snt=sendto(fd,
  194. pkt,40,0,(struct sockaddr*)&sin,ln);hz--;}
  195.  
  196.     exit(1);
  197. }
  198.