1#!/bin/bash 2 3if [ -z "$1" ] 4then 5 echo "This script will make pcap files from the afl-fuzz crash/hang files" 6 echo "It needs hexdump and text2pcap" 7 echo "Please give output directory as argument" 8 exit 2 9fi 10 11for i in `ls $1/crashes/id*` 12do 13 PCAPNAME=`echo $i | grep pcap` 14 if [ -z "$PCAPNAME" ]; then 15 hexdump -C $i > $1/$$.tmp 16 text2pcap $1/$$.tmp ${i}.pcap 17 fi 18done 19for i in `ls $1/hangs/id*` 20do 21 PCAPNAME=`echo $i | grep pcap` 22 if [ -z "$PCAPNAME" ]; then 23 hexdump -C $i > $1/$$.tmp 24 text2pcap $1/$$.tmp ${i}.pcap 25 fi 26done 27rm -f $1/$$.tmp 28 29echo 30echo "Created pcap files:" 31ls $1/*/*.pcap 32