Sunday, July 21, 2013

Enter username , password in form using batch file / Hide password batch file

Use below code and write into the file, which is ended up with *.bat. Save the file double click on file. After which a form will popup in which you can enter username and password and password is not visible.

@echo off

cls
echo Please enter your user name and password in the entry box...
If not exist %0 goto ERROR
type %0 | find "    " | find /v "Not Me!" > %TEMP%\UserIn.hta
start /w %TEMP%\UserIn.hta

call %TEMP%\UserIn.bat
echo Your user name is %USERNAME%
echo Your password is %PASSWORD%
:: Clean up
del %TEMP%\UserIn.hta
del %TEMP%\UserIn.bat
goto DONE

:ERROR
cls
echo %0 is not the full path and file name
echo for the batch file. You MUST call this
echo batch file with a full path and file name.
goto DONE

:HTA
:: All HTA code MUST be indented four or more spaces.
    <html>
    <head>
    <title>Password Entry</title>
    <hta:application>
    <script language="vbscript">
        window.resizeTo 250,200
        Sub SaveBatch()
            Set fs = CreateObject("Scripting.FileSystemObject")
            strFile = fs.GetAbsolutePathName(fs.BuildPath(fs.GetSpecialFolder(2), "UserIn.bat"))
            Set ts = fs.OpenTextFile(strFile, 2, True)
            ts.WriteLine "SET USERNAME=" & document.Forms(0).elements("username").value
            ts.WriteLine "SET PASSWORD=" & document.Forms(0).elements("password").value
            ts.Close
        End Sub
    </script>
    </head>
    <body>
    <form>
        User Name:
        <br><input type=text name=username tabindex=1>
        <br>Password:
        <br><input type=password name=password>
        <br><input type=button language="vbscript" value="OK"
        onclick="SaveBatch : Window.Close">
    </form>
    <script language=vbscript>
        document.Forms(0).elements("username").focus
    </script>
    </body>
    </html>

:DONE

below screen is of popup window

Wednesday, July 3, 2013

Hide password string in batch

Hide input string batch code
Mask password

here is the code::

@echo off
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
for /f "tokens=*" %%i in ('in.com') do set "password=%%i"
del in.com
echo.
echo The Password is:"%password%"
pause
web stats