#!/bin/sh

# Require destination
#######################################

if [ -z "$1" ]; then
  echo "usage: $0 <site>"                    
  exit -1
fi 

USER=`whoami`

# NetCraft Query
#######################################

echo "Netcraft: `lynx -dump -nolist http://uptime.netcraft.com/graph?display=uptime\&site=$1 | egrep -A1 "The site $1 is running"`"

# NMAP Fingerprinting (force root)
#######################################

if [ $USER = root ]; then
  nmap -P0 -p 22,23,25,53,80 -O $1 2>/dev/null >> /tmp/$1-nmap_results
  NMAPOUT=`egrep -i '(system guess|Remote OS guesses)' /tmp/$1-nmap_results`
  echo "nmap: $NMAPOUT"
#else
#  /usr/local/bin/sudo /usr/local/bin/nmap -P0 -p 22,23,25,53,80 -O $1 2>/dev/null >> /tmp/$1-nmap_results
#  NMAPOUT=`egrep -i '(system guess|Remote OS guesses)' /tmp/$1-nmap_results`
#  echo "nmap: $NMAPOUT"
fi


# Check the remote server itself 
#######################################

echo "$1: `lynx -dump -nolist -head http://$1 | egrep -i server` "

# Clean up
#######################################

rm /tmp/$1-nmap_results

# Stuff to scare script kiddies who run things without reading them first
########################################################################

echo " "
echo "j00 h4v3 b33n h4x0r3d!#@%!!"
echo " "
sleep 2
echo "haHahaAhahaAHAhaha...."
sleep 5
