HTTP tools

Quick one-page serving web server

while true; do
    echo -e "HTTP/1.1 200 OK\nContent-Type: text/html\n\
Content-Length: $(du -b index.html | awk '{print $1}')\n\
Connection: close\n\n $(cat index.html)\r\n" |
    nc -lp 8888
    sleep 1
done

tree

Build a directory listing of your entire site, sorted by mod time.

tree -I index.html --matchdirs -t -H <base url> \
     -T "Dir Listing" --noreport . > tree.html

Create an html directory listing for your entire site.

tree -R -L 1 --dirsfirst -H <base url> \
     -T "Dir Listing" --noreport . > tree.html

Curl

Log into site via HTTP POST and save cookie.

curl --cookie-jar cookie.txt 'http://www.server.com' \
    -d "user=<user>&password=<password>"'

Download private_file.zip via the previusly saved cookie. Follow any redirect.

curl --cookie cookie.txt --location \
    "http://www.server.com/private_file.zip" -O 

Other HTTP POST alternatives:

curl -v <url> -d @data_post.txt
w3m -post data_post.txt <url>

Questions, comments? Connect.