You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 line
729 B

  1. #!/bin/bash
  2. set -xe
  3. # Validate arguments
  4. if [ "$#" -ne 1 ]; then
  5. echo "Usage: $0 <fuzz-type>"
  6. exit 1
  7. fi
  8. # Configure
  9. ROOT=./server
  10. TYPE=$1
  11. # Setup
  12. export GO111MODULE="off"
  13. go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build
  14. go get -d -v -u ./...
  15. if [ ! -f fuzzit ]; then
  16. wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.29/fuzzit_Linux_x86_64
  17. chmod a+x fuzzit
  18. fi
  19. # Fuzz
  20. function fuzz {
  21. FUNC=Fuzz$1
  22. TARGET=$2
  23. DIR=${3:-$ROOT}
  24. go-fuzz-build -libfuzzer -func $FUNC -o fuzzer.a $DIR
  25. clang -fsanitize=fuzzer fuzzer.a -o fuzzer
  26. ./fuzzit create job --type $TYPE $TARGET fuzzer
  27. }
  28. fuzz Profile profile
  29. fuzz HTTP http
  30. fuzz HTTPS https