cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
286
Views
0
Helpful
2
Replies

python telnet client response how to decode it

globantt
Level 1
Level 1

 python telnet client response how to decode it  I think it is a specific response as all cisco servers have the same response . What is the name of this text and how do I decrypt it '\xff\xfb\x01\xff\xfb\x03\xff\xfd\x18\xff\xfd\x1f'   import socket import sys HOST = 'xxx.xxx.xxx.xxx' # this is my cisco server ip PORT = 23 import socket import gzip s = socket.socket() #Connecting using telnet s.connect((HOST,23)) a = s.recv(10000) print(str(a)) #'\xff\xfb\x01\xff\xfb\x03\xff\xfd\x18\xff\xfd\x1f'

2 Replies 2

It's a series of bytes that tell the client and server what features they want to enable for the connection.

Decoding the Bytes:

 

  • \xff: This byte marks the start of a Telnet command.
  • \xfb: This byte indicates the "WILL" option, meaning the server is proposing to enable a feature.
  • \x01: This byte signifies the Echo option. With Echo enabled, the server will send back whatever it receives from the client.
  • \x03: This byte represents the Suppress Go Ahead (SGA) option. When enabled, the server won't send a "Go Ahead" character (usually a CR or \r) after receiving a command from the client.
  • \xfd: This byte marks the start of a Telnet subnegotiation (used for options with additional parameters).
  • \x18: This byte specifies the Echo character (typically a CR or \r).
  • \x1f: This byte signifies the Erase character (usually a backspace or BS).

 

 

In simpler terms:

  • The server is proposing to enable Echo, meaning it will echo back what the client sends.
  • The server also suggests disabling the "Go Ahead" signal after commands.
  • The server defines the Echo character (carriage return) and Erase character (backspace) if these options are negotiated.
 

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Ruben Cocheno
Spotlight
Spotlight

@globantt 

Try to use netmiko

Tag me to follow up.
Please mark it as Helpful and/or Solution Accepted if that is the case. Thanks for making Engineering easy again.
Connect with me for more on Linkedin https://www.linkedin.com/in/rubencocheno/