Nmap Development mailing list archives

Ncat/Nsock on Windows; non-socket select()s


From: Kris Katterjohn <katterjohn () gmail com>
Date: Tue, 05 Aug 2008 13:40:27 -0500

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

Hey everyone,

Mixter and I got Ncat compiling on Windows just fine; however, I haven't been
able to get Ncat working correctly.  One step to making this work was calling
WSAStartup() before doing anything else.  This seems to initialize everything
like Winsock so things work correctly.

The main problem getting Ncat to work is that Windows' select() doesn't work
for non-socket descriptors (i.e. stdin).  This presents a problem in Ncat
itself and Nsock.

There exists a WaitForMultipleObjects() function[1] in Windows which looks
like it can do the job, but it doesn't say it works for sockets while coming
right out and listing other types.  Does anyone have experience with this?

It doesn't look very useful to me anyway, because here's what it says about
the return value:

"the return value minus WAIT_OBJECT_0 indicates the lpHandles array index of
the object that satisfied the wait. If more than one object became signaled
during the call, this is the array index of the signaled object with the
smallest index value of all the signaled objects."

I don't see anything comparable to FD_ISSET() or the like, so I don't even
think this will work well.

There's also the idea I've seen around of just saying non-socket descriptors
are readable, then call select() on the sockets.  But I don't like the
prospect of redesigning some sections simply for a kludge that's not great.

So has anyone seen or come up with a nicer workaround for this problem?  Does
anyone have any comments on the above options?

Something obviously has to be done to get this working on Windows.  It just
sucks that the problem is in Ncat and Nsock, because I'd be OK with a
temporary kludge in Ncat alone, but I don't wanna muck up Nsock for this.

Thanks,
Kris Katterjohn

[1] http://msdn.microsoft.com/en-us/library/ms687025(VS.85).aspx


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBSJiemf9K37xXYl36AQI+gA//fvduwSlKHOS/KRSNJyw9ZtdtlQsbY/Pw
2xUpE53uS1wiO+0z2gGPmbXc0WRHl1PaCgi+hjSMxN+FIs1s1IdjEhxw/Tll6MyF
O8P30mqgIcxEMO0yTxjMj3ApECItEy7Jt8OCl6Cy8XMjLoDeZjj+2ZuEvzkB15FF
NPVFwa5cKiauPVfX6aVlK3O/8Fmw2XVRhW7dYD/zDxW/ZuQkVrXG9LV/BtnGyQ7T
soDJ8kOF/Bixd4oNljkDdkBEUg9XMsQ2eP+VUg1Zda0QfMPCNdRwyFCJjbOqMGdU
KmsQTC87H08qjFIVXSBwRDa4mXQefOtokryKz48xrOPV8+o3Lp8QBqd4PEQp+BQJ
K2zkAfVmZvEgNdj83xtZOj7MFI5bP+vmxi8YkqkqjOODdRK179QX0yBlIdluD7Vg
COt+m14G3RnoEBL1A6Ir3LSfWKeNruUSKdsZy++EOnPpzShBSeXGbQakgI5u4CWM
yyChioIiObNFNcASRn/yEBNCmD3hHKI9A0Xb0eUuY0JmRXyFNGyYZNhI2gg1yq9y
LS0raeKl01dOzijQ8q+zxsI7YG1wi4//8gXhXLJgHMSAqm9UjbaiFKOkUk74bHsR
EbA6Kn3YNST7tb34nUh9heyU0edMTZSnxHS/dYIkk8LBlhMsgOL2nNTNmsVJbwe7
vqo2TbRxNJ4=
=zhaz
-----END PGP SIGNATURE-----

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


Current thread: