Simple Python List that checks a file list to see if a webserver HTTP is running

By | July 25, 2015

#!/usr/bin/python

import sys, httplib

def main(host, path):
try:# make a http HEAD request
h = httplib.HTTP(host)
h.putrequest(“HEAD”, “/”+path.strip(“n”))
h.putheader(“Host”, host)
h.endheaders()
status, reason, headers = h.getreply()
print “[+]”,host+”/”+path.strip(“n”),”:”,status, reason
except:
print “[-] Error Occurred”
pass

if len(sys.argv) != 2:
print “Usage: ./getresp.py <list of sites>”
sys.exit(1)

print “n d3hydr8[at]gmail[dot]com getResp v1.0”
print “———————————————-”

try:
list1 = open(sys.argv[1], “r”).readlines()
except(IOError):
print “[-] Error: Check your list file.n”
sys.exit(1)

print “n[+] Loaded:”,len(list1),”sites”

for host in list1:
try:
main(host.strip(“http://”).split(“/”,1)[0], host.strip(“http://”).split(“/”,1)[1])
except(IndexError):
main(host, “/”)
print “n[+] Donen”

Share Button

One thought on “Simple Python List that checks a file list to see if a webserver HTTP is running

  1. Pingback: Joseph de Saram#Rhodium

Leave a Reply

Your email address will not be published. Required fields are marked *