Telnetlib and special quit characters with Ctrl, oh my!
rosuav at gmail.com
Wed Dec 19 15:57:18 CET 2012
On Thu, Dec 20, 2012 at 1:28 AM, <winona_whitener at 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).
More information about the Python-list