#!/bin/bash # Copyright 2001 by Bryan Andersen under GNU CopyLeft license. # Code has only been run on an OpenBSD system. # Usage: # Change logdir to your local log directory for Apache # Change the IP#s in the /16 and /8 lines for your network. # Add days to the "for d in ..." line as time passes. # Note: days 1-9 of the month will need leading 0s. TMP=/tmp/get-counts$$ logdir=/var/www/logs slash16=208.42 slash8=208 (zcat `ls -r $logdir/access_log.*.gz` ; cat $logdir/access_log) | grep -e ".exe" -e ".ida" -e "XXXXXX" -e "NNNNNN" -e "AAAAAA" -e "OOOOOO" > $TMP for m in Sep do #for d in 01 02 03 04 05 06 07 08 09 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 for d in 18 19 20 21 22 23 do for h in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 do date=$d/$m/2001:$h echo -e $date"\t/16"`grep $date < $TMP | grep '^'$slash16 | grep -e .ida -e "XXXXXX" -e "NNNNNN" | wc -l`\ "\t/8"`grep $date < $TMP | grep '^'$slash8 | grep -e .ida -e "XXXXXX" -e "NNNNNN" | wc -l`\ "\t/0"`grep $date < $TMP | grep -e .ida -e "XXXXXX" -e "NNNNNN" | wc -l`\ "\t/16"`grep $date < $TMP | grep '^'$slash16 | grep .exe | grep MSADC | wc -l`\ "\t/8"`grep $date < $TMP | grep '^'$slash8 | grep .exe | grep MSADC | wc -l`\ "\t/0"`grep $date < $TMP | grep .exe | grep MSADC | wc -l` done done done rm -f $TMP exit 0