Nmap Development mailing list archives

Re: nmap parallelization


From: David Fifield <david () bamsoftware com>
Date: Mon, 22 Dec 2008 17:00:12 -0700

On Mon, Dec 22, 2008 at 11:50:13PM +0000, Brandon Enright wrote:
On Mon, 22 Dec 2008 14:11:58 -0800 (PST)
Kantor Zsolt <kantorzsolt () yahoo com> wrote:
Hi, nmap uses parallelization to increase scan speed. I searched in
nmap source code to see what kind of library, functions are used for
that purpose. I searched for ptherad, the GNU pth . . . but nothing
found. My question is how is implemented then the parallelization in
nmap ? What kind of API is used for that ?

All of Nmap's parallelization is implemented by Nmap itself and isn't a
threading/forking/cloning/multi-process model.  Most of it is done via
NSOCK's callback architecture.

You'll want to look at UltraScan() in scan_engine.cc and the NSOCK
library in nsock/

In particular, look at the loop in ultra_scan that looks like

  begin_sniffer(USI, Targets);
  while(!USI->incompleteHostsEmpty()) {
    ...
  }

It just loops over different states of the algorithm: send new probes,
wait for responses, send retransmits, etc. ultra_scan has a simple
high-level structure but its many, many complicated implementation
details make it hard to understand in totality.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: