可以使用MozRepl从telnet退出吗?

编程入门 行业动态 更新时间:2024-10-26 03:38:59
本文介绍了可以使用MozRepl从telnet退出吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

基于此答案,我试图找出一种退出telnet的方式,并返回0

based on this answer, I am trying to figure out a way to exit from telnet and it return 0

这些不工作:

(echo -e "repl.quit()";sleep 1) |telnet localhost 4242;echo $? (echo -e "\029";sleep 1;echo "q";sleep 1) |telnet localhost 4242;echo $? (echo -e "\c]";sleep 1;echo "q";sleep 1) |telnet localhost 4242;echo $? (echo -e "\e]";sleep 1;echo "q";sleep 1) |telnet localhost 4242;echo $? (echo -e "\E]";sleep 1;echo "q";sleep 1) |telnet localhost 4242;echo $?

问题是:我无法区分成功的退出和失败的一个...

The problem is: I am UNABLE to differentiate from a successful exit and a failed one...

我认为可以链接。

I think this question can be linked.

推荐答案

你需要发送 ^] 字符,这是一个不可打印的组分隔符,您的telnet客户端在执行通过管道提供的所有命令后终止您的连接。大多数版本的 echo 程序可以使用 -e 选项生成不可打印的字符。组分隔符为035(八进制)(您可以在* nix系统上看到整个ASCII表与 man 7 ascii )。所以,整个命令应该如下所示:

You need to send ^] character, that is an unprintable group separator character before your telnet client terminates your connection after executing all commands you gave it via pipe. Most versions of echo program can produce unprintable characters using -e option. Group separator is 035 in octal (you can see the entire ASCII table with man 7 ascii on *nix systems.). So, the entire command should look like this:

$ (echo "content.location.href = 'v4.ident.me/'"; sleep 2; echo -e '\035'; sleep 2) | telnet localhost 4242 > /dev/null $ echo $? $ 0

更多推荐

可以使用MozRepl从telnet退出吗?

本文发布于:2023-10-13 09:41:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1487594.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以使用   MozRepl   telnet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!