Python — Web Server Version (Apache,IIS)

The below script can be run against a single or multiple websites…

https://github.com/MarkSpencerIT/SecurityTools/blob/main/AppacheVersion.py

How the script works ….

This part of the script will import a python library which will allow use to run the rest of the script against a website.

We then define the websites we would like to test and pull back information from, if you would like to add more sites then you add a line and update the responseX (x=number) as this is used further down in the script …

In the next part we set the value. This is the part of the script which defines what information we want to see, so in the below we are asking the for the script to find the “Server” section from the header information.

This next part prints the results in the Python terminal

The final part then writes the Value to a text file …

Here is the text file …

N.B. — “output.write(“\n”) inputs a new line, if you do not use this then each Value will write on a single line.

You can find this on my github … https://github.com/MarkSpencerIT/SecurityTools/blob/main/AppacheVersion.py