Gethttpstatus

From aldeid
Jump to: navigation, search

Description

GetHttpStatus.py is a Python script that connects to a web server and sends HEAD request from a list of URLs to get the returned status (e.g. 200 for OK, 404 for Not Found, ...).

I have written this tool in the shape of a counter-expertise of Apache log files, as a PoC to check that resources where available.

For more information about HTTP status codes, read this article: Page in French Codes_erreurs_html.

Installation

$ cd ~/
$ wget http://packetstorm.linuxsecurity.com/UNIX/scanners/gethttpstatus.py.txt
$ mv gethttpstatus.py.txt gethttpstatus.py
$ chmod +x gethttpstatus.py

Usage

Syntax

$ ./gethttpstatus.py -t <target> -u <fileUrls> [options]

Options

Mandatory options

-t <target>, --target=<target>
Host to connect to (e.g. 192.168.100.14)
-u <file>, --url=<file>
File that contains URLs (one per line)

Optional Options

-h, --help
Show this help message and exit
-p <port>, --port=<port>
Port to connect to (default: 80)
-c <cookie>, --cookie=<cookie>
Eventual cookie to use (syntax: key=value, e.g. PHPSESSID=abcdefghj)

Example

Given following urls.txt file:

/
/index
/index.htm
/index.html
/index.php
/index.php/Dropbox
/index.php/Blacktrack
/index.php/Backtrack

Here is an example of usage:

$ python gethttpstatus.py -t aldeid.com -u urls.txt
/;301
/index;404
/index.htm;404
/index.html;404
/index.php;301
/index.php/Dropbox;200
/index.php/Blacktrack;404
/index.php/Backtrack;200

It is possible to redirect the output to an external file (e.g. CSV file) to be able to process statistics:

$ python gethttpstatus.py -t aldeid.com -u urls.txt > aldeid.csv

Comments

Talk:Gethttpstatus