Scripting


Scripting


Command Shell Scripting

A shell is the interface between the user and the operating system. It allows us to run programs, copy files, and perform a number of tasks. All operating systems have a shell of some form. A shell might be a graphical user interface (GUI), such as Microsoft Windows. Or it could be text-based which allows us to run commands by typing them out.


backtrack tutorials command prompt
Windows 7 Command Prompt
A script is a program-like file that runs many commands at one time. There are even “programming” languages for scripts known as scripting languages. A shell script is wonderful tool we can add to our penetration testing toolbox. A shell script is a program written in a scripting language which is used to interface in some way which the shell of the operating system.
Since this site is about backtrack tutorials, I will be using backtrack 5 for most of my examples. Fire up the terminal and lets run some commands!
backtrack tutorials terminal
Bash Basics
Since we are using backtrack, lets open up a text editor (vi, emacs, gedit, etc.). Once open, lets jump right in to our first bash script, “Hello World”.
Open a new file in gedit, and type:

#!/bin/bash
echo "Hello World"

Now we save the file somewhere, and name it “helloworld”. In order to make the script we just wrote executable, we type in our terminal:
chmod u+x helloworld
We must be in the same directory where we saved the file to do this. I saved my script to the desktop, so in the terminal I typed:
cd Desktop
And finally, to run our script we type:
./helloworld

Comments

Popular posts from this blog

How to Create a Yoga Goddess Illustration in Adobe Illustrator

How to Create an Icon Set using Adobe Photoshop

Android Essentials: Using the Contact Picker