Home page logo

nmap-dev logo Nmap Development mailing list archives

Re: ncat's nsock vs. nmap nsock
From: Fyodor <fyodor () insecure org>
Date: Fri, 9 May 2008 21:24:43 -0700

On Fri, May 09, 2008 at 03:28:44PM +0200,  mixter () gmail com wrote:
Ok... taking a second look at the strace I sent there... :)
The problem is actually clear, nsock has no problems with
network input, but with stdin input! dup(0) = 4, then
recv(4, ...) = -1 errno ENOTSOCK means that recv()
refuses to read from stdin as not being a real socket.

Good find.  If nsock is not currently able to handle these different
types of descriptors transparently, I think it should be improved to
do so.  The application calling Nsock shouldn't have to set a special
flag.  I'm not sure of the best way to do this though.  One option
would be that if recv() gives an ENOTSOCK error on a particular
socket, try again with read() and set a flag to do read in the future.

Nsock used to work with stdin and network sockets transparently.  For
example, see nsock/examples/nsock_telnet.c.  That small (~250 line)
sample Nsock app hasn't been updated for the latest Nsock API and so
it doesn't compile.  But if you find a little spare time, you might
find it useful to do so.  It is great for simple testing.  If you do
update it, please also update the Makefile to compile it and check it
in.  The change can go directly in /nmap/nsock/examples branch because
it is already broken so it would be hard to make things worse.


Sent through the nmap-dev mailing list
Archived at http://SecLists.Org

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]