exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

GetHTTPStatus Scanning Script

GetHTTPStatus Scanning Script
Posted Jan 31, 2011
Authored by Sebastien Damaye

GetHTTPStatus is a simple python script that scans a set of provided URLs and returns the status codes provided. It has the ability to use cookies if needed.

tags | tool, scanner, python
systems | unix
SHA-256 | e2bc79b48cf3e7d09e13850c55cc2f6ce1a7c571a8ea3f55dd7677e2e33084aa

GetHTTPStatus Scanning Script

Change Mirror Download
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
pygetstatus.py
Sebastien Damaye (www.aldeid.com)
2011-01-30


This program opens a socket to a target (web server) and sends HEAD requests for
a list of URLs provided. For each URL, the returned status is displayed (e.g.
200 for OK, 404 for Not Found, ...)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""

import httplib
import socket
import sys
import os
from optparse import OptionParser

class Scan:
def __init__(self, fileUrls, target, port=80, cookie=''):
"""Perform some checks
"""
self.fileUrls = fileUrls
if not os.path.exists(self.fileUrls):
print ("File %s not found. Please check location." % self.fileUrls)
sys.exit(2)
self.target = target
self.port = port
self.cookie = cookie

def getStatus(self):
"""Get the status of requests provided in fileUrls
"""
urls = open(self.fileUrls, "r")
if self.cookie:
params = {}
headers = {"Cookie": self.cookie}

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, self.port))

for iurl in urls:
url = iurl.split('\n')[0]
conn = httplib.HTTPConnection(self.target, self.port)
try:
if self.cookie:
conn.request('HEAD', url, params, headers)
else:
conn.request('HEAD', url)
except:
print "***Error: Unable to connect"
else:
res = conn.getresponse()
print "%s;%s" % (url,res.status)
conn.close

s.close()
urls.close()

if __name__ == '__main__':
usage = "usage: %prog -t <target> -u <fileUrls> [options]"
parser = OptionParser(usage)
parser.add_option("-t", "--target", dest="target",
help="host to connect to (e.g. 192.168.100.14)")
parser.add_option("-p", "--port", dest="port", default=80,
help="port to connect to (default: 80)")
parser.add_option("-u", "--url", dest="fileUrls",
help="file that contains URLs (one per line)")
parser.add_option("-c", '--cookie', dest="cookie", default='',
help="eventual cookie to use (syntax: ""key=value"", e.g. ""PHPSESSID=abcdefghj"")")
(options, args) = parser.parse_args(sys.argv)
if not options.target:
parser.error("Target missing. Use -t <target>.")
if not options.fileUrls:
parser.error("URLs file missing. Use -u <fileUrls>.")

oScan = Scan(options.fileUrls, options.target, options.port, options.cookie)
oScan.getStatus()
del oScan
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    63 Files
  • 14
    Nov 14th
    18 Files
  • 15
    Nov 15th
    8 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    18 Files
  • 19
    Nov 19th
    7 Files
  • 20
    Nov 20th
    13 Files
  • 21
    Nov 21st
    6 Files
  • 22
    Nov 22nd
    48 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    60 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    44 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close