Telnet server enable client linemode

若如初见. 提交于 2019-12-10 17:09:17

问题


I am writing a little Telnet client on Arduino. How do I reactivate the Telnet client linemode after I deactivate it with the following code?

  client.write(255); // IAC
  client.write(251); // WILL
  client.write(1);   // ECHO

  client.write(255); // IAC
  client.write(251); // WILL
  client.write(3);   // suppress go ahead

  client.write(255); // IAC
  client.write(252); // WONT
  client.write(34);  // LINEMODE

for password typing.

I tried the reverse commands, but they don't work.


回答1:


Using the BSD telnet client, use the following commands:

set debug
set prettydump
set options
set netdata

then, character-at-a-time mode and line-at-a-time mode can be switched, using commands,

mode line
mode character

The negotiation that follows can be inspected and duplicated.

However, it should be sufficient to send only IAC DONT ECHO, the password, CR NUL, then IAC DO ECHO. Entering "character at a time" mode using "WILL ECHO, WILL SGA" is called "kludge mode" -- re-enabling ECHO should default to standard NVT behavior (linemode).

bsd client, however, with full extended linemode support. It is not trivial, nearly 50% of the codebase (forwardmask, slc, callbacks, etc.).

If the server replies WONT LINEMODE, then it is still actually in the default NVT linemode -- it just is not in the enhanced linemode or does not care to negotiate about it. Which is why sending DO LINEMODE is actually a terrible idea, as you will need to expect to acknowledge the sub-negotiation protocols for linemode from later rfc's.

A server that replies DO LINEMODE will likely continue to request linemode sub-negotiation, such as IAC SB LINEMODE MODE <1 byte bitmask>, and IAC SB LINEMODE FORWARDMASK . Decline this response with a WONT FORWARDMASK. The MODE must have ACK bit set and be replied similarly.



来源:https://stackoverflow.com/questions/12093057/telnet-server-enable-client-linemode

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