tag: HTTP

Script to get HTTP Headers

2 Aug, 2013 - 1 minutes
The below script uses urllib2 to connect to the given URL(s) then prints out the HTTP headers. http-server-header.py #:/bin/python import urllib2, sys if len(sys.argv) == 1: print "Please feed me a URL...\n\n<3\n" sys.exit(0) for url in sys.argv[1:]: r = urllib2.urlopen(url) print 'URL: ' + url + '\n' + str(r.info()) An example of it working is shown below. From a “security through obscurity” view, you’d want to conceal your HTTP server information.