Hack Like an Elite: Batch Scripting for Malicious Purposes: PART 1 (The Basics)

Batch Scripting for Malicious Purposes: PART 1 (The Basics)

Hack Like an Elite: Batch Scripting for Malicious Purposes: PART 1 (The Basics)

Hi there, Crackers,
Welcome to my 7th post (Part-1), this tutorial will explain about the basics of Batch Scripting.

Why Batch?

Batch is a really easy and interesting scripting language, it is used for malicious purposes, i.e. how can you exploit the victim's PC/life, further, after hacking into his PC.(This can also be used for hacking too, I'll explain that later)

Batch or Bash?

It is Batch not Bash, however they are quite similar. But Batch is a lot more easier to understand.


Let us make a simple batch script:
@echo off
echo Hi there?
echo Everything fine?


Save it as anything.bat (.bat extension is important ) an run it.

1) @echo off: This command should be at the top(/header) of the script, it actually removes the trash/repeated command lines. Try to run the program again without this line and then you will understand.

2) echo: It echos/displays anything written in front of it (In simple words)

3) pause: It inserts a pause in the script (This: Click any key to continue...), If it is not in the script then, The window will exit without you, being able to see anything.

4)exit: Exits the script/Terminates the script/Closes the Command window.

More Basics:

Some more commands:
5) md:Make directory (Make a folder)
EG: md qwerty (this will make a folder named qwerty)
6) cd:Change directory

Another Script:(Copied from somewhere, easy to make)
@echo off
title MenuMaker V0.1
color 06
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

title !!!Fun!!!
color 08
echo !!!FUN!!!
goto :menu

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

---------------------------- (Save as anything.bat , run it)

7) :something: This is used give an address, a location name to a part of the script.
Eg: :A , :abcd , :p , :anything etc

8) goto: This command is used for loops, when we specify a location name after the goto command, the script loops itself to that location.

Eg: In this script, goto :menu tells the running script that return to start of the script where :menu has been used.

9)echo.: Gives a line break (Enter)

10)color: This command is used to give color to the display of the script. A 2 digit code is used, the first digit is for background color and the 2nd digit is for text color. (Use color -y command in cmd for help)

11) set /p : It is used to set a variable to accept some values which we input.
Eg: If we set, lets say, a=1, then the value of a will remain 1, until the end of the script.
We can display its value by typing: echo %a%.
(It will display value of a instead of the variable a )

12)If %choice% EQU 1 goto fun:
A complicated one:
What this does is:
If the value of "choice" is 1 then goto the location :fun
If the value of "choice" is 2 then goto the location :bun
("choice" is nothing, it is just a simple variable)
The value depends on what you have entered.

13)title:Just changes the title of the window.
14)cls: Removes trash and clears the screen.

The Advanced Has Yet to Arrive...

These were just basics of Batch Scripting...
You need to have this knowledge to move to the advanced section and create malware and then upload it using kali.
I'll show you each and every step of the exploitation, but for now Goodbye!
And remember to keep coming back for the Next PARTS!

Thank You!


Ah, yes. I made a script that logged all the files on the system and sent it to the attacker via FTP. Batch is so easy to use with social engineering.

Spoiler Alert!!!
;) Exactly!

Can I ask what FTP is
I'm learning SSH but should I learn the FTP protocol

FTP: File Transfer Protocol,
Used to transfer files from one host computer to another (Eg: Over the Internet) (Like a client-server architecture)
EDIT: No need (But you should know the basics, it is really easy!)

Thanks i tried using it but i missed up couldnt connect my own host using smartFTP cilent ill look into it another day with tutoirals

Good tutorial..Looking forward to the rest of the series. :+1:

Thank You all, for likes, comments and appreciation, next part will be released today.

Fantastic tutorial! I will definitely start using batch. On kali linux, I do not know how to run the file. I save it as a .bat, and when I try to open it, it opens in my text editor. Any ideas to make it open in terminal?

These are Windows commands. They won't work in Linux.

Okay, thanks. I could probably find a batch interpreter for linux online.

OR you could use/install windows as a dual boot. (It's easier)

Nice tutorials, FEAR. i really should read them in my spare time


Thank You Phoenix!

Share Your Thoughts

  • Hot
  • Latest