Nmap Development mailing list archives

Re: [PATCH] Ncat: Implementation of idle timeout option for listen mode


From: Tomas Hozza <thozza () redhat com>
Date: Mon, 17 Jun 2013 10:57:28 +0200

On 06/05/2013 04:43 PM, Tomas Hozza wrote:
On 01/15/2013 12:25 AM, David Fifield wrote:
On Mon, Jan 14, 2013 at 02:53:11PM +0100, Michal Hlavinka wrote:
I just found that ncat does not behave the way I'd expect.

Make it listen for udp connection:
ncat -l -u 1234 </dev/null

and send "Hello":
echo "Hello" | ncat -u localhost 1234

The result is that listening ncat waits for the "Hello" message and
when it comes, it terminates and prints nothing.

In ncat_listen_dgram it select()s change on socket descriptor and
after a few checks it goes to
"""/* stdin -> socket and socket -> stdout */""""
while loop. Where it checks stdin first and finding it closed, it
terminates. I'm not sure what is intended behaviour, but I guess it
should print the message since it's waiting for it.

I think this behavior is right. Arguably the program should quit
immediately upon startup since its input is closed. I would accept a
patch to do that.

And another question. Our QA engineers use netcat in their tests and
one use case is to wait for connection for some time and then
terminate.

In old netcat there's -w option which has the same behaviour like
the -i in ncat. Unfortunately, -i can't be used together with -l (it
prints error message). Why is it that way? Is it just that nobody
wrote the code or is there any other reason why it can't be used
together?

My guess is that it is just not implemented.

David Fifield

Hello.

I implemented the idle timeout "-i" option for ncat's listen mode.
Previously it was available only for connection mode.

I also added tests for idle timeout option when used in listen mode
into the ncat-test.pl test-suite.

Patches are attached.

I want to point out that when using ncat in listen mode with UDP, the
server is unaware of the connected client until it sends some message to
the server. This behaviour differs from connection oriented protocols
such as TCP and SCTP.

That's why I added separate tests for connection oriented protocols
and UDP in the test-suite.


Regards,

Tomas Hozza

Hello,

I would like to check on my patches status. Did anyone look at them? If
there is any problem, please let me know so I can fix it. If not, would
it be possible to include my changes in the next nmap release?

Thank you in advance.


Regards,

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


Current thread: