Extracting servers banners with python

Banners expose information related with the name of the web server and the version that is running on the server. Some expose the backend technology (PHP, Java, Python) used and its version. The production version could have public or non-public failures, so it is always a good practice to test the banners that return the servers that we have publicly exposed, to see whether they expose some type of information that we do not want to be public.

Using the standard Python libraries, it is possible to create a simple program that connects to a server and captures the banner of the service included in the response to the request. The simplest way to obtain the banner of a server is by using the socket

Get Mastering Python for Networking and Security 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.