![]() | Register | FAQ | Members | Social Groups | User Map | Calendar | Search | Today's Posts | Mark Forums Read |
| | | LinkBack | Thread Tools | Search Thread | Language |
| Sponsored Links |
| | #1 |
![]() Join Date: Oct 2005 Location: East Midlands
Posts: 477
Thanks: 5
Thanked 36 Times in 23 Posts
Rep Power: 12 | 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. |
| |
| | #2 |
![]() Join Date: Sep 2006 Location: Essex
Posts: 553
Thanks: 0
Thanked 3 Times in 3 Posts
Rep Power: 6 | |
| |
| | #3 | |
![]() Join Date: Jan 2007
Posts: 2,361
Thanks: 15
Thanked 90 Times in 68 Posts
Rep Power: 30 | 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:
| |
| |
| | #5 |
![]() Join Date: Aug 2005
Posts: 1,692
Thanks: 11
Thanked 30 Times in 29 Posts
Rep Power: 15 | |
| |
| | #6 |
![]() Join Date: Sep 2006 Location: Essex
Posts: 553
Thanks: 0
Thanked 3 Times in 3 Posts
Rep Power: 6 | 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
|
| |
| | #7 | |
![]() Join Date: Jan 2007
Posts: 2,361
Thanks: 15
Thanked 90 Times in 68 Posts
Rep Power: 30 | Quote:
| |
| |
| | #8 |
![]() Join Date: Jan 2007
Posts: 2,361
Thanks: 15
Thanked 90 Times in 68 Posts
Rep Power: 30 | All that to mask a password ? Whats the world comming to....... |
| |
| | #9 |
![]() Join Date: Dec 2005
Posts: 348
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 7 | |
| |
| | #10 | |
![]() Join Date: Jun 2005 Location: Fylde, Lancs, UK.
Posts: 9,931
Thanks: 42
Thanked 230 Times in 209 Posts
Blog Entries: 1 Rep Power: 67 | Quote:
This is how GTK/QT/Motif do it anyway. | |
| |
| | #11 | |
![]() Join Date: Sep 2006 Location: Essex
Posts: 553
Thanks: 0
Thanked 3 Times in 3 Posts
Rep Power: 6 | Quote:
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
| |
| |
| | #12 | |
![]() Join Date: Jan 2007
Posts: 2,361
Thanks: 15
Thanked 90 Times in 68 Posts
Rep Power: 30 | Quote:
| |
| |
| | #13 |
![]() Join Date: Jun 2005 Location: Fylde, Lancs, UK.
Posts: 9,931
Thanks: 42
Thanked 230 Times in 209 Posts
Blog Entries: 1 Rep Power: 67 | 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. |
| |
| | #14 | |
![]() Join Date: Jan 2007
Posts: 2,361
Thanks: 15
Thanked 90 Times in 68 Posts
Rep Power: 30 | Quote:
I'll take a look though. | |
| |
| | #15 |
| Guest
Posts: n/a
| 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 |
| |
| |
| | ||||
| 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 |
|
|






