0

I'm trying to write scripting to make networking easier, and I can connect to the Cisco Switches, but I am unable to connect to a Cisco Wireless Controller. When I connect, it closes the connection with the following message.

Raw mode will not be supported, Closing connection.

There is another post on Stack Exchange that says to create a options handler callback and print out what the server is sending so I can handle it ahead of time.

So I created a simple callback function that prints the arguments sent.

def debugcallback(first, second, third):
    print second
    print third

However, the output from this is

√ ☺ √ ♥ √ ☺ √ ♥

Which gives me no hope at all of handling the options.

So my question is either, how can I make the options readable and respond to them, or how specifically can I connect to a WLC? Or is there another telnet package I can use that will work?

iargue
  • 69
  • 2
  • 13
  • 1
    It looks like the cisco device is trying to negotiate some telnet protocol options and isn't happy because it doesn't receive a response. Try printing the hex representation of the values, then dive into RFC 854 (http://tools.ietf.org/html/rfc854.html) to find out what they mean. You will have to implement your own response mechanism in your callback. – jwygralak67 Dec 11 '13 at 17:19
  • How would I print the hex representation? – iargue Dec 11 '13 at 23:48
  • for ch in second: print hex(ord(ch)) – jwygralak67 Dec 13 '13 at 17:24

1 Answers1

0

Send the telnet options through the exposed socket interface provided by the telnetlib. see below:

tn = Telnet()
tn.set_debuglevel(debug_level)
tn.open(<ipaddress>)
tn.read_some()
tn.get_socket().send(b'\xff\xfd\x03\xff\xfd\x01')