Nmap Development mailing list archives
Re: ncat: how to get output in connect mode (non-interactive)
From: Tomas Psika <tomas.psika () gmail com>
Date: Thu, 17 Sep 2009 00:28:14 +0200
Thank you much David. You made it clear to me. Tomas David Fifield napsal(a):
On Mon, Sep 14, 2009 at 04:52:04PM +0200, Tomas Psika wrote:need to know if it somehow possible to get some output when invoking ncat in connect mode (client) non-interactively (with command prepared). $ cat test.sh #!/usr/bin/env bash echo -ne "GET / HTTP/1.1\n" echo -ne "Host: www.google.com\n\n" $ ncat -c /path/to/test.sh www.google.com 80 $ [nothing] $ echo $? 0You have to write this as ./test.sh | ncat www.google.com 80 The reason is that with the -c option, Ncat totally surrenders control of the network connection to the invoked program, which becomes responsible for reading and writing. Because test.sh never reads from stdin, it never reads from the network when invoked by Ncat; and further if it did print any output it would go back over the network, not to the screen. For this script you will also want to use HTTP/1.0 or add a "Connection: close" header field so that the remote server will close the connection after it sends the reply. Otherwise an HTTP/1.1 server may keep the connection open, waiting for more requests. David Fifield
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- ncat: how to get output in connect mode (non-interactive) Tomas Psika (Sep 16)
- Re: ncat: how to get output in connect mode (non-interactive) David Fifield (Sep 16)
- Re: ncat: how to get output in connect mode (non-interactive) Tomas Psika (Sep 16)
- Re: ncat: how to get output in connect mode (non-interactive) David Fifield (Sep 16)