Movatterモバイル変換


[0]ホーム

URL:


Home page logo
nmap-dev logo

Nmap Developmentmailing list archives

PreviousBy DateNext
PreviousBy ThreadNext

[RFC] Fix for non-socket select()s: fselect()


From: "Kris Katterjohn" <katterjohn () gmail com>
Date: Tue, 9 Sep 2008 08:06:03 +0530

Hey everyone,I've forced myself to stay in Windows long enough to where I think Imanaged to get a good work-around for non-socket select()s! [1]I've created an fselect() function in nbase which has special casecode for select() calls with the read set including stdin.  This newfunction will be called by Nsock and Ncat to hopefully get themworking well on Windows.Ncat will call fselect() itself in server-mode, and use it throughNsock in client-mode.The function examines and messes with the fd_sets, and decides whetheror not to just simply call select() and return.  If stdin is going tobe watched, it loops with a select() call with a 250ms timeout, andthen checks stdin the best ways I could figure out (depending onwhether or not stdin is the console or not).  My original Ncat codehad a 1s timeout, but this was because I thought I could find adifferent way around the problem and just wanted to implement atemporary fix.  Talking with Fyodor the other day, he suggested a250ms timeout per call if I was going to continue with this method.I've attached a patch against Nbase and Nsock, and here's the gist of it:* nbase/nbase_misc.c contains the new fselect() function* The Nsock nsi_new2() function, which is used by Ncat to have Nsocktake over control to stdin, now handles stdin specially.  This is theonly "problem" I have with my solution.  Instead of dup'ing thedescriptor like the function normally does, it leaves stdin alone andkeeps it.  Of course, I don't see this as a problem because thebenefits of this simple patch outway the special-casing of an alreadyspecial case scenario of having Nsock handle stdin.  Nsock is justbroken in this case on Windows without this anyway.I've been testing a patched Ncat with these changes and it all seemsto work great in client- and server-mode with stdin being the console,or a redirected file.So, if there are no objections, I'll commit this (and the Ncat changes) soon.Thanks,Kris Katterjohn[1]http://seclists.org/nmap-dev/2008/q3/0249.html

Attachment:fselect.patch
Description:

_______________________________________________Sent through the nmap-dev mailing listhttp://cgi.insecure.org/mailman/listinfo/nmap-devArchived athttp://SecLists.Org

PreviousBy DateNext
PreviousBy ThreadNext

Current thread:


[8]ページ先頭

©2009-2025 Movatter.jp