Python Scripting for the Ethical Hacker Part II – The Wandering Irishman

0
42
Python Scripting for the Ethical Hacker Part II – The Wandering Irishman

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… 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!

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.

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

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

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

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

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

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.

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.

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!

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

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.

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!!

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

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.

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.

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

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

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

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

 
 

LEAVE A REPLY

Please enter your comment!
Please enter your name here