[jawsscripts] Re: do not echo passwords in ssh

  • From: "John Heim" <john@xxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Tue, 30 Oct 2012 17:06:55 -0500

I have a jaws script that can be used to silence jaws during the entry of a
password in a terminal emulator program.  This is my first attempt at jaws
scripting and, in fact, I'm not really satisfied with it. I still think it
should work by checking if the character you just typed is echoed on the
screen. If not, do not speak it. But instead, I took Doug Lee's advice and
looked for a password prompt in the text on the screen. Actually, what the
code below does is turn off key echo when you press enter. Then it turns it
back on unless the the current line ends with a colon. The reason I did it
that way is that if key echo is already on, then it doesn't try to analyse
the prompt. So with most keypresses, it is more efficient. Its going to look
for the colon when you type the first character on any given line but if it
decides its not a password prompt, it turns echo back on and does not check
again for the rest of the characters you type on that line. 

Also, I am not too sure about the wisdom of checking just for a colon. It
works for MySql, ssh, and sudo.  But there may be other programs that donn't
use a colon. And there may be programs that use prompts that end in a colon
that are not password fields. But I didn't want to mess with string matching
and case sensitivity.  

Void Function KeyPressedEvent (int nKey, string strKeyName, int
nIsBrailleKey, int nIsScriptKey) 
        if (strKeyName == "enter") Then
                setJCFOption(OPT_Typing_Echo, 0)
        Else
                If (getJCFOption(OPT_Typing_Echo) == 0) Then
                        If (Not isPassWordPrompt()) Then
                        setJCFOption(OPT_Typing_Echo, 1)
EndIf
                EndIf
        EndIf
endFunction

int Function isPasswordPrompt()
        Var Int nChar
        SaveCursor()
        InvisibleCursor() ; Activates the Invisible cursor 
        RouteInvisibleToPC() ; Move the Invisible cursor to the PC cursor so
it is in the correct window. 
        PriorCharacter()
        Let nChar = GetCharacterValue(GetCharacter())
        While (nChar == 32)
                PriorCharacter()
                Let nChar = GetCharacterValue(GetCharacter())
        EndWhile        
        RestoreCursor()
        If (nChar == 58) Then
                Return True
        Else
                Return False
        EndIf
        EndFunction


__________�

View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: