Hello my anxious hackers, the week has started and here we begin a new series that I think will help many here and not only, for those that have the opportunity to follow our tutorials but they are not yet part of the community.
Don't be a script-kid? what do you mean?
In programming and hacking culture a script kiddie or skiddie1 (also known as skid is an unskilled individual who uses scripts or programs developed by others to attack computer systems and networks, and deface websites without knowing how the programs work, it has nothing to do with newbie or amateurs, skrip kids are just dumb and lazies, different from amateur and newbies they don't want to learn, they can spend months, and even years claiming that they are hackers without learning nothing, just by using others tools, without helping the community you can not consider your self a real hacker, so stop using tools without understanding what is going on behind it, plus most of the tools are open source, our kali linux as well, so start exploring what is inside it, change the code, innovate a tool, report a bug, write a tutorial, learn a programming or script language, do something useful.
Are you a newbie?
don't feel bad if you haven't done anything, if you are reading this means you want to learn and not wasting your time by using tools you don't understand, so i got your back now.
what we can expect from this serie?
1-understanding how some tools on kali linux work.
2-Be able to modify some tools inside kali linux.
3- write our own tool and share for everyone here on null-byte.
What are we going to learn today?
1-Basic understanding of shell,bash and terminal
2-Some useful commands for linux
3-writing our own shell script(bash)
4-executing our shell script
4-Understanding how Kali linux commands works
5-executing our script without "./"
6-Leave yours comments
1-SHELL,BASH,TERMINAL
Im really sorry but i wanna be more practical in this lesson
so here we got some quick notes about them.
shell - shell is a user interface for access to an operating system's services. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer's role and particular operation.
bash -Bash is a command processor that typically runs in a text window, where the user types commands that cause actions. Bash can also read commands from a file, called a script. Like all Unix shells, it supports filename globbing (wildcard matching), piping, here documents, command substitution, variables and control structures for condition-testing and iteration. The keywords, syntax and other basic features of the language were all copied from sh. Other features, e.g., history, were copied from csh and ksh. Bash is a POSIX shell, but with a number of extensions.
terminal -It's a program called a terminal emulator. This is a program that opens a window and lets you interact with the shell. There are a bunch of different terminal emulators you can use. Most Linux distributions supply several.
2-USEFUL COMMANDS ON LINUX
Now fire up your kali linux and open your terminal
we will talk about the commands we will use in this lesson
ls
Lists the contents of a directory
pwd
writes the full pathname of the current working directory to the standard output.
cd
The cd command, also known as chdir (change directory), is a command-line OS shell command used to change the current working directory in operating systems
mkdir
The mkdir (make directory) command in the Unix
cp
cp is a UNIX command for copying files and directories
rm
is a basic UNIX command used to remove objects such as files, directories, device nodes, symbolic links, and so on from the filesystem
chmod
chmod - modify file access rights
for now thats all if i forget to explain a command during our tutorial just google it and try to understand why i used it, its also one of step of stop being a script kid, you need to find the "because" of "why" by your own sometimes.
3-WRITING OUR "hello planet" SHELL SCRIPT
just open your text editor and write the code in the picture below, i wont paste here the code to eliminate the habit of copy and paste, its better when you write by yourself.
i will be using leafpad you can use any other.. so after you finish writing save it as hello_sell.sh
Understanding the script
The line 1 of the script is important. This is a special clue, called a shebang, given to the shell indicating what program is used to interpret the script. In this case, it is /bin/bash. Other scripting languages such as Perl, awk, tcl, Tk, and python also use this mechanism
The lines 2,3,4,5,6 are comments. Everything that appears after a "#" symbol is ignored by bash
the line 7 is the echo command. This command simply prints its arguments on the display
RUNNING OUR SCRIPT
Now go to the folder where you saved your file, mine i did save in Desktop,using the cd command that i explained above, i went to the desktop folder and tried to executed our script but we got one of my favorite error msg"permission denied" what does it means?
it means that we dont have rights to execute this file, so we can again use one of the above commands to give us rights to execute this script, so we will be using the "chmod with the +x options"
and after that our script will be execute normally as in the picture below
wow congratulation bro/sister, you are no longer a script kid, you just run your first own tool, actually in the real world we will not consider it a real tool, but you are getting it, you made your own virtual printer "lol i don't even know if i can say that" but anyway you got it.
4- Understanding how Kali linux commands works
ok now comes the funnier part of this lesson
just type again null__byte.sh or even without the "./"
ooops "another error" command not found, and this is where a lot of script kiddies will stop, a lot of times i see people here on nullbyte posting tutorials with new tools, a script-kid download it then run it with "./" even after years he/she can not understand what is going on behind, why for tools like "nmap,msfconsole,nikto" i dont need to type with the "./" and specify the full path of where the tool is located? Dont panic i got your back, first of open your bin folder in kali linux,
you could also go there by terminal typing : cd/bin
In case you are in the root directory, but i want you to have also a graphical look of it, we can see that there are some files of commands we often use in kali linux such as "cp"echo"dir"chmod"dd" and so on.
so why nullbyte did not work without the "./"?
When you type in the name of a command, the system does not search the entire computer to find where the program is located. you have noticed that you don't usually have to specify a complete path name to the program you want to run, the shell just seems to know.
what happen is that the shell does know. Here's how: the shell maintains a list of directories where executable files (programs) are kept, and only searches the directories in that list. If it does not find the program after searching each directory in the list, it will issue the famous command not found error message.
This list of directories is called your path. You can view the list of directories with the following command:
echo $PATH
as we can see from the above pic these are our path where we can place our script, the system will search for scripts inside this folder when we type a command without "./"
note: the path terminate where the new":" starts, so i got the following paths "/usr/local/sbin"
"usr/local/bin"
and i guess now you got where i got the other paths.
ok now lets do something very cool, first of copy your file to one of the paths listed above, i will use the first one "usr/local/sbin"
so as i explained above the command to copy is the cp, so lets run it
cp null_byte.sh /usr/local/sbin
now run again our script without the "./"
nullbyte.sh
Wow we got our script working without the "./",
cool but another cool thing you could do also is to run the script without the ".sh".
To do this simply save your script again without ".sh" and copy to your path (I guess now you have an idea where is your path), give the permissions and run it again without ".sh".
Bingo, you just got it running like any other tool inside kali linux
Ok for now you can say that you are not script kid anymore, you start to understand how stuffs work inside kali linux ,and today you have made your own tool"virtual printer ", but professionals do not advice you to proceed this way to run your scripts when you want to run it without specifying the full path and run it with the annoying "./ and .extension" so we have another trick.
A better way would be to edit your .bashprofile to add our bin path, so for this we will need to create our own bin folder somewhere else where we can put our own scripts, so that would be easy to control or manage our script than messing it with system scripts and so on, so lets first create our bin folder, then copy our script to this folder
ok now remove the file from /usr/local/sbin path, (yes i know we could just use move, but i want you to explore more commands)restart the terminal and run null_byte
(oops the same error" command not found") why?
Because we did not tell the system about our new bin folder
So lets edit our bashprofile and tell the system where to look for our scripts.
on kali lnux just run the following command(in case you are using leafpad too) :
leafpad ~/.bashrc
and add the following:
export PATH=$:/root/Desktop/bin
save it, restart your terminal and then run it again from anywhere without "./" and .sh
Bingo we got it... our script is running from anywhere in kali linux without the "./" and the ".extension", so for now when someone post a tutorial here and he/she uses a tool that is not by default in kali linux instead of specifying the whole path try to bring them to your bin folder, and run it just like any other tool..and remember don't just copy and paste, don't run tools without the understanding of what is going on behind it, for now that is all, leave your comments below if i miss something or if i said something wrong.. see you in the next lesson...
Hacked by Mr__Nakup3nda
Just updated your iPhone to iOS 18? You'll find a ton of hot new features for some of your most-used Apple apps. Dive in and see for yourself:
26 Comments
Good post, this is a good start, I actually learned programming from BASH (and my TI-84)
Awesome post, especially for beginners. Waiting for part 2 already..
Did you just tell people to not be script kiddies while you screenshot your 'KALI LINUX' operating system? Spectacular.
_
Well, gee? The true definition of a script kiddie is using tools people made. That is the original and only definition. Anything else is your own proper definition, which are sometimes right. But, 'my own linux Version' does this imply you made a Linux distro? And have you ever heard of something called Arch Linux? Please tell me you have.
your definition about script kid is wrong in my point of view, coz that aint even your opinion, you just saying how the world define it, hackers should not have the mentality to just accept without questioning why, I don't just affirm or agree with something just because wikipedia or google or whatever evil cop or person says, i go by facts and do my own analysis to create my own definition..
Hacked by Mr_Nakup3nda
But this is the problem. You turn a definition into something you think, but no... It's like you saying that the word 'nigg*' is a good word because your opinion says that..
Anon:
If I use a tool developed by someone (not me) means that I'm a script kiddie? Don't you use software developed by others? I think you are wrong with that definition.
Jako, as I have stated we are all script kiddies. You, OccupyTheWebOTW, me, Nakapuda and more. The term 'Script Kiddie' is trash. But if we are using it, we must use its original definition.
I don't know where you found that definition, but I haven't seen it in anywhere.
By the way, these are not 'Kali Linux Commands'. These are GNU/Linux Debian commands...
Hacked by Mr_Nakup3nda
You definetly are not who you claim to be. Just because an operating system is based on Linux doesn't mean it has the same commands as any other Linux OS. Here, we can take Arch Linux as the example. You clearly have little experience in the field. And this is Debian Linux basic commands... Not really a coding tutorial.
Hacked by Mr_Nakup3nda
You're clearly just another script kiddie out there trying to sound "1337" and almighty. I wasted my time with you. Keep on with your Kali Linux and SQLmap.
OTW already has a nice series on linux basics, which is what this seems to be.
Awesome guide ;)
Hi everyone,
After i edit the bashrc file and adding the export line, my terminal doesn't recognize any command like "ls" and i cant remove that "export.." line from the file because e can't use gedit or leafpad command to open it again.
I tried to search the file but can't find it, any help please?
PS: I also tried to create a script with the "leafpad ~/.bashrc" command hopping it would work but still giving me the " bash: leafpad: command not found " error.
Sorry if i write something wrong, im Portuguese :/
SOLVED
I open gedit and after i click "open" i find the bashrc file because it shows the recent files that i open with it.
That's what happen by being lazy and copy/past the command
Correct one (from the print):
Thanks
thank you!!! this helped me.
that's cool i m expecting u to show us how u hack a website lol
this was amazing. thank you.
Awesome post, especially for beginners. thanks
Reading this article, almost retro as its been on here awhile. I use scripts that are packaged into distros as well as scripts that obtain more scripts. I'm one of those self taught peeps that didn't go to school for pc related things, but always had a love for it. I devour as much info as I can wherever it's available via youtube, facebook, reddit and other places and read a lot. After a while you figure out what is good learning material and what is poser type stuff. Sometimes the poser stuff is explained in ways that make it understandable with general synopsis and not applying philosophy to it. I don't take offense to the whole script kiddie thing and rely on coders that author those things up as it helps make sense of things as I have no programming skills. I kind of compare it to playing guitar and playing songs from artists I like. All credit to the original artist, but hey, if you can play it, well, you can play it. I don't see musical talents calling people hacks for playing their songs. Maybe some see it as inspiring. I think some people would catch my drift. So kudos to those coders out their that make those awesome scripts public for learning purposes and more.
Can you or anyone having enough knowledge be my mentor? Please provide your contact
First of all, thank you for helping.
My terminal is not recogning null byte command after editing bashrc by adding:
export PATH=$PATH:/home/username/Desktop/bin
I am currently using parrot os (Linux)
Share Your Thoughts