Adding login requirements when running the batch
Moderator: DosItHelp
Adding login requirements when running the batch
Hey folks, just looking for the syntax for adding a login requirement inside the batch. I want to restrict the allowed login to 1 technician on our domain, and we all have admin privilages. Ideas?
Re: Adding login requirements when running the batch
Which batch?
Restricting to one tech can't be done if you all have admin privs. Anyone can find the file and look inside to see any password you might put in it.
You could compile the batch file but IMO batch compilers typically just execute an extracted copy of the bat file from a temp folder, and so that isn't secure either.
Restricting to one tech can't be done if you all have admin privs. Anyone can find the file and look inside to see any password you might put in it.
You could compile the batch file but IMO batch compilers typically just execute an extracted copy of the bat file from a temp folder, and so that isn't secure either.
Re: Adding login requirements when running the batch
Dang, duly noted. Was hoping there was some internal encryption command that can read / scramble a password.
-
- Posts: 16
- Joined: 22 Jul 2012 20:26
Re: Adding login requirements when running the batch
HOLD ON! I HAVE THE SOLUTION!
Than, Use a batch compiler (google it) so that you can't see the code!
Code: Select all
@echo off
color 47
:start
set /p user=Enter your password
if '%user%'=='12345' GOTO pass
if NOT '%user%'=='12345' GOTO invalidu
:pass
cls
set /p pass=Enter your password
if '%pass%'=='12345' GOTO correct
if NOT '%pass%'=='12345' GOTO invalid
:invalid
cls
echo Invalid password
pause
GOTO start
:invalidu
cls
echo Invalid Username
pause
GOTO start
:correct
cls
echo Welcome back %user%!
start "" /b "example.exe"
Than, Use a batch compiler (google it) so that you can't see the code!
Re: Adding login requirements when running the batch
That is just pseudo security! Even with the batch compiler hiding it. People can still find the batch file once they execute the compiled exe. Just like Foxidrive already stated.
Re: Adding login requirements when running the batch
Could you not just use Windows Security to limit the people that can run it? Put the file in a hidden share that only the required user has access to, or explicitly deny access to everyone that shouldn't be able to run it? Once you're the owner of the file, you could deny "take ownership" on everyone, then just implicitly deny access to all else to do with it.
Not security in the scripting sense of it, but it would make it secure.
Not security in the scripting sense of it, but it would make it secure.