Page 1 of 2

hide user input.

Posted: 30 Jun 2011 01:49
by arjun2988
How do i hide user input. This is for password field. I don want the password to be visible. I tried searchin in google. Couldn find any :(

Re: hide user input.

Posted: 30 Jun 2011 01:52
by Ed Dyreen

Code: Select all

>nul set /p myvar=[promptString]
Wait, let me guess your next question.... How do I encrypt/decrypt passwords ?
http://www.dostips.com/forum/viewtopic.php?f=3&t=1226&start=15&hilit=encrypt

Welcome to DosTips " :P "

Re: hide user input.

Posted: 30 Jun 2011 03:40
by arjun2988
Thanks for d response. Am sorry its not working :(:(. It is fine even if i can mask it with "*"... Pls Help

Re: hide user input.

Posted: 30 Jun 2011 03:48
by Ed Dyreen
:shock: [promptString] IS YOUR input

You've never used the set /? command before, have u ?

Re: hide user input.

Posted: 30 Jun 2011 04:12
by arjun2988
i don want others to see my what i type. That is my question

Re: hide user input.

Posted: 30 Jun 2011 04:16
by Ed Dyreen

Ok, I'm sorry, it apparently don't work from a batch :oops:

I couldn't find a working solution with set, but there is always the choice command.
That's a bit tricky though, you would have to use a loop..

something like:

Code: Select all

set input=
:loop
   >nul CHOICE /c:abcdefghi.........
   set input=%input%%errorlevel%
   if /i ["input"] neq ["659872"] goto :loop


An external app would be better though I don't know any :|

Re: hide user input.

Posted: 30 Jun 2011 04:17
by arjun2988
Thanks , I have been tryin to find it :( Can you please help ASAP

Re: hide user input.

Posted: 30 Jun 2011 04:19
by Cleptography
Yes its call Autocom.exe (InputBox) :lol:

Re: hide user input.

Posted: 30 Jun 2011 04:25
by Ed Dyreen
Autocom.exe :P :wink: :mrgreen:

this is what cleo means:
http://www.scriptingpros.com/scripts/cleptography/

Re: hide user input.

Posted: 30 Jun 2011 04:30
by Cleptography
Hooray for shameless advertising. Now make sure to integrate Ed's batch macros for optimum speed and performance. http://scriptingpros.com/viewforum.php?f=152
:wink:

Ed Dyreen wrote:this is what cleo means:

@Ed
Cleptography - Cleptography (key stealing) or executable modification of some popular mail systems.

Re: hide user input.

Posted: 30 Jun 2011 04:39
by Ed Dyreen

Euh cleo, best not advertise beta products to our friends...

An alpha is on the way :wink:

Re: hide user input.

Posted: 30 Jun 2011 05:35
by Cleptography
Ed Dyreen wrote:
Euh cleo, best not advertise beta products to our friends...

An alpha is on the way :wink:

:lol: You are absolutely correct I just checked v1 and realized inputbox had not been built yet. :oops:

@arjun2988
I put this together real quick for you as an example. This will show you masked input boxes, and an example of RC4 encryption.
http://www.scriptingpros.com/scripts/cleptography/PasswordExample.zip

I use this same method if I want to encrypt my batch files instead of compiling them into useless exe's that dump the source into the temp directory. I just include the encryption tool along with my script. Encrypt a password to decrypt the script, and I end up with a batch file that looks like this.

Code: Select all

3E73E01A529AF309F5015A50967158C4A3151CC19F6F6A078E47147455688AD99EE9B2F3675306D3535345A64058E52FC67FAD7F75E2B155CEFA0
C187CFB1F05EB2A09C614DEE4D687E65F9B2766EA9504C49FAC81CC434EF1622EE43F3C3C3AD625D9CECA11FAEDB372BBA0FE651F1891492743108855A39A4651769F06DA39019310
4FD86506F1D44386C59F16EE75E27FBBB1A3F0E326AF87242E581A

Run it through the decrypt app and execute the batch script.
Good luck :lol:

If you are on an XP machine you can use a combo of batch / vbs. This method apparently will not work on later versions or rather you would need scriptpw.dll to run it.

GetPwd.bat

Code: Select all

@echo off
:: GetPwd.cmd - Get password with no echo.
<nul: set /p passwd=Password:
for /f "delims=" %%i in ('cscript /nologo GetPwd.vbs') do set passwd=%%i
echo.
:: This bit's just to prove we have the password.
echo %passwd%

GetPwd.vbs

Code: Select all

Set oScriptPW = CreateObject("ScriptPW.Password")
strPassword = oScriptPW.GetPassword()
Wscript.StdOut.WriteLine strPassword

You could also check here: http://www.computerhope.com/forum/index.php?topic=69496.0

Re: hide user input.

Posted: 30 Jun 2011 10:39
by nitt
Cleptography wrote:
Ed Dyreen wrote:
Euh cleo, best not advertise beta products to our friends...

An alpha is on the way :wink:

:lol: You are absolutely correct I just checked v1 and realized inputbox had not been built yet. :oops:

@arjun2988
I put this together real quick for you as an example. This will show you masked input boxes, and an example of RC4 encryption.
http://www.scriptingpros.com/scripts/cleptography/PasswordExample.zip

I use this same method if I want to encrypt my batch files instead of compiling them into useless exe's that dump the source into the temp directory. I just include the encryption tool along with my script. Encrypt a password to decrypt the script, and I end up with a batch file that looks like this.

Code: Select all

3E73E01A529AF309F5015A50967158C4A3151CC19F6F6A078E47147455688AD99EE9B2F3675306D3535345A64058E52FC67FAD7F75E2B155CEFA0
C187CFB1F05EB2A09C614DEE4D687E65F9B2766EA9504C49FAC81CC434EF1622EE43F3C3C3AD625D9CECA11FAEDB372BBA0FE651F1891492743108855A39A4651769F06DA39019310
4FD86506F1D44386C59F16EE75E27FBBB1A3F0E326AF87242E581A

Run it through the decrypt app and execute the batch script.
Good luck :lol:

If you are on an XP machine you can use a combo of batch / vbs. This method apparently will not work on later versions or rather you would need scriptpw.dll to run it.

GetPwd.bat

Code: Select all

@echo off
:: GetPwd.cmd - Get password with no echo.
<nul: set /p passwd=Password:
for /f "delims=" %%i in ('cscript /nologo GetPwd.vbs') do set passwd=%%i
echo.
:: This bit's just to prove we have the password.
echo %passwd%

GetPwd.vbs

Code: Select all

Set oScriptPW = CreateObject("ScriptPW.Password")
strPassword = oScriptPW.GetPassword()
Wscript.StdOut.WriteLine strPassword

You could also check here: http://www.computerhope.com/forum/index.php?topic=69496.0


Not many people have XP these days, and who would even want to use a method only compatible with a single operating system?

Re: hide user input.

Posted: 30 Jun 2011 10:45
by !k

Re: hide user input.

Posted: 30 Jun 2011 11:04
by Cleptography
nitt wrote:Not many people have XP these days, and who would even want to use a method only compatible with a single operating system?

Who the hell knows.