Nmap Development mailing list archives
ncat's nsock vs. nmap nsock
From: " mixter () gmail com" <mixter () gmail com>
Date: Thu, 8 May 2008 18:59:12 +0200
Hi, Currently, I'm working for Fyodor and GSoC on improving and eventually merging ncat (the nmap netcat implementation) with the main distribution. It currently resides in nmap-ext/ncat. The main issue that prevents it from merging is that the nsock version of ncat is a slightly modified version of the original nsock. By diff'ing the 2006 nsock version against it (attached), I found there's just one major difference, which is in do_actual_read(): - buflen = read(iod->sd, buf, sizeof(buf)); + buflen = recv(iod->sd, buf, sizeof(buf), 0); Ncat does a read() which is fully reliable, but nsock originally does a recv() (which just differently, e.g. it is slightly lower level and more errors have to be catched). The Bad News, Ncat, as designed, does NOT work with a recv() in this place (doesn't receive any input), but Good News: it DOES fully work with latest nsock from nmap CVS with only a read() in place of the recv() (all features tested & working). Without touching the original nsock implementation, which I certainly don't want to, the straightforward solution I see would be to clone a few functions from nsock_core.c in ncat which use this low-level read: do_actual_read() handle_read_result() iterate_through_event_lists() and nsock_loop(). That should be all. Unless anyone comes up with a more beautiful solution, I would do this (only) to the Ncat code, probably on the weekend, resulting in a nmap-exp/ncat directory that produces a working ncat with externals set to current nsock/nbase implementations. Other suggestions welcome (and ideally, that should not be a full Ncat core rewrite, as I just have 2-3 months for adding a bunch of features within the GSoC project ;) bye, Mixter
Attachment:
nsock.diff.txt
Description:
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- ncat's nsock vs. nmap nsock mixter () gmail com (May 08)
- Re: ncat's nsock vs. nmap nsock Fyodor (May 08)
- Re: ncat's nsock vs. nmap nsock doug (May 08)
- Re: ncat's nsock vs. nmap nsock mixter () gmail com (May 09)
- Re: ncat's nsock vs. nmap nsock mixter () gmail com (May 09)
- Re: ncat's nsock vs. nmap nsock Fyodor (May 09)
- Re: ncat's nsock vs. nmap nsock mixter () gmail com (May 10)
- Re: ncat's nsock vs. nmap nsock Fyodor (May 10)
- Re: ncat's nsock vs. nmap nsock Fyodor (May 08)