0

I am building an UDP port scanner in C. This is a scheme of the code

Create Socket
Structure raw UDP packet with port i 
Send packet and wait n miliseconds for reply

I need to perform those tasks X times, depending on the number of ports to be scanned. It may be up to 65535 times.

My goal is to optimize resources, considering an i386 machine running under a 3.5.0-17-generic Linux kernel.

  1. How many threads should be created?
  2. How many packets should be sent inside a single thread?

Thanks for your attention.

paranoidhominid
  • 1,379
  • 2
  • 8
  • 14

1 Answers1

1
  1. One thread, using select, epoll or similar.
  2. All of them. Remember to rate limit since that doesn't happen automatically with UDP.
that other guy
  • 116,971
  • 11
  • 170
  • 194