I am looking for a python- script that analyzes the site in order to identify the type of HTTP server being used .

Write a link to any sample.

  • You can ask why exactly python? The task, by the way, is very nontrivial. - VladD
  • on python, p.ch. started to teach him / - af75

2 answers 2

With the help of the requests plugin, you can easily solve your problem.

import requests r = requests.get('http://vk.com/') print r.headers["server"] // nginx/1.2.4 print r.headers["x-powered-by"] // PHP/5.2.6-1+lenny9 

Since there is only one HTTP server on the site, it makes no sense to analyze all the pages, one is enough.

  • This is good if the server is so honest and gives the right header. And if not? - VladD
  • 3
    If the server replaces its header, then only the heuristic methods remain, see the answer above about nmap. More often, nginx hides a backend server to generate dynamics (most often it is apache). - dred

Ready, for sure, no.

As an option:

  • nmap will scan the 80th and 443rd ports of the required hosts.
  • curl'om go to different pages of the site and parse from the header field Server.

From python call it through subprocess (or analogs).