Jump to content

Recommended Posts

Posted

Hi

Our application runs in CMD file. We prompt for a password. We have a requirement where in , in a 64 bit windows machine (XP) or anyother flavours , we have to mask the password. We tried using powershell.Now we are able to show the password as asterisk in the CMD screen and able to store the password in a file after decryption. But not able to retrieve the password from the file. But for security point of view we should not store the password in a file.

We had used the following commands:

# Read the string as securestring

[system.Security.SecureString]$secureStringValue = Read-Host -AsSecureString "Enter Password";

# Convert the securestring to string

[string]$stringValue = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureStringValue))

****

Please let us know anyother way where we can store the password in memory and retrieve it also in String format..


Posted

You're going to have to provide more information than that!

What is the password used for?, Is it being verified against something?, Why does it need storing?, Why are you encrypting/decrypting it?, When you say string format are you suggesting that there are non alphanumeric characters?, Why a cmd file?

Posted

Hi

Basically we have a utility to start and stop some weblogic servers. This utility has to be run in windows as part of porting to all platforms. The password is the weblogic password we give to pass it to the utility to do processing further.The password should either be seen in asterisk form when typing , or invisible. The password might contain non alphanumeric character too.

thanks

sab

Posted

A possibility:

http://www.robvanderwoude.com/vbstech_ui_password.php

http://www.robvanderwoude.com/vbstech_ui_changepassword.php

This shoukd NOT work on 7, but may :unsure: in XP64 :

http://drbatcher.blogspot.com/2011/03/hiding-password-input-in-batch-files.html

Are .com files supported in XP 64 bit? :unsure:

There is a possible way through ANSY.SYS usage:

http://www.computing.net/answers/dos/how-do-i-hide-keyboard-input-in-a-batch-/7152.html

or a near-solution using COLOR:

http://www.dostips.com/forum/viewtopic.php?p=602&sid=3353dd3f344724a7645bcbb7f9533cc8

Using editv is more like it (still if we are talking of ".cmd" or "batch"):

http://www.westmesatech.com/editv.html

but see here also:

jaclaz

Posted

Could you not use a HTA with VBS scripting or JS scripting

Example with Username and Masked Textbox HTA

Demo_Password.hta


<!--
Created By Gunsmokingman Aka Jake1Eye
4:33 PM November-28-11
-->
<TITLE>Demo Password</TITLE>
<HTA:APPLICATION ID="Demo Password"
APPLICATIONNAME="GsmDemoPW"
Border="Thin"
BORDERSTYLE ="Complex"
Caption="Yes"
INNERBORDER ="No"
MaximizeButton="No"
MinimizeButton="No"
Scroll="No"
SCROLLFLAT ="No"
ShowInTaskBar='No'
SingleInstance="Yes"
SysMenu="No"
WindowState="Normal"/>
<STYLE Type='text/css'>
Body
{
Font-Size:9.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:Black;
BackGround-Color:Transparent;
Filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='#ece6e0',EndColorStr='#c0bab4');
Margin-Top:21;
Margin-Bottom:1;
Margin-Left:4;
Margin-Right:4;
Padding-Top:1;
Padding-Bottom:1;
Padding-Left:4;
Padding-Right:4;
Text-Align:Center;
Vertical-Align:Top;
Border-Top:0px Transparent;
Border-Bottom:0px Transparent;
Border-Left:0px Transparent;
Border-Right:0px Transparent;
}
BUTTON
{
Cursor:Hand;
Height:19;
Width:69;
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:#001141;
Text-Align:Center;
Vertical-Align:Middle;
Filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='AliceBlue',endColorStr='LightSlateGray');
Border-Top:0px Transparent;
Border-Bottom:0px Transparent;
Border-Left:0px Transparent;
Border-Right:0px Transparent;
Padding-Top:0;
Padding-Bottom:0;
Padding-Left:0;
Padding-Right:0;
Margin-Top:2;
Margin-Bottom:0;
Margin-Left:1;
Margin-Right:1;
BackGround-Color:Transparent;
}
INPUT
{
Height:17;
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
}
</STYLE>
<script Language='VBScript'>
'-> Resize And Move Window
Dim Wth :Wth = int(325)
Dim Hht :Hht = int(175)
window.ResizeTo Wth, Hht
MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))
'-> Function To Process Submit Button
Function PwChk()
If Len(Pswd.value) >= 4 And Len(UsNm.value) >= 4 Then
alert(UsNm.value & vbcrlf & Pswd.value)
ElseIf Len(Pswd.value) =< 3 And Len(UsNm.value) >= 4 Then
alert("Password Must Be At Least 4 Characters" & vbcrlf & _
Len(Pswd.value) & vbcrlf & _
"User Name Is 4 Characters Or Better" & vbcrlf & _
Len(UsNm.value))
Pswd.value = ""
ElseIf Len(Pswd.value) >= 4 And Len(UsNm.value) =< 3 Then
alert("Password Is 4 Characters Or Better" & vbcrlf & _
Len(Pswd.value) & vbcrlf & _
"User Name Must Be At Least 4 Characters" & vbcrlf & _
Len(UsNm.value))
UsNm.value = ""
ElseIf Len(Pswd.value) = 0 And Len(UsNm.value) = 0 Then
alert("No Values In The Textboxes")
End If
End Function
</Script>
<BODY>
<!-- UserName -->
<DIV>Please Type In Your Username?<BR>
<INPUT Type='Text' Name='UsNm' MaxLength='28' Size='30'/>
</DIV>
<!-- Password -->
<DIV>Please Type In Your Password?<BR>
<INPUT Type='password' Name='Pswd' MaxLength='12' Size='30'/>
</DIV>
<!-- Buttons -->
<DIV>
<BUTTON ID='B01' OnClick='PwChk()'>Submit</BUTTON>
<BUTTON ID='B02' OnClick='UsNm.value = "":Pswd.value = ""'>Clear</BUTTON>
<BUTTON ID='B03' OnClick='window.Close()'>Close</BUTTON>
</DIV>
</BODY>

post-5386-0-12437500-1322527139_thumb.pn

Demo_Password.zip

Posted

Hi All

Thanks for your reply. It will be great if we can get a solution without using VBScript and other tools.

thanks

sab

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...