Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- :
- :: PasswordSubmitter.bat | Wasif Hasan | Sep 2020
- :: This is a Batch-HTA-VBScript hybrid that will show a GUI window to enter password
- :: Save it as a .bat file and run it in your other batch files
- :: and returns the password as a result (to STDOUT)
- :: If you enter no password in the dialog it will show an error message box and persist
- :: Arguments: "BatchFilePath" "prompt (To Show over the password box)"
- :: Default prompt is "Enter password"
- @echo off & setlocal EnableDelayedExpansion
- if [%*]==[] (
- for /f "tokens=* delims=" %%a in ('echo "Enter Password" ^| mshta.exe "%~f0"') do set "pass=%%a"
- ) else (
- for /f "tokens=* delims=" %%a in ('echo %* ^| mshta.exe "%~f0"') do set "pass=%%a"
- )
- echo !pass! & exit /b 0
- -->
- <!DOCTYPE html>
- <html>
- <head>
- <title>Password box</title>
- <hta:application
- applicationName="Password box"
- border="thin"
- maximizeButton="no"
- minimizeButton="no"
- showinTaskbar="no"
- scroll="no"
- singleInstance="yes"
- contextMenu="no"
- selection="no"
- />
- <script type="text/vbscript">
- Sub Window_OnLoad()
- Dim fso2, strPrompt, dblQuote
- window.resizeTo 320,180
- Set fso2 = CreateObject("Scripting.FileSystemObject").GetStandardStream(0)
- strPrompt = fso2.ReadLine
- dblQuote = Chr(34)
- strPrompt = Replace(strPrompt, dblQuote, "")
- Document.All.prompt.innerHTML = strPrompt
- document.All.Password.Focus
- End Sub
- Sub Validate()
- Dim fso, GetPassword
- GetPassword = Document.All.Password.Value
- If GetPassword = "" Then
- MsgBox "Please enter a password!",48,"Password box"
- Else
- Set fso = CreateObject("Scripting.FileSystemObject").GetStandardStream(1)
- window.Close(fso.write(GetPassword))
- End If
- End Sub
- </script>
- </head>
- <body style="background-color:lightblue;font-family:Tahoma;">
- <div align="center">
- <p id="prompt">Enter Password</p>
- <p><input type="password" size="20" id="Password" /></p>
- <p><input type="button" value="Submit" onClick="Validate()" /></p>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment