Nmap Development mailing list archives

Re: Ncat and windows line endings


From: David Fifield <david () bamsoftware com>
Date: Thu, 4 Jun 2009 21:09:47 -0600

On Thu, Jun 04, 2009 at 04:25:11PM +0100, jah wrote:
On 04/06/2009 02:30, David Fifield wrote:
Here is the patch. It sets _O_TEXT mode on stdin when the input is from
the console (checked using the _isatty function), and _O_BINARY
otherwise. It sets _O_BINARY on stdout. So the terminal sends \n for
line endings, and no newline translation is done anywhere else, just
like on Unix.

This sounds like a good idea and it certainly would dispense with the
need for an -L option which should be a good thing.
I've attached the half of the patch I previously [1] posted that
converts LF to CRLF throughout the buffer.

I'm thinking that there may still be a use for a -L option. With the
latest revision, accessing a Unix shell from Windows through interactive
typing works great. Then I tried this:
        unix$ ncat -l --exec /bin/bash
        C:\> echo ls | ncat $unix
I get the output "ls: \r: No such file or directory", but on screen it
looks like ": No such file or directory" because the carriage return
goes back to the beginning of the line. This happens because the Windows
echo writes \r\n, and Ncat doesn't translate it because it's from a
pipe. Perhaps -L would be convenient in cases like this.

David Fifield

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


Current thread: