summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-03-15 10:41:48 +0100
committerDaniel Borkmann <dborkman@redhat.com>2013-03-15 10:41:48 +0100
commit1a9fbac03c684f29cff9ac44875bd9504a89f54e (patch)
tree1b2e40dbe5dc1899ef5b62c4325c9b94c9c450fc /test
all: import netsniff-ng 0.5.8-rc0 source
We decided to get rid of the old Git history and start a new one for several reasons: *) Allow / enforce only high-quality commits (which was not the case for many commits in the history), have a policy that is more close to the one from the Linux kernel. With high quality commits, we mean code that is logically split into commits and commit messages that are signed-off and have a proper subject and message body. We do not allow automatic Github merges anymore, since they are total bullshit. However, we will either cherry-pick your patches or pull them manually. *) The old archive was about ~27MB for no particular good reason. This basically derived from the bad decision that also some PDF files where stored there. From this moment onwards, no binary objects are allowed to be stored in this repository anymore. The old archive is not wiped away from the Internet. You will still be able to find it, e.g. on git.cryptoism.org etc. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'test')
-rwxr-xr-xtest/dissector_fuzz.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/dissector_fuzz.sh b/test/dissector_fuzz.sh
new file mode 100755
index 0000000..87d8b8b
--- /dev/null
+++ b/test/dissector_fuzz.sh
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+
+# Note: build and _install_ the toolkit first!
+
+set -u
+
+if [ ${BASH_VERSINFO} -lt 3 ] ; then
+ echo 'Error: Your bash need to be version 3 or newer. Exiting.'
+ exit 1 # operators like =~ produce errors silently in old bash versions, so exit here
+fi
+
+archive='ftp://wireshark.org/automated/captures/'
+show_output='' # empty string evaluates to false
+run_through='' # empty string evaluates to false
+count_cores=0
+count_files=0
+netsniff_ng_opts=''
+
+if [ $# -gt 0 ] ; then
+ if [ "$1" = '-h' -o "$1" = '--help' -o "$1" = '--usage' ] ; then
+ echo 'Usage: dissector_fuzz [-s (show netsniff-ng output, default: no)] [-r (keep running on errors, default: no)] [netsniff-ng long-args]'
+ exit 0
+ fi
+
+ for opt in $@ ; do
+ if [ "${opt}" = '-s' ] ; then
+ show_output='true'
+ elif [ "${opt}" = '-r' ] ; then
+ run_through='true'
+ else
+ netsniff_ng_opts="${netsniff_ng_opts} ${opt}";
+ fi
+ done
+fi
+
+mkdir -p fuzzing
+cd fuzzing
+wget -r -Nc -np -nd -A.pcap "$archive" |& grep -E "%|^--"
+ulimit -c unlimited
+rm -f core
+for file in *.pcap
+do
+ echo "Testing file $file ..."
+ if [ $show_output ]; then
+ netsniff-ng --in "$file" "${netsniff_ng_opts}"
+ else
+ netsniff-ng --in "$file" "${netsniff_ng_opts}" > /dev/null
+ fi
+ if [ -e core ]; then
+ echo "Fuck, core dumped on $file!"
+ let count_cores=count_cores+1
+ if [ $run_through ]; then
+ rm core
+ else
+ exit
+ fi
+ fi
+done
+
+if which cowsay > /dev/null ; then
+ echo_cmd='cowsay'
+else
+ echo_cmd='echo'
+fi
+
+${echo_cmd} 'Your fuckup Score'
+echo " * tested pcaps: $count_files"
+echo " * core dumps: $count_cores"