Python Scripting for the Ethical Hacker Part II

Welcome back to LSB my fellow ethical hackers, this is the second part to our Python scripting tutorial. Today we will be installing PyCharm and creating our first Python script.

Pycharm is an integrated development environment (IDE) and we will be using this throughout the tutorial, so let’s get started.

We are using Kali Linux OS also as we have for the first part of this series, so if you have not already installed it you can find it here.

$199 ENROLLS YOU INTO OUR SELF PACED COURSE – LFS264 – OPNFV FUNDAMENTALS!

register

So when you have Kali installed, open up your browser and search for PyCharm. The reason we are usingPyCharm is because it has a nice debugger and it helps maintain your coding libraries.

4

You will need to choose your operating system, Windows, Linux or Mac, for us it will be Linux. Also, we can either choose the professional version or the community version, we will just choose community for this tutorial.

Once you download the file, open up a command terminal and navigate to the Downloads folder.

cd Downloads
ls

5

As we can see the file we have downloaded is compressed with Gunzip, so let’s decompress the file.

tar -xvf pycharm-community-2017.2.3.tar.gz

ls

6

Next we just need permissions so that we can read, write and execute as root.

chmod 777 pycharm-community-2017.2.3

Then move into the folder.

cd pycharm-community-2017.2.3

7

ENROLL TODAY IN THE SELF PACED COURSE – LFS263 – ONAP FUNDAMENTALS FOR $199!

register

We are using the 2017 version of PyCharm, just because we are comfortable with it, but please install the latest version for yourself, installation will be the same. Above is the contents of the directory. Next we want to move into the bin folder.

cd bin

ls

8

As we can see the pycharm.sh file is already in green so we don’t need to change permissions for that file.

So to start up PyCharm it’s simple.

./pycharm.sh

This will open a dialogue box to complete the installation.

9

We have it already set up so we will not be importing any new settings, but you probably will not, so simply choose a folder to install the software.

Once that is done it will present us with a privacy policy and we just need to accept it and move on.

10

Once you hit Accept it will start up PyCharm. Next we will be presented with some configuration options. We will leave everything as default and just hit the OK button.

$299 REGISTERS YOU FOR OUR NEWEST SELF PACED COURSE! LFD201 – INTRODUCTION TO OPEN SOURCE DEVELOPMENT, GIT, AND LINUX!

register

11

And that’s it, we should have PyCharm installed on our Kali Linux VM.

12

So now we have the software installed we are going to create a new project. Name it and choose the folder you want the project in. For this tutorial we will just save it to our Desktop and hit OK and the Create.

13

Once you have done that it may take some time for the software to open as it installs some packages needed for scripting. So be patient with the installation. Once the installation is complete we can create our first Python script.

REGISTER TODAY FOR YOUR KUBERNETES FOR DEVELOPERS (LFD259) COURSE AND CKAD CERTIFICATION TODAY! $499!    $299 now!!

register

Right click on the Desktop folder on the left hand side panel and choose New/Python Script.

14

Let’s give it a name. We will call ours PythonRocks but you can name it whatever you want to. Then hit OK. This will create the Python file for us.

15

Perfect. So now let’s print out something simple just to make sure it works.

print "Python Rocks!"

Then we need to save it somewhere, so we will save it again to our Desktop.

16

Once the file is saved, go to the Desktop to see that the file has been saved there.

17

Perfect, now let’s run the file in the terminal. Open a command prompt gain and navigate to the Desktop folder.

cd Desktop

Before we run the file we have to make it executable.

chmod 777 PythonRocks.py

18

Cool, green means it is executable. So let’s run the file.

python PythonRocks.py

19

Beauty! As you can see this is a very basic script but will get you started in how to use Python, we will be going into more depth in future tutorials so stay tuned and thanks for reading!! 😉

QuBits 2020-06-09

banner2

 

 

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.