2005-12-13 23:15:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Configuration of the command line tests
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
2006-05-21 05:12:17 +00:00
|
|
|
# Wireshark - Network traffic analyzer
|
|
|
|
# By Gerald Combs <gerald@wireshark.org>
|
2005-12-13 23:15:20 +00:00
|
|
|
# Copyright 2005 Ulf Lamping
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2006-10-09 18:47:42 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# Set WS_SYSTEM to our system type, e.g. Windows, Linux, Darwin
|
|
|
|
# http://support.microsoft.com/kb/100843
|
|
|
|
if [ -n "${OS#Windows}" ] ; then
|
|
|
|
WS_SYSTEM="Windows"
|
2011-07-01 21:38:56 +00:00
|
|
|
export CYGWIN="$CYGWIN error_start=c:\cygwin\bin\dumper.exe -d %1 %2"
|
2006-10-09 18:47:42 +00:00
|
|
|
else
|
|
|
|
WS_SYSTEM=`uname -s`
|
|
|
|
fi
|
2005-12-13 23:15:20 +00:00
|
|
|
|
2007-11-08 16:59:30 +00:00
|
|
|
|
|
|
|
# Path to the Wireshark binaries, only used for the settings below
|
|
|
|
WS_BIN_PATH=..
|
|
|
|
|
|
|
|
# Are we allowed to open interfaces or capture on this system?
|
|
|
|
SKIP_CAPTURE=${SKIP_CAPTURE:-1}
|
|
|
|
|
|
|
|
# Override the last two items if we're running Windows
|
2006-10-09 18:47:42 +00:00
|
|
|
if [ "$WS_SYSTEM" = "Windows" ] ; then
|
|
|
|
WS_BIN_PATH=../wireshark-gtk2
|
2007-11-08 16:59:30 +00:00
|
|
|
SKIP_CAPTURE=0
|
2006-10-09 18:47:42 +00:00
|
|
|
fi
|
2005-12-13 23:15:20 +00:00
|
|
|
|
|
|
|
# Tweak the following to your liking.
|
2006-10-09 18:47:42 +00:00
|
|
|
WIRESHARK=$WS_BIN_PATH/wireshark
|
|
|
|
TSHARK=$WS_BIN_PATH/tshark
|
|
|
|
CAPINFOS=$WS_BIN_PATH/capinfos
|
|
|
|
DUMPCAP=$WS_BIN_PATH/dumpcap
|
2005-12-13 23:15:20 +00:00
|
|
|
|
|
|
|
# interface with at least a few packets/sec traffic on it
|
|
|
|
# (e.g. start a web radio to generate some traffic :-)
|
|
|
|
# an interfaces index (1 based) should do well for recent devbuilds
|
2007-03-06 23:55:00 +00:00
|
|
|
if [ "$WS_SYSTEM" = "Windows" -a -z "$TRAFFIC_CAPTURE_IFACE" ] ; then
|
|
|
|
# Try to fetch the first Ethernet interface.
|
2011-05-12 17:49:15 +00:00
|
|
|
TRAFFIC_CAPTURE_IFACE=`$TSHARK -D 2>&1 | \
|
2012-06-01 15:35:29 +00:00
|
|
|
egrep 'Ethernet|Network Connection|VMware|Intel|Realtek' | \
|
2007-03-06 23:55:00 +00:00
|
|
|
head -1 | cut -c 1`
|
|
|
|
fi
|
|
|
|
TRAFFIC_CAPTURE_IFACE=${TRAFFIC_CAPTURE_IFACE:-1}
|
2005-12-13 23:15:20 +00:00
|
|
|
|
|
|
|
# time to capture some traffic (in seconds)
|
|
|
|
# (you may increase this if you get errors caused by very low traffic)
|
2007-05-17 02:43:38 +00:00
|
|
|
TRAFFIC_CAPTURE_DURATION=60
|
2006-10-08 22:24:46 +00:00
|
|
|
|
|
|
|
# the default is to not capture in promiscuous mode
|
|
|
|
# (this makes known trouble with some Windows WLAN adapters)
|
|
|
|
# if you need promiscuous mode, comment this line out
|
2006-10-08 22:57:32 +00:00
|
|
|
TRAFFIC_CAPTURE_PROMISC=-p
|
|
|
|
|
2007-11-08 16:59:30 +00:00
|
|
|
# only test capturing from a fifo if we're not on Windows
|
|
|
|
# and we have a mkfifo. (Windows cygwin has a mkfifo but
|
|
|
|
# Windows dumpcap & etc use Windows named pipes which
|
|
|
|
# are different than the cygwin named pipes).
|
|
|
|
#
|
2007-08-27 17:49:53 +00:00
|
|
|
if [ "$WS_SYSTEM" != "Windows" ] && which mkfifo &>/dev/null ; then
|
2007-08-24 15:45:16 +00:00
|
|
|
TEST_FIFO=1
|
|
|
|
fi
|
|
|
|
|
2011-08-29 21:16:29 +00:00
|
|
|
# Tell Wireshark to quit after capuring packets.
|
|
|
|
export WIRESHARK_QUIT_AFTER_CAPTURE="True"
|
|
|
|
|
2012-03-30 18:13:41 +00:00
|
|
|
CAPTURE_DIR="captures/"
|
2012-03-30 17:51:54 +00:00
|
|
|
|
|
|
|
# Configuration paths
|
|
|
|
TEST_HOME="$PWD/fakehome"
|
2012-03-30 21:04:09 +00:00
|
|
|
HOME_ENV="HOME"
|
2012-03-30 18:13:41 +00:00
|
|
|
|
2012-03-30 17:51:54 +00:00
|
|
|
if [ "$WS_SYSTEM" == "Windows" ] ; then
|
2012-03-30 21:04:09 +00:00
|
|
|
TEST_HOME="`cygpath -w $TEST_HOME`"
|
|
|
|
HOME_ENV="APPDATA"
|
|
|
|
CAPTURE_DIR="`cygpath -w $CAPTURE_DIR`"
|
2012-03-30 17:51:54 +00:00
|
|
|
fi
|
|
|
|
|
2008-02-23 21:19:44 +00:00
|
|
|
# Display our environment
|
|
|
|
|
2008-02-24 02:21:37 +00:00
|
|
|
##printf "\n ------- Info =-----------------\n"
|
|
|
|
##printf "Syms :$WS_SYSTEM: :$TRAFFIC_CAPTURE_IFACE: :$SKIP_CAPTURE: :$TEST_FIFO:\n"
|
|
|
|
##
|
|
|
|
##ls -l $WIRESHARK $TSHARK $DUMPCAP
|
|
|
|
##ls -l $(which wireshark) $(which tshark) $(which dumpcap)
|
|
|
|
##printf " ----------------------------------\n\n"
|
2008-02-23 21:19:44 +00:00
|
|
|
|
2012-03-30 17:51:54 +00:00
|
|
|
# Editor modelines
|
|
|
|
#
|
|
|
|
# Local Variables:
|
|
|
|
# sh-basic-offset: 8
|
|
|
|
# tab-width: 8
|
|
|
|
# indent-tabs-mode: t
|
|
|
|
# End:
|
|
|
|
#
|
|
|
|
# ex: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
# :indentSize=8:tabSize=8:noTabs=false:
|