Web Application Penetration Testing Tutorial For Beginners

Fundamentals of Python for Web App Penetration Testing

Learning Basic Python Programming

Let’s go through the fundamentals of Python to learn its basics.

Python generally comes pre-installed with Mac and Linux. For Windows, you need to install it on your own by visiting https://www.python.org/downloads. From here, download the latest version of Python and install it. 

  • Running Code

Once installed, you can write the code in the terminal and run it. The code can also be saved as a file with py extension and can be run as a Python file. 

  • Terminal

For simple commands, it is suggested to write and run the commands directly in the terminal. 

>>> shows that you are using the Python console. For instance, you can try it by writing a simple addition program:

>>> 4 + 3

It will give output as:


Write exit command to close the console:

>>> exit()

  • Syntax

The syntax of Python is clean and simple. It doesn’t require unnecessary characters for showing specifications. For instance, it doesn’t use semicolons to end lines of code. 

To print a command, use the print() method. For instance:

print(‘command one’)

print(‘command two’)


command one

command two

In the syntax, please note that Python is case-sensitive, which means that you need to take care of capital and small characters. For example, Name and name will act like two different variables. 

  • Comments

For comments on a code, the # symbol is used. The role of using comments is to define what’s happening in a program. The comments don’t impact the program or its flow. 

  • Variables

Variables are used to save and make changes to data for creating flow and logic. For example, a variable can be used to specify a name, another to store the age, etc. 

  • Declaration

For the declaration of a variable, the process is simple. Just pick a name and assign a value with the use of = symbol. 

Hands on Python

Hands on Python 

It’s Quiz Time!

Did you find this article helpful?