#!/bin/bash
# This file contains the commands necessary to capture a sniffer trace

Usage()
{
  echo "Usage: $0 <interface>"
  echo "Captures a network trace on the specified interface."
  echo "WARNING: sniffing eth1 on the ISC will produce a huge trace file."
  exit
}

if [ $# -ne 1 ]
then
  Usage
fi

if [ $# == 1 ]
then
  ifconfig $1
  if [ $? -ne 0 ]
  then
    Usage
  else
    interface=$1
  fi
fi

sysname=`uname -n`
date=`date +%Y%m%d_%0k%M%S`

file=$NNLOGS/$sysname"_"$interface"_"$date.cap

echo Creating network capture file: $file
echo Press ctrl-C when done.
tcpdump -s 0 -n -nn -i $interface -w $file


