Lesson 1- Let’s Learn Python!

May 28, 2017 | Views: 6245

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

Image result for python image

This series is going to teach you the concepts, and functions of the Python programming language, it will help you build an understanding of the language. Gradually we will base the series on security related issues, with the focus of ethical hacking and penetration testing.

:~$ whoami

Aslam Admani

That’s me!

Well, why Python you ask? Python is an easy-to-learn language, which is versatile,  well supported, and resourceful. It comes pre-installed on multiple operating systems and is used by many including hackers, data scientists, network admins, web developers and more. So why not learn it?

Let’s begin by identifying the requirements:

  • You will need a PC, be it a laptop/desktop
    • If you do not have access to these items, it will be harder to learn, however, there are some mobile apps that support Python. If you have android you can download programming hub (within the app search for Python), Python ide and a few others. As for ios powered devices you could just search for Python, and read reviews (I’m on android, so I wouldn’t know what’s best for apple users).
  • You will need to be self-motivated, find what you want to do, why you want to learn Python and be persistent.

Assuming you have what’s required, let’s start.

I use kali linux, on which Python comes pre-installed. If you don’t have kali linux installed, I would highly recommend it, if you are into computer security/hacking and so fourth. If you don’t have kali linux, and you would like to install it, there are hundreds of tutorials you could find on the web. I’, not going to go over it in great detail, however here are the steps:

  1. download vmware player, or virtualbox (if you don’t have it)
  2. download a Kali Linux iso file
  3. install and configure the virtual image (Kali Linux) using the VMWare or VBox
  4. you’re good to go!

If you wish to proceed using windows and you don’t have python installed, that’s absolutely fine, you could download it from the following website: https://www.python.org/downloads/

  • We will be using Python 2, however if you wish you can download python 3. There are a few distinctions between the both, and throughout the course I will point them out.
  • Next go to: https://notepad-plus-plus.org/download/v7.4.1.html to download notepad ++

If you’re on windows and you have these installed, you’re ready to go.

If you’ve downloaded and configured Kali linux you’re ready to go.

Note: All Python files must end with a .py extension for your PC to identify that it’s a python file. You will also be able to access Python in interactive mode by going either on to the terminal or command prompt and typing in Python. If you’re unaware of what these are, go on to your search bar on Windows and type in ‘cmd’. If you get an error: http://pythoncentral.io/add-python-to-path-python-is-not-recognized-as-an-internal-or-external-command/ follow this tutorial to be able to run python on your command prompt .

Or if you’re on Linux, on your search bar, type in ‘terminal’.

OUR FIRST PROGRAM

Open up a text editor – notepad ++ for windows, gedit, or nano for linux and do the following:

Type in:

  • print ‘hello world’

IF YOU ARE RUNNING PYTHON 3.X:

  • The standard syntax is: print (‘hello world’)

Okay, next go to save as. Save the file name as    My_first_program.py

Then run it by entering:     python My_first_program.py

  • From this you should see the output: ‘hello world’
    •   Now try the same program however instead of using ‘ ‘, try using ” text “, and ”’   ”’, or  “””  text in here  “””. Play around with these!

Next replace hello world with other things, print your name out, print your date of birth out, play around with it.

This is the end of the first lesson. The point of this blog was (if on windows) to get you to install the python framework, download notepadd ++, enable the python command on terminal and to write your first little program, otherwise encourage you to get a copy of kali linux, and write the same program on that.

As we go through this series, I will upload code and tasks for you on my github: https://github.com/c0d14k/Python-Cybrary-Codehttps://github.com/c0d14k/Python-Cybrary-Challenges

Share with Friends
FacebookTwitterGoogle+LinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterGoogle+LinkedInEmail
Ready to share your knowledge and expertise?
1 Comment
  1. HI..
    THANKS FOR THIS TUTORIAL.
    THUMPS UP.
    GOT A LITTLE CHALLENGE THOUGH WHILE RUNNING THE TEST EXERCISE WITH PYTHON My_first_program.py using cmd.
    though i was able to run it using pycharm.

    thanks coach

Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play
 

Support Cybrary

Donate Here to Get This Month's Donor Badge

 
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel