netcat-openbsd に '-e' オプションがないのはなぜですか?

netcat-openbsd に '-e' オプションがないのはなぜですか?

-eパッケージにオプションが欠けているのはなぜですかnetcat-openbsd? パッケージはありますnetcat-traditionalが、OpenBSD パッケージの多くの機能が欠けています。Linux Mint 16 を実行しています。

なぜこれが欠落しているのか知っている人はいますか? netcat のかなり大きな機能が削除されます。

答え1

プログラムにはさまざまなバージョンがあるためです。

netcatPOSIXで規定されている他の多くの標準ユーティリティとは異なり、どのオプションをサポートしなければならないかを説明する「標準」はありません。OpenBSD netcat、FreeBSD、GNU ネットキャットなどなど。

OpenBSD版の場合マニュアルページには次のように記されている:

There is no -c or -e option in this netcat, but you still can execute a
 command after connection being established by redirecting file descriptors.
 Be cautious here because opening a port and let anyone connected execute
 arbitrary command on your site is DANGEROUS. If you really need to do this,
 here is an example:

 On ‘server’ side:

       $ rm -f /tmp/f; mkfifo /tmp/f
       $ cat /tmp/f | /bin/sh -i 2>&1 | nc -l 127.0.0.1 1234 > /tmp/f

 On ‘client’ side:

       $ nc host.example.com 1234
       $ (shell prompt from host.example.com)

 By doing this, you create a fifo at /tmp/f and make nc listen at port 1234
 of address 127.0.0.1 on ‘server’ side, when a ‘client’ establishes a
 connection successfully to that port, /bin/sh gets executed on ‘server’
 side and the shell prompt is given to ‘client’ side.

 When connection is terminated, nc quits as well. Use -k if you want it keep
 listening, but if the command quits this option won't restart it or keep nc
 running. Also don't forget to remove the file descriptor once you don't
 need it anymore:

       $ rm -f /tmp/f

答え2

最新バージョンでは、netcat のいくつかのソースで実行コマンドを有効にする定義が見つかりました。通常は、セキュリティ上の理由から無効になっています。

しかし、私は別の回避策を見つけました

http://www.commandlinefu.com/commands/view/11061/emulating-netcat-e-netcat-traditional-or-netcat-openbsd-with-the-gnu-netcat

関連情報