Saturday, January 29, 2011

"netcat -e" / "nc -e" on Mac OS X

netcat [...] -e program
nc [...] -e program

Is supposed to run program as a server (as far as its stdin and stdout are concerned). netcat on Mac OS X does not seem to have this -e option.

Why is that and is there a way to enable it?

  • It looks like you found one of many netcat-rewrites floating around the net. The One True Netcat uses -e to specify IPSEC parameters. Chances are you found a version that someone modified, or wrote from scratch, which is different than what most others call netcat.

    You'll have to find the source for that version and compile it. If you don't want to do that, it may be possible to do some tricks with redirection and/or a wrapper to set up the FDs properly before exec()ing a program.

    frou : What's the OG netcat? GNU version?
    Gerald Combs : Ncat (part of nmap 5) attempts to collect the best features of the various netcat variants in a modern, standardized reimplementation.
  • I don't have the -e flag on any version of netcat I checked (SLES11/Debian Lenny/Ubuntu Karmic, 10.5.8, 10.6.2). Don't you just need to set netcat to listening mode and user proper redirection of stdin/stdout?

    edit: Karmic has the -eflag.

    Dennis Williamson : Ubuntu 9.10 `man netcat`: "-e filename specify filename to exec after connect (use with caution). See the -c option for enhanced functionality."
    pfo : Seems I overlooked it, you are ofc right!
    From pfo

0 comments:

Post a Comment