Storing a password to login to a batch script
Posted: 10 Dec 2015 08:58
I'm working on a login system for my batch script and I'm trying to come up with the most secure way of storing a password locally on the machine running the script.
My idea is to output thousands of random (%random%) numbers to a hidden text file, with the real password (consisting of numbers only) contained somewhere inside. Also, to make sure that my password did not coincidentally appear in the text file from random numbers, I surround my password with a set of pre-determined numbers that will be searched for along with my password.
Could you give me your input or advice on this idea?
Here's the relevant code:
My idea is to output thousands of random (%random%) numbers to a hidden text file, with the real password (consisting of numbers only) contained somewhere inside. Also, to make sure that my password did not coincidentally appear in the text file from random numbers, I surround my password with a set of pre-determined numbers that will be searched for along with my password.
Could you give me your input or advice on this idea?
Here's the relevant code:
Code: Select all
::Set temp file as a hidden system file
attrib +h +s %temp%\binary-dump.log
::Begin counter
:pass_1
set /a n=%n%+1
::Output series of random numbers
echo %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%>>%temp%\binary-dump.log
if %n% equ 400 goto:pass_3
goto:pass_1
::Output password surrounded by pre-determined set of numbers
:pass_3
echo %random%%random%%random%%random%%random%4829376%password%687328%random%%random%%random%>>%temp%\binary-dump.log
:pass_4
set n=1
set /a n=%n%+1
echo %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%>>%temp%\binary-dump.log
if %n% equ 200 goto:finish
goto:pass_4