Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Go Back   EduGeek.net Forums > Coding and Web Development > Coding
Reply
 
LinkBack Thread Tools Search Thread Language
Sponsored Links
Old 08-03-2007, 04:12 PM   #1
 
ashok's Avatar
 
Join Date: Oct 2005
Location: East Midlands
Posts: 477
Thanks: 5
Thanked 36 Times in 23 Posts
Rep Power: 12 ashok has a spectacular aura aboutashok has a spectacular aura about
Default Masking the password on inputbox vbscript

Hi All,

Just wondering if anyone know how to mask the password on an inputbox when the user is typing in the password.

I have a situation where i'm tryin to use vb script (using the wscript) which prompts for the username and password but the password obviously needs to masked with *'s or other character.

Looked around on the net but not got much info except using IE to mask and incoporating this into the script.

Any ideas?

Ash.
  Reply With Quote
Old 08-03-2007, 04:17 PM   #2
 
djm968's Avatar
 
Join Date: Sep 2006
Location: Essex
Posts: 553
Thanks: 0
Thanked 3 Times in 3 Posts
Rep Power: 6 djm968 is on a distinguished road
Default Re: Masking the password on inputbox vbscript

This link should help

http://www.autoitscript.com/autoit3/...s/InputBox.htm
  Reply With Quote
Old 08-03-2007, 04:25 PM   #3
 
mattx's Avatar
 
Join Date: Jan 2007
Posts: 2,361
uk uk city of london
Thanks: 15
Thanked 90 Times in 68 Posts
Rep Power: 30 mattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to behold
Default Re: Masking the password on inputbox vbscript

Not sure if this is of any use to you - [ Its written in AutoIT ] It may give you an idea...
Just need to change the $sPass to what you want....
Quote:

; AutoIt Version: 3
; Language: English
; Platform: WinXP
; Author: Matt Marsh - mmarsh@st-johns.org.uk
; Script Function: Script that Launches Fun With Texts Teacher Console

$sPass = 'password'
Do
$sInput = InputBox( "Password Prog By Matt Marsh", "Insert password to Launch Fun With Texts Teacher Console" & @LF & "The password is CaSe SeNSiTIve.", "", ".")
If @error Then Exit
If $sPass == $sInput Then ExitLoop
MsgBox(4096 + 16, 'Error!', 'Password didn''t match.' & @LF & 'Try again.')
Until 0
Run("P:\FWT3\FWTT.EXE")
  Reply With Quote
Old 08-03-2007, 04:27 PM   #4
 
Geoff's Avatar
 
Join Date: Jun 2005
Location: Fylde, Lancs, UK.
Posts: 9,931
uk uk lancashire
Thanks: 42
Thanked 230 Times in 209 Posts
Blog Entries: 1
Rep Power: 67 Geoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud of
Send a message via ICQ to Geoff Send a message via AIM to Geoff Send a message via MSN to Geoff Send a message via Yahoo to Geoff Send a message via Skype™ to Geoff
Default Re: Masking the password on inputbox vbscript

Just be aware that it's not totally secure. Any password dialog box can be snooped at GDI level.
  Reply With Quote
Old 08-03-2007, 04:35 PM   #5
 
mac_shinobi's Avatar
 
Join Date: Aug 2005
Posts: 1,692
Thanks: 11
Thanked 30 Times in 29 Posts
Rep Power: 15 mac_shinobi has a spectacular aura aboutmac_shinobi has a spectacular aura about
Default Re: Masking the password on inputbox vbscript

http://www.microsoft.com/technet/scr...5/hey0204.mspx

http://www.petri.co.il/forums/showthread.php?p=42406
  Reply With Quote
Old 08-03-2007, 04:36 PM   #6
 
djm968's Avatar
 
Join Date: Sep 2006
Location: Essex
Posts: 553
Thanks: 0
Thanked 3 Times in 3 Posts
Rep Power: 6 djm968 is on a distinguished road
Default Re: Masking the password on inputbox vbscript

Just to clarify.... what you are trying to do to my knowledge cannot be done using pure vbscript this code uses an IE object to mask the password

Code:
Dim bPasswordBoxWait ' A required global variable 
wsh.echo "You entered:", PasswordBox("Enter your password") 

