Hi there, Crackers,
Welcome to my 7th post (Part-1), this tutorial will explain about the basics of Batch Scripting.
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)
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 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.
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)
title MenuMaker V0.1
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
echo NO FUN HERE!
echo No bun here...
---------------------------- (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.
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!
Start your White-Hat Hacker journey with Null Byte's Beginner's Guide to Mastering Linux eBook.