输入完成后如何退出nc?

时间:2018-02-09 14:32:54

标签: netcat

我使用了跟随netcat

$  netcat --version 
netcat (The GNU Netcat) 0.7.1
Copyright (C) 2002 - 2003  Giovanni Giacobbi

This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program under the terms of
the GNU General Public License.
For more information about these matters, see the file named COPYING.

Original idea and design by Avian Research <hobbit@avian.org>,
Written by Giovanni Giacobbi <giovanni@giacobbi.net>.

在以下示例中,netcat将挂起。

sed 's/$/\r/g' <<EOF | netcat -v httpbin.org 80
GET /get HTTP/1.1
Host:httpbin.org

EOF

以下网址针对同一问题,但我不确定netcat的哪种风格,因为我在-q找不到我使用的netcat选项。

https://serverfault.com/questions/512722/automatically-close-netcat-connection

输入完成后有人知道如何退出netcat吗?

1 个答案:

答案 0 :(得分:0)

使用通常用于指示终端窗口中的输入结束条件的任何机制。在Linux / Unix系统上,您可以通过键入任何定义为eof命令输出中显示的stty -a字符的内容来完成此操作。传统上,eof字符是Control-D。在Windows上,您可以键入Control-Z,然后按Enter键。