Nmap Development mailing list archives
Re: ncat exec or sending a one-shot login string
From: Daniel Miller <bonsaiviking () gmail com>
Date: Mon, 14 Dec 2015 19:50:24 -0600
Spencer, You have been unsubscribed. In the future, please remember that for any Mailman-managed list you can use the unsubscribe feature on the mailing list info page (linked at the bottom of every list message). Dan On Mon, Dec 14, 2015 at 7:38 PM, Spencer Robick <srobick97 () gmail com> wrote:
Can u please take me out of the group On Monday, December 14, 2015, Brian Franklin <brian.is.still () gmail com> wrote:I tried the subshell+sleep, and it actually works pretty well. Except after the sleep is over, I get "Ncat: Input/output error." I'm also using the --no-shutdown option, but it doesn't seem to work the way I need it to. So my command line looks like: $ (echo "login"; sleep 5) | ncat --no-shutdown -C --ssl [server] [port] And the login works successfully, and the data flows back, until (apparently) the sleep ends, and then I get the i/o error. Am I missing something?? On Mon, Dec 14, 2015 at 3:53 PM, Daniel Miller <bonsaiviking () gmail com> wrote:Brian, From your description, it sounds like --no-shutdown is the option you want. This would prevent the need for the extra "-" in the cat command. Dan P.S. please keep dev () nmap org in the CC line of replies so that other users can benefit from your experience. On Mon, Dec 14, 2015 at 2:12 PM, Brian Franklin < brian.is.still () gmail com> wrote:Dan, Thanks for your reply. I'll try upgrading to 7.00 and see if it helps. I had seen the changelog, and the 'recv-only' option appeals to me, except I'm still required to send out an identification string before the data starts to flow. (So my case isn't strictly a receive-only situation.) I'll have to try the subshell+sleep. I had the impression the 'disappearance' of stdin was something that the shell was complaining about. I was using 'cat "login" -' so that the '-' was an indefinite input from stdin. You've given me some ideas! Brian On Mon, Dec 14, 2015 at 3:03 PM, Daniel Miller <bonsaiviking () gmail com> wrote:Brian, We've fixed a lot of these socket, pipe, and stdin EOF handling issues in recent versions. Most recently in version 7.00, we added an option that some folks needed for cron scripts, --no-shutdown, which prevents Ncat from closing the network connection when it receives EOF on STDIN. Other relevant options (which may or may not help your particular situation) are: -k or --keep-open, accept multiple connections in listen mode --send-only, only send data, ignoring received; quit on EOF --recv-only, Only receive data, never send anything Finally, sometimes you need to give Ncat some extra time to receive a reply, especially with UDP communication. For example this will fail: echo -ne '\0\x06\x01\0\0\x01\0\0\0\0\0\0\x07version\x04bind\0\0\x10\0\x03' | ncat -u 192.168.1.1 53 But this will succeed: (echo -ne '\0\x06\x01\0\0\x01\0\0\0\0\0\0\x07version\x04bind\0\0\x10\0\x03'; sleep 5) | ncat -u 192.168.1.1 53 We don't yet have a command option for that, but a subshell+sleep works pretty well. Dan On Sun, Dec 13, 2015 at 9:02 AM, Brian Franklin < brian.is.still () gmail com> wrote: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/
_______________________________________________ Sent through the dev mailing list https://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- ncat exec or sending a one-shot login string Brian Franklin (Dec 14)
- Re: ncat exec or sending a one-shot login string Daniel Miller (Dec 14)
- Message not available
- Re: ncat exec or sending a one-shot login string Daniel Miller (Dec 14)
- Re: ncat exec or sending a one-shot login string Brian Franklin (Dec 14)
- Re: ncat exec or sending a one-shot login string Spencer Robick (Dec 14)
- Re: ncat exec or sending a one-shot login string Daniel Miller (Dec 14)
- Message not available
- Re: ncat exec or sending a one-shot login string Daniel Miller (Dec 14)