|
From: Stormy <sto...@ya...> - 2012-02-06 13:56:14
|
Hi,
I'm new to jline, got basic things working, e.g.
pwd = con.readLine('Password: ', ' ')
[ couldn't set mask character to empty: ''; '*' is insecure ]
This works good enough, however, if the same exact script is run via SSH, then the password is ECHOED to the terminal.
I'm pretty sure that this is b/c when run without SSH, stdin is mapped to a real terminal (and the mask works, e.g. /dev/pts/83), however, when run via ssh, e.g.:
ssh remote-node ./jline-script.py
stdin is mapped to a socket, e.g.:
/proc/pid/fd/0 -> socket:[275180733]
And the socket can't make the noecho/mask work.
I know that I can use "ssh -t" and workaround it, but, is there a way for the script itself to automatically know if this is a real-terminal or not, so that users don't have to know to run with -t.
Unfortunately the programming environment is jython 2.2, so getpass, tty, termios, and similar system calls, including sys.stdin.isatty() are unavailable.. for example:
>>> sys.stdin.isatty()
AttributeError: 'file' object has no attribute 'isatty'
Tried looking at jline's "isSupported" "isEchoEnabled", etc. but couldn't find any option that can make that distinction..
Any tips welcomed.
|