14

I am trying to suppress the local echo of a password in a telnet session by sending 0xFF 0xFD 0x2D (IAC DO SUPPRESS_LOCAL_ECHO). This works fine.

My trouble is enabling the local echo after the password. I am sending 0xFF 0xFE 0x2D (IAC DONT SUPPRESS_LOCAL_ECHO). But I don't see any of my commands that I type afterwards.

I am using the MS Telnet program to connect.

The IAC is describe here.

The Suppress Local Echo is defined here

Robert Deml
  • 12,390
  • 20
  • 65
  • 92
  • could you possibly provide the code you used to send the suppress local echo? See my related question - http://stackoverflow.com/questions/6410579/how-to-disable-echo-when-sending-a-terminal-command-using-apache-commons-net-teln :) – mre Jun 23 '11 at 19:18
  • I could not find a good way to do this. My workaround is to send a backspace and then a '*' to try to overwrite the character. This works mostly, but if the user types fast 2 characters could appear and only 1 backspace is sent. – Robert Deml Jun 24 '11 at 12:38

4 Answers4

20

During your telnet sessions in telnet.exe you can pop up the telnet prompt by pressing Ctrl + ]

After that, type "set localecho" or "unset localecho" to switch localecho on or off.

Press Enter to return to your telnet session.

Wouter van Nifterick
  • 23,603
  • 7
  • 78
  • 122
  • 5
    But I want to do this from the remote side. The remote side is asking for the password. I got the supression to work, just not the unsupression. – Robert Deml Jul 13 '09 at 13:28
6

Wrong sequence above. According to some document i found, my sequence should be wrong (WILL/WONT flipped). However it worked with Putty and MS Telnet - strange.

Please try this:

// Supress Echo on client:
out.write(0xFF);    // IAC
out.write(0xFB);    // WILL
out.write(0x01);    // ECHO

// Enable again with:
out.write(0xFF);    // IAC
out.write(0xFC);    // WONT
out.write(0x01);    // ECHO
Oliver Rode
  • 69
  • 1
  • 2
4

According to my investigations today:

  1. The MS Telnet client accepts 'set localecho' and 'unset localecho' but does nothing with them except record the state. It doesn't send anything on the wire. The real state of the client remains 'no local echo' no matter what you do and what 'd' says.

  2. The MS Telnet server sends IAC,WILL,ECHO, and in reply accepts IAC,DO,ECHO, and IAC,DONT,ECHO, but completely ignores them, remaining in WILL ECHO state throughout. You can send IAC,DO,ECHO or IAC,DONT,ECHO later on and it won't even reply.

Accordingly, if you are either using the MS client to speak to a non-MS Telnet server or using another client to speak to the MS Telnet server you better stay in no-local-echo mode, otherwise you will get dual echoing.

Windows Vista 64.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • The MS Telnet Client is known to be broken in terms of handling the ECHO option - when a Host on a Telnet connection is in "ECHO" this means it will echo to the other end __what is sent to it__ (may not be an exact copy, it is allowed to "cook" the data) - however the starting point for any Telnet client/host must be NOT to ECHO until both sides agree to it. Also for this particular option it is not allowed for both ends to echo what they receive as then characters will get ECHOed indefinitely - except that the MS one says it will but never does (!) and keeping the other end in "no ECHO". – SlySven Jul 15 '17 at 03:24
-2

Send a backspace and then a *. This will backup the cursor and then print a * over the character they just printed. If it is a slow connection the character may be there for some amount of time. Also look for the '\n' and don't try to over write that.

Robert Deml
  • 12,390
  • 20
  • 65
  • 92
  • 1
    I'm not sure this should be the accepted answer (I know, 8 years old!). This is hiding it _after_ it was already displayed _and_ sending extra characters. Note that many clients (think Linux, Mac) will not properly interpret backspace. – Abel Oct 08 '17 at 20:23
  • This could work I suppose, unless you're in LINEMODE EDIT. So watch for that. – Jason C May 28 '21 at 16:59