#!/bin/sh
# Copyright 2005 Michael John Wensley http://www.wensley.org.uk/
echo -ne "Content-Type: text/html\r\n\r\n"
cat << EOF
No! I'm no pirate? But I've lost my parrot.... Polly? POLLY? ...want a cracker?
No! I'm no pirate? But I've lost my parrot.... Polly? POLLY? ...want a cracker?
This page is automatically generated from logs of unauthorised SSH connections... Over 40 attempts guarantees a listing ;) Enjoy the source
EOF
for N in /var/log/auth.log /var/log/auth.log.0
do
case $N in
*gz) zgrep "Invalid user" $N
;;
*bz2) bzgrep "Invalid user" $N
;;
*) grep "Invalid user" $N
;;
esac
done | cut -c 22- | rev | cut -d" " -f1 | rev | uniq -c | while read N1 N2
do
IPV4=`ipv6calc -imq $N2 | grep IPV4= | cut -d= -f2`
# N8 is the username
if expr $N1 \> 40 > /dev/null
then
CN=`geoiplookup $IPV4 | cut -d: -f2`
echo -n "- "
if [ "`echo $CN | cut -c3`" == "," ]
then
echo -n "
"
fi
echo -n "${N1}"$' hits from '"${CN}"$' at '"${IPV4}"
echo $' '
fi
done
echo "- Revalidate
"
echo "- Validate CSS
"
echo "- Rest of site
"
echo "
"