https://wiki.python.org/moin/BeginnersGuide/Programmers

Using scripts is an important part of practising security. The main reason to use scripts is for customisation and automation; you may want to perform actions several times that aren’t supported by standard tools.

For now, let's look at using Python to make requests using a web page. For this, you’ll need to download and install python3 and pip. Pip should already come installed with this version - if it isn’t, you can download it from here.

Don’t worry if you haven’t done Python before - we’ll walk through an example script and explain everything from scratch!

The first few lines of Python scripts are usually import statements and they are used to import libraries. In this case, on line 1, we’re importing the requests library. Software libraries/packages can be thought of as functions in a different file. We usually use libraries for a number of reasons:

In this case, we’ve imported the whole library. In other cases, we can import specific functions.

Line 3 and 4 are referred to as variables. Variables are just placeholders for different values. Python is what is known as a dynamically typed language, which means that the Python interpreter will try to assume what kind of data type you’re trying to store in a variable. Variables are in the form of

Name = value

Here are some example declarations:

Here note that a string value has to be enclosed in single quotes(‘’) or double quotes(“”). The list variable is used to store multiple values or variables. The dictionary_values variable is known as a dictionary that stores data in a key:value format where the keys are unique values. To access elements of a list use the syntax: