Clipboard Trick to Hide Password from Users
Keywords: hide passwords
Question:
Can you hide text from a user's view using the sendkey command? I have a batch that logs into a server and sends the password. Just wondering if we can send astericks instead of the actual characters. SendKey("password")/hide or something.Answer:
- Generally the password dialog boxes are supposed to hide it for you.
- You could set up a "cover screen" (search database for "ignoreinput" and poke around. NB: The Function IgnoreInput only works in 16-bit Windows 3.1/3.11, and in Winbatch v2002B and later on Windows 98/ME/XP/2000, but not on 95 or NT4.)
- A WB user reported: I was faced with this same problem a while ago and used ClipPut to get around it as it is MUCH faster than SendKeys and allows (if the corresponding dialog box does) sending asterisks instead.
The following code can be modified for your situation.
userid="sa" password="mypassword" dummypass="nicetry" Run("%drive%\adm.exe","") While !WinExistChild("User Administration Login","Password:") TimeDelay(1) ; fill up clipboard with userid ClipPut(userid) TimeDelay(1) SendKeysTo("User Administration Login","^v{TAB}") ClipPut(password) TimeDelay(1) SendKeysTo("User Administration Login","^v{TAB}{SP}") ; fill up clipboard with dummypassword to prevent some smart user from using ; notepad to paste clipboard and discover password ClipPut(dummypass) Exit Endwhile
Article ID: W13305Filename: Clipboard Trick to Hide Password from Users.txt