Telnetlib and special quit characters with Ctrl, oh my!

Discussion in 'Python' started by winona_whitener@yahoo.com, Dec 19, 2012.

  1. Guest

    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
     
    , Dec 19, 2012
    #1
    1. Advertising

  2. On Thu, Dec 20, 2012 at 1:28 AM, <> 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
     
    Chris Angelico, Dec 19, 2012
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Danny

    Implement Ctrl-C, Ctrl-V

    Danny, Aug 14, 2003, in forum: C++
    Replies:
    5
    Views:
    666
    CBFalconer
    Aug 15, 2003
  2. Danny

    Implement Ctrl-C, Ctrl-V

    Danny, Aug 14, 2003, in forum: C Programming
    Replies:
    5
    Views:
    684
    CBFalconer
    Aug 15, 2003
  3. Angus
    Replies:
    5
    Views:
    2,199
    Michael Rauscher
    Nov 18, 2006
  4. Replies:
    2
    Views:
    1,446
    Munna
    Jul 10, 2008
  5. Replies:
    0
    Views:
    577
Loading...

Share This Page