3 # A little script to run tshark on capture file[s] (potentially ones that
4 # failed fuzz testing). Useful because it sets up ulimits and other environment
5 # variables for you to ensure things like misused ephemeral memory are caught.
6 # (I'm writing this after having my machine hang up for like 15 minutes because
7 # I wasn't paying attention while tshark was running on a fuzzed capture and
8 # it used all my RAM + swap--which was pretty painful.)
10 # Copyright 2012 Jeff Morriss <jeff.morriss.ws [AT] gmail.com>
14 # Wireshark - Network traffic analyzer
15 # By Gerald Combs <gerald@wireshark.org>
16 # Copyright 1998 Gerald Combs
18 # This program is free software; you can redistribute it and/or
19 # modify it under the terms of the GNU General Public License
20 # as published by the Free Software Foundation; either version 2
21 # of the License, or (at your option) any later version.
23 # This program is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 # GNU General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with this program; if not, write to the Free Software
30 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 printf "Usage: $0 /path/to/file[s].pcap\n"
39 .
`dirname $0`/test-common.sh ||
exit 1
41 # set some limits to the child processes, e.g. stop it if it's running longer then MAX_CPU_TIME seconds
42 # (ulimit is not supported well on cygwin and probably other platforms, e.g. cygwin shows some warnings)
43 ulimit -S -t $MAX_CPU_TIME -v $MAX_VMEM
44 # Allow core files to be generated
49 echo "Testing file $file..."
50 echo -n " - with tree... "
51 if $BIN_DIR/tshark
-nVxr $file > /dev
/null
54 echo -n " - without tree... "
55 if $BIN_DIR/tshark
-nr $file > /dev
/null
58 echo -n " - without tree but with a read filter... "
59 if $BIN_DIR/tshark
-Yframe -nr $file > /dev
/null