Function PasswordBox(sTitle) 
  set oIE = CreateObject("InternetExplorer.Application") 
  With oIE 
    .FullScreen = True 
    .ToolBar   = False : .RegisterAsDropTarget = False 
    .StatusBar = False : .Navigate("about:blank") 
    While .Busy : WScript.Sleep 100 : Wend 
    With .document 
      With .ParentWindow 
        .resizeto 400,100 
        .moveto .screen.width/2-200, .screen.height/2-50 
      End With 
      .WriteLn("<html><body bgColor=Silver><center>") 
      .WriteLn("[b]" & sTitle & "[b]

") 
      .WriteLn("Password <input type=password id=pass>  " & _ 
               "<button id=but0>Submit</button>") 
      .WriteLn("</center></body></html>") 
      With .ParentWindow.document.body 
        .scroll="no" 
        .style.borderStyle = "outset" 
        .style.borderWidth = "3px" 
      End With 
      .all.but0.onclick = getref("PasswordBox_Submit") 
      .all.pass.focus 
      oIE.Visible = True 
      bPasswordBoxOkay = False : bPasswordBoxWait = True 
      On Error Resume Next 
      While bPasswordBoxWait 
        WScript.Sleep 100 
        if oIE.Visible Then bPasswordBoxWait = bPasswordBoxWait 
        if Err Then bPasswordBoxWait = False 
      Wend 
      PasswordBox = .all.pass.value 
    End With ' document 
    .Visible = False 
  End With   ' IE 
End Function 


Sub PasswordBox_Submit() 
  bPasswordBoxWait = False 
End Sub
  Reply With Quote
Old 08-03-2007, 04:36 PM   #7
 
mattx's Avatar
 
Join Date: Jan 2007
Posts: 2,361
uk uk city of london
Thanks: 15
Thanked 90 Times in 68 Posts
Rep Power: 30 mattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to behold
Default Re: Masking the password on inputbox vbscript

Quote:
it's not totally secure. Any password dialog box can be snooped at GDI level.
Indeed, its only meant as an internal quick and dirty script.....I don't have time to code an encrypted password script...
  Reply With Quote
Old 08-03-2007, 04:38 PM   #8
 
mattx's Avatar
 
Join Date: Jan 2007
Posts: 2,361
uk uk city of london
Thanks: 15
Thanked 90 Times in 68 Posts
Rep Power: 30 mattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to behold
Default Re: Masking the password on inputbox vbscript

All that to mask a password ? Whats the world comming to.......
  Reply With Quote
Old 08-03-2007, 04:46 PM   #9
 
fooby's Avatar
 
Join Date: Dec 2005
Posts: 348
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 7 fooby is on a distinguished road
Default Re: Masking the password on inputbox vbscript

Perhaps this might be of use.

http://internet.cybermesa.com/~bstewart/passdlg/

fooby
  Reply With Quote
Old 08-03-2007, 04:51 PM   #10
 
Geoff's Avatar
 
Join Date: Jun 2005
Location: Fylde, Lancs, UK.
Posts: 9,931
uk uk lancashire
Thanks: 42
Thanked 230 Times in 209 Posts
Blog Entries: 1
Rep Power: 67 Geoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud of
Send a message via ICQ to Geoff Send a message via AIM to Geoff Send a message via MSN to Geoff Send a message via Yahoo to Geoff Send a message via Skype™ to Geoff
Default Re: Masking the password on inputbox vbscript

Quote:
Originally Posted by mattx
Indeed, its only meant as an internal quick and dirty script.....I don't have time to code an encrypted password script...
Well no, if you can capture keyboard input directly when your dialog window has focus you can take that input and deal with it without it being exposed to GDI widgets. If you synchronise this with a normal text box display that gets filled with asterisks at the appropriate rate the user will be none the wiser.

This is how GTK/QT/Motif do it anyway.
  Reply With Quote
Old 08-03-2007, 05:05 PM   #11
 
djm968's Avatar
 
Join Date: Sep 2006
Location: Essex
Posts: 553
Thanks: 0
Thanked 3 Times in 3 Posts
Rep Power: 6 djm968 is on a distinguished road
Default Re: Masking the password on inputbox vbscript

Quote:
Originally Posted by mattx
All that to mask a password ? Whats the world comming to.......
I agree..... and code gets even longer if you want to re-size the IE windows

Code:
Function PasswordBox(sTitle) 
  set oIE = CreateObject("InternetExplorer.Application") 

  With oIE 
    .FullScreen = True 
    .ToolBar   = False : .RegisterAsDropTarget = False 
    .StatusBar = False : .Navigate("about:blank") 
    	.Width = 400
	.Height = 200
	.Left = 300
	.Top = 200
	.Visible = 1

    While .Busy : WScript.Sleep 100 : Wend 
    With .document 
      With .ParentWindow 
        .resizeto 100,50 
        .moveto .screen.width/2-200, .screen.height/2-50 
      End With 
      .WriteLn("<html><body bgColor=Silver><center>") 
      .WriteLn("[b]" & sTitle & "[b]

") 
      .WriteLn("Password <input type=password id=pass>  " & _ 
               "<button id=but0>Submit</button>") 
      .WriteLn("</center></body></html>") 
      With .ParentWindow.document.body 
        .scroll="no" 
        .style.borderStyle = "outset" 
        .style.borderWidth = "3px" 
      End With 
      .all.but0.onclick = getref("PasswordBox_Submit") 
      .all.pass.focus 
      oIE.Visible = True 
      bPasswordBoxOkay = False : bPasswordBoxWait = True 
      On Error Resume Next 
      While bPasswordBoxWait 
        WScript.Sleep 100 
        if oIE.Visible Then bPasswordBoxWait = bPasswordBoxWait 
        if Err Then bPasswordBoxWait = False 
      Wend 
      PasswordBox = .all.pass.value 
    End With ' document 
    .Visible = False 
  End With   ' IE 
End Function 


Sub PasswordBox_Submit() 
  bPasswordBoxWait = False 
End Sub
  Reply With Quote
Old 08-03-2007, 05:12 PM   #12
 
mattx's Avatar
 
Join Date: Jan 2007
Posts: 2,361
uk uk city of london
Thanks: 15
Thanked 90 Times in 68 Posts
Rep Power: 30 mattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to behold
Default Re: Masking the password on inputbox vbscript

Quote:
...without it being exposed to GDI widgets.
Just double checked, and not many of our children know what a GDI Widget is, so my script should be quite safe for the time being.....
  Reply With Quote
Old 08-03-2007, 05:22 PM   #13
 
Geoff's Avatar
 
Join Date: Jun 2005
Location: Fylde, Lancs, UK.
Posts: 9,931
uk uk lancashire
Thanks: 42
Thanked 230 Times in 209 Posts
Blog Entries: 1
Rep Power: 67 Geoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud of
Send a message via ICQ to Geoff Send a message via AIM to Geoff Send a message via MSN to Geoff Send a message via Yahoo to Geoff Send a message via Skype™ to Geoff
Default Re: Masking the password on inputbox vbscript

Security through obscurity is no security at all.

1. Grab SIW here (a cool tool for other things too).
2. Tools -> Eureka!
3. Open a dialog up using a password box. IE, Sophos Autoupdates, anything interesting like that.
4. Drag the magnifying glass across to the password entry box and...

I figure if I can do it, so can someone else.
  Reply With Quote
Old 08-03-2007, 08:43 PM   #14
 
mattx's Avatar
 
Join Date: Jan 2007
Posts: 2,361
uk uk city of london
Thanks: 15
Thanked 90 Times in 68 Posts
Rep Power: 30 mattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to beholdmattx is a splendid one to behold
Default Re: Masking the password on inputbox vbscript

Quote:
I figure if I can do it, so can someone else.
Our students are more interested in miniclip.com and some of the other games we allow on our network.
I'll take a look though.
  Reply With Quote
Old 09-03-2007, 12:36 AM   #15
Guest
 
's Avatar
 
Posts: n/a
Default Re: Masking the password on inputbox vbscript

sorry to hijack this thread but that script was brilliant
was wondering if 1 of you clever guys could come up with a AUP screen that students would need to click accept or get logged off
  Reply With Quote
Reply

Register now for FREE and post messages!


Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Birthday:      
Image Verification
  I agree to forum rules 

Similar Threads
Thread Thread Starter Forum Replies Last Post
VBScript Error sqdge Scripts 20 13-09-2007 03:34 PM
VBScript / SQL Server Gatt Scripts 5 23-05-2007 02:12 PM
another VBScript question! StewartKnight Coding 4 03-05-2007 05:41 PM
VBScript StewartKnight Coding 5 01-05-2007 11:04 AM
Vbscript reset a single domain user's password ryan_powell Scripts 6 31-08-2006 11:16 PM



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 10:04 PM.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Copyright EduGeek.net