LNIC=eth1 HOME=/admin/snort SNORT=/usr/local/bin/snort CONF=/admin/snort/snort.conf cd $HOME # the -D is to make to run in the background # the -c secifies the conf file # the -C dumps character data # the -i tells it what interface to watch # the -I adds the interface name to the alerts # the -p does not put the interface into promiscous mode # the -q is for quiet running # the -z is for connection checking # the -U is for a timestamp $SNORT -D -c $CONF -C -i $LNIC -I -p -q -z -U |
HOME=/admin/snort/custom LOG=output.alert NIC=eth1 ##get a baseline cat /var/log/snort/alert | grep -A 2 eth1 | grep -v Classi > $HOME/$LOG ##give log start date START=`cat $HOME/$LOG | head -2 | grep -e "->" | cut -f 1 -d "."` echo "log starts at $START" ##total number of alerts TOTAL=`cat $HOME/$LOG | grep $NIC | wc -l` echo "total alerts = $TOTAL" echo "" ##all unique packet matches echo "all unique matches are.." cat $HOME/$LOG | grep $NIC | sort | uniq echo "" ##a count of all unique packet matches with source and destination echo "match count.." for x in `cat $HOME/$LOG | grep $NIC | sort | uniq | cut -f 3 -d "[" | cut -f 1 -d "]"` do CNT=`cat $HOME/$LOG | grep -e "$x" | wc -l` NAME=`cat $HOME/$LOG | grep -e "$x" | head -1` echo "$NAME had $CNT total matches" echo "..match sources.." cat $HOME/$LOG | grep -A 2 -e "$x" | grep -e "->" | gawk '{ print $2 }' | cut -f 1 -d ":" | sort | uniq echo "..match targets.." cat $HOME/$LOG | grep -A 2 -e "$x" | grep -e "->" | gawk '{ print $4 }' | cut -f 1 -d ":" | sort | uniq echo "" done ##top 10 source of packet matches with a count echo "" echo "top sources of matches.." for y in `cat $HOME/$LOG | grep -e "->" | gawk '{ print $2 }' | cut -f 1 -d ":" | sort | uniq | head -10` do SCNT=`cat $HOME/$LOG | grep -e "->" | gawk '{ print $2 }' | grep $y | wc -l` echo "$y had $SCNT matches" done ##top 10 destinations of packet matches with a count echo "" echo "top destinations of matches.." for k in `cat $HOME/$LOG | grep -e "->" | gawk '{ print $4 }' | cut -f 1 -d ":" | sort | uniq | head -10` do DCNT=`cat $HOME/$LOG | grep -e "->" | gawk '{ print $4 }' | grep $k | wc -l` echo "$k had $DCNT matches" done ##end date of the log echo "" END=`cat $HOME/$LOG | tail -2 | grep -e "->" | cut -f 1 -d "."` echo "log ends at $END" |