2

We are currently using netcat to pipe messages to a process running a listener on a specific port. E.g.: echo "test message" | netcat localhost 12345

Access to netcat has recently been removed from all of the machines in our organisation because it is a "security risk". Is there a simple alternative (on linux) that can be used for this purpose?

drakkanraz
  • 341
  • 3
  • 9
  • 2
    Are [Python](http://stackoverflow.com/questions/1908878/netcat-implementation-in-python) and [Perl](http://www.perlmonks.org/?node_id=960819) "security risks", too? `` – tripleee Mar 07 '14 at 10:46

1 Answers1

7

If your bash has support for it you could always try something like:

echo "Meet me in Montauk" > /dev/tcp/localhost/12345

Depending on what else you might have on the machine (python, gawk, the ability to run your own binaries etc) you might have more options.

The right way to solve this is to explain to whoever that netcat is not a security risk.

cnicutar
  • 178,505
  • 25
  • 365
  • 392
  • 2
    While I agree with the final comment in principle, there are certainly scenarios where removing Netcat, or not having a computer, will improve security. – tripleee Mar 07 '14 at 10:51
  • That worked, thanks. And I agree with the comments, but there's little I can do about it :( – drakkanraz Mar 07 '14 at 11:08
  • @tripleee Well, if they consider `netcat` a security problem it is only a matter of time until they discover they can do the same thing with `bash`. Then the OP will move to a python program and they'll end up plugging that and the arms race continues until nothing useful is left on the machine, which leads us to the very pertinent comment you left on the question. – cnicutar Mar 07 '14 at 11:29
  • This works for me as well, but how do I receive any communication back? With `netcat` the response was printed back to me, but now I see nothing. – jgivoni Jun 02 '16 at 09:47
  • @cnicutar Good luck explaining to AV vendors that nc is not a security risk. Or to the IT department. – David Balažic Feb 21 '22 at 15:29