Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35119 > unrolled thread

Telnetlib and special quit characters with Ctrl, oh my!

Started bywinona_whitener@yahoo.com
First post2012-12-19 06:28 -0800
Last post2012-12-20 01:57 +1100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Telnetlib and special quit characters with Ctrl, oh my! winona_whitener@yahoo.com - 2012-12-19 06:28 -0800
    Re: Telnetlib and special quit characters with Ctrl, oh my! Chris Angelico <rosuav@gmail.com> - 2012-12-20 01:57 +1100

#35119 — Telnetlib and special quit characters with Ctrl, oh my!

Fromwinona_whitener@yahoo.com
Date2012-12-19 06:28 -0800
SubjectTelnetlib and special quit characters with Ctrl, oh my!
Message-ID<ea807804-c082-44d0-9165-226545e097a5@googlegroups.com>
Greetings all,

I am using telnetlib and the box that I'm connecting to has a special escape sequence--^]--to leave the prompt and go back to the regular telnet prompt.  For example, from teh command line I do this:

telnet 123.12.123.0
Login:> xxxxxx
Password:> xxxxxxx

Welcome.
Connected to '123.12.123.0'.
Escape character is '^]'.

#> (some commands)
(responses)

When I pressing and hold Ctrl and then ], I go back to my normal telnet prompt and can quit.

Using telnetlib, I can send commands and get responses.  But I'm stuck on sending the ctrl+]!  Is there some escape character--\c?--or a keycode like \^ to send through telnetlib?

Telnetlib is doing what I need it to, but the read_until command that I'm familiar appears to be getting stuck on the fact that I never leave the connection properly--like I would normally do with an "exit" or "quit".

As always, I'm glad for comments and pointers in the right direction!

Thank you all in advance,
newbo

[toc] | [next] | [standalone]


#35126

FromChris Angelico <rosuav@gmail.com>
Date2012-12-20 01:57 +1100
Message-ID<mailman.1052.1355929054.29569.python-list@python.org>
In reply to#35119
On Thu, Dec 20, 2012 at 1:28 AM,  <winona_whitener@yahoo.com> wrote:
> I am using telnetlib and the box that I'm connecting to has a special escape sequence--^]--to leave the prompt and go back to the regular telnet prompt.  For example, from teh command line I do this:
> ...
> When I pressing and hold Ctrl and then ], I go back to my normal telnet prompt and can quit.
>
> Using telnetlib, I can send commands and get responses.  But I'm stuck on sending the ctrl+]!  Is there some escape character--\c?--or a keycode like \^ to send through telnetlib?

The ctrl-] keystroke doesn't get sent down the wire, it's commands to
the _local_ telnet. For instance, if your session has stalled, you can
enter "^]close" to immediately disconnect. There won't be a direct way
to drop to "command mode" inside telnetlib, but you can do similar
actions with methods on the connection object (in that instance,
close() will do the job).

ChrisA

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web