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.
 
 
 

39 lines
830 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. if [ -z "$FUZZIT_API_KEY" ]; then
  9. echo "Set FUZZIT_API_KEY to your Fuzzit API key"
  10. exit 2
  11. fi
  12. # Configure
  13. ROOT=./server
  14. TYPE=$1
  15. # Setup
  16. export GO111MODULE="off"
  17. go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build
  18. go get -d -v -u ./...
  19. if [ ! -f fuzzit ]; then
  20. wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.29/fuzzit_Linux_x86_64
  21. chmod a+x fuzzit
  22. fi
  23. # Fuzz
  24. function fuzz {
  25. FUNC=Fuzz$1
  26. TARGET=$2
  27. DIR=${3:-$ROOT}
  28. go-fuzz-build -libfuzzer -func $FUNC -o fuzzer.a $DIR
  29. clang -fsanitize=fuzzer fuzzer.a -o fuzzer
  30. ./fuzzit create job --type $TYPE $TARGET fuzzer
  31. }
  32. fuzz Profile profile
  33. fuzz HTTP http
  34. fuzz HTTPS https