Hide keyboard input
James T. Dennis
jadestar at idiom.com
Tue Nov 21 01:55:02 EST 2000
Alexei Kichkine <ax at infocentr.ru> wrote:
> Carsten Gaebler wrote:
>> Hi!
>> I'm writing a program that is to be exectued via inetd and prompts for a
>> password. To read the password I'm using sys.stdin.readline() which has
>> the disadvantage that the password is printed on the screen while being
>> typed in. I tried getpass.getpass() to hide it but it raises an
>> exception (seems it's looking for some kind of terminal):
> If you use inetd you cannot manage the terminal..
> Best regards, YAnother
Hmm. Is there some way you could use in.telnetd
(perhaps with the -p option to specify an alternative
"login" program)? I guess you could have a small
C wrapper that would perform any authentication and
sanity checks; then exec your Python script. At
that point you should have a properly allocated and
inititialized pty (psuedo-terminal) and all of the
usual ncurses/curses and other terminal control
functions should work.
(It seems that -p is accepted in the BSD and Linux
versions of telnetd --- I don't know about *nixen).
More information about the Python-list
mailing list