Nmap Development mailing list archives

ncat exec or sending a one-shot login string


From: Brian Franklin <brian.is.still () gmail com>
Date: Sun, 13 Dec 2015 10:02:36 -0500

Hi there!  I'm a big fan of ncat, particularly the ssl support.  Well done!

Recently, I'm trying to use it from within cron.  I can't seem to get it to
work.  Basically, I connect as a client and then pass a login string to a
remote server, and then it streams some data to me, which I then pipe to
another process.  I use something like:

cat "login" - | ncat -C --ssl [server] [port] | [some other script]

This works perfectly from the command line (it always does...) but the cron
job won't work.  Turning up the verbosity provides some interesting clues,
but I don't know how to interpret most of it.  I've applied all my standard
"tricks" for debugging a cron job, but I'm getting nowhere.  The closest
I've come is that it might be related to my use of 'cat' and it's reliance
on stdin to 'hold' the pipe open?

If I remove the last pipe, and just collect the ncat output using the MTA
from cron, then it reports a successful connection, but it just seems to
quit after that.

What I'm trying to achieve is this:

1.  Connect to remote server
2.  Send login string (really just an identity)
3.  Receive data
4.  Pipe data to another script for processing

Sending the login string is a one-shot deal; after that it's all
uni-directional communication and I don't send anything back.  I have no
control over the remote server.

Using ncat 6.40 on Ubuntu 14.04.

Can anyone point me in the right direction?

Thanks,

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

Current thread: