Nmap Development mailing list archives

Re: Nsock new engines


From: Henri Doreau <henri.doreau () gmail com>
Date: Thu, 25 Oct 2012 21:02:49 +0200

2012/10/25 Rob Nicholls <robert () robnicholls co uk>:
On 25.10.2012 11:52, Henri Doreau wrote:

Hi,

thanks for the feedback. I'll try to troubleshoot that. Which command
are you using? You should be able to force the use of a given engine
using the "--nsock-engine=select" parameter. Could you test it (server
and client side)?


I hadn't thought to add the extra parameter, sorry I didn't realise this
first. When I force the use of "select" it works fine; when I use "poll" it
doesn't work:

C:\Users\Robert>ncat -v xxx.xxxxxx.xxx 80 --nsock-engine=select
Ncat: Version 6.02 ( http://nmap.org/ncat )
Ncat: Connected to xxx.xxx.xxx.xxx:80.
GET / HTTP/1.0
Host: xxx.xxxxxx.xxx

HTTP/1.1 302 Redirect
Content-Type: text/html; charset=UTF-8
Location: https://xxx.xxxxxx.xxx/
Server: Microsoft-IIS/7.0
X-FRAME-OPTIONS: SAMEORIGIN
Date: Thu, 25 Oct 2012 13:16:15 GMT
Connection: close
Content-Length: 153

<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a
HREF="https://xxx.xxxxxx.xxx/";>here</a></body>Ncat: 44 bytes sent, 393 bytes
received in 9.69 seconds.

C:\Users\Robert>ncat -v xxx.xxxxxx.xxx 80 --nsock-engine=poll
Ncat: Version 6.02 ( http://nmap.org/ncat )
Ncat: Connected to xxx.xxx.xxx.xxx:80.
^C

Both engines seem to work fine when listening (used telnet and Ncat with
select to send to the server):

C:\Users\Robert>ncat -lk 8080 --nsock-engine=poll
hello
world
^C
C:\Users\Robert>ncat -lk 8080 --nsock-engine=select
ping
pong
^C

Rob

Thanks Rob,

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).

I dislike these hidden and forced uses of the select engine in ncat
but I really don't see any other acceptable option. Disabling windows
compatibility in the poll engine would be doable too, but at the end
of the day the restrictions would be the same in ncat (select only)
and nmap/nping couldn't benefit the advantages of poll...

Regards

-- 
Henri

Attachment: ncat_win_use_select.diff
Description:

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

Current thread: