Nmap Development mailing list archives

Re: Nsock new engines


From: Kris Katterjohn <katterjohn () gmail com>
Date: Thu, 25 Oct 2012 15:48:27 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey guys,

(I've been too busy to do much with nmap for a while, so I could be mistaken
on what's going on, but I want to bring something up in case it's relevant).

On 10/25/2012 02:02 PM, Henri Doreau wrote:
it looks like WSAPoll isn't able to deal with stdin, even though I can't
find anything in the WSAPoll() documentation that would explain this
difference of behavior with select().

Does anyone know a way to do it? I unfortunately don't, and couldn't find
anything that would work for both stdin options (tty, pipes, files) and
sockets. Since only ncat should be affected there, maybe the patch
attached (untested) would be an acceptable fix? It enforces the use of
the select engine on windows when stdin is a tty. Could you please give
it a try? (also with piping something, like echo, to ncat, and
redirecting a regular file to ncat' stdin).


It sounds like you're suggesting that select() works for stdin on Windows
but WSAPoll() doesn't.  Is that right?  Although it's gone through some
changes over the years, I originally wrote the fselect()[1] in nbase because
select() doesn't work with stdin on Windows (and I did it for ncat and
nsock).  A simple grep shows that fselect() is called in engine_select.c for
nsock instead of the vanilla select().

If I'm not misunderstanding what you're saying, then I think WSAPoll() and
select() are not that different in their behavior wrt stdin (although I have
no experience with WSAPoll afaik).  I don't have a direct suggestion for a
fix, but I think it's important to note that there's a workaround for
select() and it's not doing "the right thing" with stdin on Windows either.

Cheers,
Kris Katterjohn

[1] http://seclists.org/nmap-dev/2008/q3/766
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJQiaWYAAoJEEQxgFs5kUfuuw0QALWIVeY2o/VChJdPShGI7Coe
qWbTLKRewxkLAq0Qa7e+wGd+SdTUplPvMuDaayUpEMx+Zn9mitB+m5gGp5SjQ6Zf
zBrVPyUTPnaMGWZSpnLYJAdzFZl0Ot7lPvUULqb4BPj/hbXgeiddYxBQ1rSIUEqM
BcDJM2b10cqxIVEuK5UIKBXIzkOzQTicx0sLmcdibpUj5pkvngVgpA55w3ociG62
JH2cXHaE8MdxNbQFgq1TTFT7K4tJHf6K7B/5G2txvRe5MDZPamrwbbuR3EiJCY3S
PmoeMKk7lMCB/bbjL0zrJuQ3f6ewum/FLnJSK8DGBV38PxJCnvOAHIOZcBeRvvH3
aEf6eIc42TCaMPe6F+GzjQhySw7wWhOCwdW9/YKvgp69Edxu3UA2TSNYoBJrCDIF
044v+TyW0YfZ0S3yZ0PEZXAFa/BCNugRVGQCR0bfs+5wASgWq6LCi5RDCXnv/m76
c1kzgvizv1BSA5XsWEP1aiOE/gIBwTGBBr+GCj6ikIvL06wG0TBl7G5OKjISGcYl
KtcJYP4ndRGVip1CfwaJ/CJ2qAi4HX82WST+DNqqG3mY25woNKUVwKAbFxMJUxZF
LyA/be0ThOH3x6wo+QxR/WiKlMynk93l89xfPwY/DZVDV1Cfbwp0GyoQ16uFY0vE
W35/Y58u9wzvUZJZ88a3
=Lq7g
-----END PGP SIGNATURE-----
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: