Using TelnetLib with a Cisco Wireless Controller

1.3k views Asked by At

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?

1

There are 1 answers

0
Srivatsa On

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')