Kali Linux

Hey Everyone, I am Vikram Salunke and welcome to the our new course on Python for InfoSec. This is a part 2 and in this part we will see the Hello World program.
We are going to use Kali Linux. Most of the Linux and Mac OS comes preinstalled with Python. I am using Kali Linux in a VirtualBox. If you want to know, how to install Kali Linux in a VirtualBox then please watch my video here
We are using Kali Linux because this is going to be our attacker machine and in the upcoming videos we will write script to attack the vulnerable machines.

Hello World

When we learn new language we always start with the Hello World. There are 2 different ways in which you can execute the Python code. First is the interactive Python Shell and second one is by executing scripts.

Interactive Mode

Let's look at the first way for that open the terminal and type python. We are running Python 2.7.14. This is an interactive shell. Let's print Hello World onto the Screen print "Hello World!" as we can see Hello World has been printed onto the screen.

Hello World


Now don't worry if you don't know what is a print means, in the upcoming videos I will tell you in detail what does print do. Just remember one thing we are using Python's print to print Hello World onto the screen. Now let's try the second way let's exit this using Ctrl D

Script Mode

Let's write our Python script for that I am going to use vim editor. You can use any editor of your choice such as nano, vi etc.

vim HelloWorld.py

Hello World

let's type first line #!/usr/bin/python
so, first line is always location of python interpreter that is at /usr/bin/python
After that let's write print "Hello World!" Let's save it and exit it.
Now we will convert this file into the executable file by typing

chmod a+x HelloWorld.py

Let's execute this file by

./HelloWorld.py

Hello World has been printed onto the screen.

Script

Let's analyse the program print is a keyword that is reserved by programming languages because it has some meaning.
Or in other words keyword is like a programming command which will be executed by Python interpreter.
In this case print has a special meaning to print literals onto the screen.
There are other keywords also such as if, while, class etc. Which we will see in upcoming videos.

If you want to join our in person class then please click here we are doing trainings in some upcoming InfoSec conferences.
And if you have any doubts, any questions then you can tweet me @vikramsalunke20
We are uploading daily new videos on YouTube click here to subscribe.
If you want to solve the exercises on this topic those are below. Solve the exercises and check your understandings. Thank you :)