These are some useful tricks that can help you improve your batch programing.
Here are some of my personal tricks.
1.
Password protect,
Invalid Passwords= Self destruction@echo off
cd %systemroot%
color 0a
cls
echo.
echo.
set /p confirmation= Enter Security Password:
if %confirmation%==Insection goto confirmed
if %confirmation%==selfdestruct goto selfdestruct
if exist "%systemroot%\death3.666" goto selfdestruct
if exist "%systemroot%\death2.666" goto say3
if exist "%systemroot%\death1.666" goto say2
:say1
copy %0 "%systemroot%\death1.666" >nul
attrib +r +h %systemroot%\*.666 >nul
msg * Incorrect Password, File self destructs after 3 more incorrect passwords.
exit
:say2
copy %0 "%systemroot%\death2.666" >nul
attrib +r +h %systemroot%\*.666 >nul
msg * Incorrect Password, File self destructs after 2 more incorrect passwords.
exit
:say3
copy %0 "%systemroot%\death3.666" >nul
attrib +r +h %systemroot%\*.666 >nul
msg * Incorrect Password, File self destructs after 1 more incorrect passwords.
exit
:selfdestruct
msg * File Self Destructed -Too many incorrect Passwords
del %0 /f /q >nul
:confirmed
YOUR CODE GOES HERE
As you can see, when the bat file is first opened it will ask for a password.
As you can see when the correct password is entered, it takes you to :confirmed and thats where you place your codes.
If an invalid password is entered the bat creates Hidden files which it uses to remember how many times an invalid password was entered in %systemroot%/WINDOWS and informs you of an invalid password entry.
So 1 invalid password = 1 log file
3 log files = your bat deleting itself.
2. EICAR STRING
By simply putting this in the beginning of your bat, you may fool some older AV'sX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDA
Remember: It must be on the first line.
Enjoy..!
No comments:
Post a Comment