hide user input.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
arjun2988
Posts: 6
Joined: 30 Jun 2011 01:33

hide user input.

#1 Post by arjun2988 » 30 Jun 2011 01:49

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 :(

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: hide user input.

#2 Post by Ed Dyreen » 30 Jun 2011 01:52


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 "

arjun2988
Posts: 6
Joined: 30 Jun 2011 01:33

Re: hide user input.

#3 Post by arjun2988 » 30 Jun 2011 03:40

Thanks for d response. Am sorry its not working :(:(. It is fine even if i can mask it with "*"... Pls Help

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: hide user input.

#4 Post by Ed Dyreen » 30 Jun 2011 03:48

:shock: [promptString] IS YOUR input

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

arjun2988
Posts: 6
Joined: 30 Jun 2011 01:33

Re: hide user input.

#5 Post by arjun2988 » 30 Jun 2011 04:12

i don want others to see my what i type. That is my question

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: hide user input.

#6 Post by Ed Dyreen » 30 Jun 2011 04:16


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 :|
Last edited by Ed Dyreen on 30 Jun 2011 04:24, edited 1 time in total.

arjun2988
Posts: 6
Joined: 30 Jun 2011 01:33

Re: hide user input.

#7 Post by arjun2988 » 30 Jun 2011 04:17

Thanks , I have been tryin to find it :( Can you please help ASAP

Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

Re: hide user input.

#8 Post by Cleptography » 30 Jun 2011 04:19

Yes its call Autocom.exe (InputBox) :lol:

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: hide user input.

#9 Post by Ed Dyreen » 30 Jun 2011 04:25

Autocom.exe :P :wink: :mrgreen:

this is what cleo means:
http://www.scriptingpros.com/scripts/cleptography/
Last edited by Ed Dyreen on 30 Jun 2011 04:47, edited 1 time in total.

Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

Re: hide user input.

#10 Post by Cleptography » 30 Jun 2011 04:30

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.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: hide user input.

#11 Post by Ed Dyreen » 30 Jun 2011 04:39


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

An alpha is on the way :wink:

Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

Re: hide user input.

#12 Post by Cleptography » 30 Jun 2011 05:35

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

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: hide user input.

#13 Post by nitt » 30 Jun 2011 10:39

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?

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: hide user input.

#14 Post by !k » 30 Jun 2011 10:45


Cleptography
Posts: 287
Joined: 16 Mar 2011 19:17
Location: scriptingpros.com
Contact:

Re: hide user input.

#15 Post by Cleptography » 30 Jun 2011 11:04

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.

Post Reply