[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [offtopic] Dont't ECHO



Nuno Carvalho <nemanuel@student.dei.uc.pt> writes:

>  Hi,
> 
>   I'm trying to, using socket programming, ask the remote user for login 
> and password. I would like that password won't appears on remote machine 
> when user is typing it. I already saw RFC's but it doesn't worked ! :(((
> 
>  Could someone send me such part of code !? 
>  Should IAC + DONT + TELOPT_ECHO sent to socket or client descriptor !? 

You're misunderstanding the RFCs.  In terms of telnet options, the
"ECHO" refers to whether the local or remote end of the connection
should handle echoing the characters back to the user.  The way telnet
does what it does is by having the server send "IAC WILL ECHO" and
then having the server only echo those characters that should be
echoed.  I have attached below a transcript of a simple telnet session
to show you what's going on.  You may also need to send the telnet
option that means "one character at a time" transmission and not
"line-by-line" mode.  I'm not quite certain how to do this; I believe
it has something to do with manipulating the "go-ahead" option, and
supressing it.  I'd try to do the following:

Server> IAC WILL SUPRESS-GO-AHEAD
Client> IAC DO SUPRESS-GO-AHEAD
Server> <present login prompt>
Client> <send username>
Server> IAC WILL ECHO
Client> IAC DO ECHO
Server> <present password prompt>
Client> <send password>
Server> IAC WONT ECHO

I'm not certain what you should get if the client isn't willing to do
the supress-go-ahead stuff; if the client responds with a "don't
echo", then there's really no way to prevent the password from being
displayed.

Looking at your mail again, it appears that you are writing both the
client and the server part of this application - if so, then you
shouldn't be touching telnet options at all - you should only deal
with the telnet options if you expect people to be using telnet to
connect to your server.  If you are writing the client as well as the
server, look at the getpass function that someone else mentioned, or
look at the termios(3) manpage for how to turn terminal echoing off.

Here's the transcript of a telnet session to my machine - the CLIENT
or SERVER refers to the machine which sent each bunch of data.  Note
that this transcript is complicated by many other options, but I think
that only the echo and supress-go-ahead options are relevant.  (These
begin around record number 5, below).

Record number 1 (SERVER), length 12

 FFFD18FF FD20FFFD 23FFFD27 xxxxxxxx .ý..ý .ý#.ý'     000001

Record number 2 (CLIENT), length 12

 FFFB18FF FB20FFFC 23FFFB27 xxxxxxxx .û..û .ü#.û'     000001

Record number 3 (SERVER), length 18

 FFFA2001 FFF0FFFA 2701FFF0 FFFA1801 .ú ..ð.ú'..ð.ú.. 000001
 FFF0xxxx xxxxxxxx xxxxxxxx xxxxxxxx .ð               000002

Record number 4 (CLIENT), length 38

 FFFA2000 33383430 302C3338 343030FF .ú .38400,38400. 000001
 F0FFFA27 00FFF0FF FA180068 79706572 ð.ú'..ð.ú..hyper 000002
 7465726D FFF0xxxx xxxxxxxx xxxxxxxx term.ð           000003

Record number 5 (SERVER), length 15

 FFFB03FF FD01FFFD 1FFFFB05 FFFD21xx .û..ý..ý..û..ý!  000001

Record number 6 (CLIENT), length 24

 FFFD03FF FC01FFFB 1FFFFA1F 00500018 .ý..ü..û..ú..P.. 000001
 FFF0FFFD 05FFFB21 xxxxxxxx xxxxxxxx .ð.ý..û!         000002

Record number 7 (SERVER), length 43

 FFFB0144 65626961 6E20474E 552F4C69 .û.Debian GNU/Li 000001
 6E757820 736C696E 6B206375 73682E64 nux slink cush.d 000002
 796E2E6D 6C2E6F72 670D0Axx xxxxxxxx yn.ml.org..      000003

Record number 8 (CLIENT), length 3

 FFFD01xx xxxxxxxx xxxxxxxx xxxxxxxx .ý.              000001

Record number 9 (SERVER), length 14

 0D0A6375 7368206C 6F67696E 3A20xxxx ..cush login:    000001

Record number 10 (CLIENT), length 1

 75xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx u                000001

Record number 11 (SERVER), length 1

 75xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx u                000001

Record number 12 (CLIENT), length 1

 73xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx s                000001

Record number 13 (SERVER), length 1

 73xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx s                000001

Record number 14 (CLIENT), length 1

 65xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx e                000001

Record number 15 (SERVER), length 1

 65xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx e                000001

Record number 16 (CLIENT), length 1

 72xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx r                000001

Record number 17 (SERVER), length 1

 72xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx r                000001

Record number 18 (CLIENT), length 1

 6Exxxxxx xxxxxxxx xxxxxxxx xxxxxxxx n                000001

Record number 19 (SERVER), length 1

 6Exxxxxx xxxxxxxx xxxxxxxx xxxxxxxx n                000001

Record number 20 (CLIENT), length 1

 61xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx a                000001

Record number 21 (SERVER), length 1

 61xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx a                000001

Record number 22 (CLIENT), length 1

 6Dxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx m                000001

Record number 23 (SERVER), length 1

 6Dxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx m                000001

Record number 24 (CLIENT), length 1

 65xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx e                000001

Record number 25 (SERVER), length 1

 65xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx e                000001

Record number 26 (CLIENT), length 2

 0D00xxxx xxxxxxxx xxxxxxxx xxxxxxxx ..               000001

Record number 27 (SERVER), length 12

 0D0A5061 7373776F 72643A20 xxxxxxxx ..Password:      000001

Record number 28 (CLIENT), length 10

 70617373 776F7264 0D00xxxx xxxxxxxx password..       000001

Record number 29 (SERVER), length 33

 0D0A4C6F 67696E20 696E636F 72726563 ..Login incorrec 000001
 740D0A0D 0A637573 68206C6F 67696E3A t....cush login: 000002
 20xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx                  000003

Record number 30 (CLIENT), length 1

 04xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx .                000001

*** Disconnect ***


Reply to: