由于 ^] 不起作用,如何使用 rlwrap 终止 telnet 客户端?

由于 ^] 不起作用,如何使用 rlwrap 终止 telnet 客户端?

当我使用 rlwrap 进行 telnet 时,似乎没有办法终止客户端。我是不是漏掉了什么,还是我真的必须使用 kill 命令终止进程?

答案1

rlwrap 是 GNU readline 的包装器,因此它在本地执行所有操作,并且仅在您按下 后才传递您的输入Enter。当您按下Ctrl+时],您看不到telnet>提示,因为 readline 尚未发送您的输入。

要终止您的 telnet 连接,请按Ctrl+ ],然后q,然后Enter

答案2

Ctrl+c、Esc、回车、Ctrl+]、回车、q、回车

答案3

ctrl+ q
ctrl+]
Enter

ctrl+q 将强制 rlwrap^]在你点击后按原样发送Enter

但是,与 一起使用时,该命令似乎不可靠rlwrap。例如,请参见此裸telnet会话

$ telnet
telnet> open google.fr 443
Trying 142.251.37.163...
Connected to google.fr.
Escape character is '^]'.
^]
telnet> open google.fr 80
?Already connected to google.fr
telnet> close
Connection closed.
telnet> open google.fr 443
Trying 142.251.37.163...
Connected to google.fr.
Escape character is '^]'.
^]
telnet>

并与rlwrap会话进行比较

11:37:40 ~ -1- $ rlwrap telnet
telnet> open google.fr 443
Trying 142.251.37.163...
Connected to google.fr.
Escape character is '^]'.
^]

telnet> open google.fr 80
FConnection closed by foreign host.
11:37:52 ~ -1- $ rlwrap telnet
telnet> open google.fr 443
Trying 142.251.37.163...
Connected to google.fr.
Escape character is '^]'.
Connection closed by foreign host.
11:38:17 ~ -1- $ rlwrap telnet
telnet> open google.fr 80
Trying 142.251.37.163...
Connected to google.fr.
Escape character is '^]'.
^]

telnet> close
HTTP/1.0 400 Bad Request
Content-Type: text/html; charset=UTF-8
Referrer-Policy: no-referrer
Content-Length: 1555
Date: Thu, 04 Aug 2022 10:38:32 GMT

<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 400 (Bad Request)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>400.</b> <ins>That’s an error.</ins>
  <p>Your client has issued a malformed or illegal request.  <ins>That’s all we know.</ins>
Connection closed by foreign host.
11:38:32 ~ -1- $

相关内容