Introducing information gathering

In this section, we will try to glean information about the web software, operating system, and applications that run on the web server, by using error-handling techniques. From a hacker's point of view, it is not that useful to gather information from error handling. However, from a pentester's point of view, it is very important because in the pentesting final report that is submitted to the client, you have to specify the error-handling techniques.

The logic behind error handling is to try to produce an error in a web server, which returns the code 404, and to see the output of the error page. I have written a small code to obtain the output. We will go through the following code line by line:

import re ...

Get Python Penetration Testing Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.