MSFN Forum: CMD:Password should not be displayed - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CMD:Password should not be displayed Rate Topic: -----

#1 User is offline   sab 

  • Group: Members
  • Posts: 3
  • Joined: 28-November 11
  • OS:XP Pro x64
  • Country: Country Flag

Posted 28 November 2011 - 07:00 AM

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..


#2 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,369
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 28 November 2011 - 08:44 AM

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?

#3 User is offline   sab 

  • Group: Members
  • Posts: 3
  • Joined: 28-November 11
  • OS:XP Pro x64
  • Country: Country Flag

Posted 28 November 2011 - 09:38 AM

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

#4 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,576
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 28 November 2011 - 10:23 AM

A possibility:
http://www.robvander...ui_password.php
http://www.robvander...ngepassword.php

This shoukd NOT work on 7, but may :unsure: in XP64 :
http://drbatcher.blo...atch-files.html
Are .com files supported in XP 64 bit? :unsure:

There is a possible way through ANSY.SYS usage:
http://www.computing...atch-/7152.html
or a near-solution using COLOR:
http://www.dostips.c...45bcbb7f9533cc8


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:
http://www.msfn.org/...mething-to-ask/

jaclaz

#5 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,356
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 28 November 2011 - 06:40 PM

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>



Attached File  GsmPwDemo.png (20.97K)
Number of downloads: 1
Attached File  Demo_Password.zip (1.34K)
Number of downloads: 4

#6 User is offline   sab 

  • Group: Members
  • Posts: 3
  • Joined: 28-November 11
  • OS:XP Pro x64
  • Country: Country Flag

Posted 28 November 2011 - 11:20 PM

Hi All

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

thanks
sab

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy