#!/bin/bash # # script to check, if the firewall did log something... # author : Stefan M. Huber # date : 2000-04-10 # update : 2000-07-13 # This variable contains the file to scrutinize. IPLOG=/var/log/messages case $1 in --help) echo "$0: Usage: $0 [--help] | [-f output-file] | [-a output-file] | [-r] | [-c] | [-b]" 1>&2 echo -e "\n" echo " --help displays this message" echo " -f specifies an output file of matching lines which is then viewed with less" echo " -a same as -f but appends output to file" echo " -r deletes matching lines from /var/log/messages" echo " -c only count matching lines" echo " -b only list packets that weren't accepted" ;; -a) grep "Packet log:" $IPLOG >> $2 ;; -f) grep "Packet log:" $IPLOG > $2 ;; -r) mv ${IPLOG} ${IPLOG}.ipchk grep -v "Packet log:" ${IPLOG}.ipchk > ${IPLOG} killall -HUP syslogd ;; -c) grep -c "Packet log:" $IPLOG ;; -b) grep "Packet log:" $IPLOG | grep -v "ACCEPT" ;; *) grep "Packet log:" $IPLOG ;; esac