Telnet IAC command answering

13,455

Solution 1

From RFC 854:

Since the NVT is what is left when no options are enabled, the DON'T and WON'T responses are guaranteed to leave the connection in a state which both ends can handle. Thus, all hosts may implement their TELNET processes to be totally unaware of options that are not supported, simply returning a rejection to (i.e., refusing) any option request that cannot be understood.

That is, for every WILL, respond DONT. For every DO, respond WONT.

In your case, you've received (see IANA assigned telnet options):

255 253 1    IAC DO ECHO
255 253 31   IAC DO NAWS
255 251 1    IAC WILL ECHO
255 251 3    IAC WILL SUPPRESS-GO-AHEAD

So you should respond:

255 252 1    IAC WONT ECHO
255 252 31   IAC WONT NAWS
255 254 1    IAC DONT ECHO
255 254 3    IAC DONT SUPPRESS-GO-AHEAD

Note that you don't have to know what 1, 3, or 31 actually mean. That's the beauty. You can refuse those options without even knowing their definition. You'll just default to the network virtual terminal.

Solution 2

Looking it up in RFC 854

255 253 1  IAC DO #1 
255 253 31 IAC DO #31
255 251 1  IAC WILL #1
255 251 3  IAC WILL #3

Now looking up the parameter values in here: 1 := echo, 31 := window size.

Share:
13,455
Cindy Broutin
Author by

Cindy Broutin

Updated on June 05, 2022

Comments

  • Cindy Broutin
    Cindy Broutin almost 2 years

    I'm trying to negotiate a telnet connection with a socket. The socket is working,but the server is telling me that thing:

    ÿýÿýÿûÿû
    
    login:
    

    The ÿýÿýÿûÿû means 255 253 1 255 253 31 255 251 1 255 251 3

    I read all the RFC docs but I don't understand what should I respond with to be able to send (string ascii data?) to the server, my wish is to run the login prompt successfully and then send commands to a server like "halt" or something else.

    Thanks in advance for your answer.