transfer.sh/fuzzit.sh

34 lines
733 B
Bash
Raw Permalink Normal View History

2019-08-29 07:17:28 +02:00
#!/bin/bash
set -xe
# Validate arguments
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <fuzz-type>"
exit 1
fi
# Configure
NAME=transfersh
2019-08-29 07:17:28 +02:00
ROOT=./server
TYPE=$1
# Setup
2019-10-07 22:18:36 +02:00
export GOFUZZ111MODULE="on"
2019-08-29 07:17:28 +02:00
go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build
go get -d -v -u ./...
if [ ! -f fuzzit ]; then
2019-10-07 22:18:36 +02:00
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.72/fuzzit_Linux_x86_64
2019-08-29 07:17:28 +02:00
chmod a+x fuzzit
fi
# Fuzz
function fuzz {
FUNC=Fuzz$1
TARGET=$2
DIR=${3:-$ROOT}
go-fuzz-build -libfuzzer -func $FUNC -o fuzzer.a $DIR
clang -fsanitize=fuzzer fuzzer.a -o fuzzer
./fuzzit create job --type $TYPE $NAME/$TARGET fuzzer
2019-08-29 07:17:28 +02:00
}
2019-08-31 11:41:34 +02:00
fuzz LocalStorage local-storage