Telnet IAC command answering

霸气de小男生 提交于 2019-11-30 09:15:47

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!