output_to_pcap.sh 595 B

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