How To: Make a Simple UDP_Flooder in C pt1.

Make a Simple UDP_Flooder in C pt1.

Alright, this will be my first tutorial in C.

Note that this guide is written for Linux.

This won't be very easy if you don't know the basics of C, so if you don't I suggest looking into dontrustme's awesome C tutorials first.

READ THIS FIRST

Alright here is the deal, this UDP flooder should NEVER, EVER be used outside your LAN. The reason being, apart from the fact you shouldn't ofcourse use it illegally, that there is a chance your ISP will shut you down for breaking the terms of agreement.

How Does UDP Flooding Work?

UDP Works by sending lots of UDP packets to random closed ports on a server. The server will process each received UDP packet and send back an ICMP packet saying the port is closed. Because of all the trafic this creates the server will eventually be unable to process traffic, causing denial of service.

So What Do We Need?

We need a program that sends a lot of UDP packets to different ports.
in pseudo code:
#include socketheaders

struct sockaddr targetAddr

main() {
sock (udp)

targetAddr.ipaddr = <target ip>

while(true) {
. . for(i=10000;i<60000;i++) {
. . . . targetAddr.port = i
. . . . sendto(sock, msg, targetAddr)
. . }
}
}

Homework

That's right, home work! I want you to first try and write it yourself.

Check the following man pages:

man socket, man 2 socket, man 7 socket, man sendto

Also take a look in the header files, sys/socket.h, arpa/inet.h

In part two we will go trough my version of the program and ways to mitigate this attack ;)

That's it for now, good luck with coding ^^.

EDIT: Beej also has a great deal of info on sockets found here ~ thx dtm, for the suggestion

Just updated your iPhone? You'll find new emoji, enhanced security, podcast transcripts, Apple Cash virtual numbers, and other useful features. There are even new additions hidden within Safari. Find out what's new and changed on your iPhone with the iOS 17.4 update.

Be the First to Comment

Share Your Thoughts

  • Hot
  • Latest