-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from KTH/wasm-fuzzer
WIP: support the real coverage in fuzzer
- Loading branch information
Showing
22 changed files
with
276 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
*.out | ||
*.dat | ||
*.dat | ||
./fuzzing-server-swam/out | ||
./wafl-temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
aflpp | ||
wafl | ||
out* | ||
fuzzing-server-swam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
echo "Cloning SWAM" | ||
if [ ! -d fuzzing-server-swam ]; then | ||
git clone --single-branch --branch master https://github.com/KTH/swam.git fuzzing-server-swam | ||
fi | ||
|
||
echo "Building SWAM" | ||
cd fuzzing-server-swam | ||
git pull | ||
./millw cli.assembly | ||
export SWAM_JAR=$(CURRENT_DIR)/fuzzing-server-swam/out/cli/assembly/dest/out.jar | ||
echo $SWAM_JAR | ||
cd .. | ||
|
||
|
||
# Download afl plus plus | ||
if [ ! -d aflpp ]; then | ||
echo "Downloading aflplusplus..." | ||
git clone https://github.com/AFLplusplus/AFLplusplus.git aflpp | ||
|
||
echo "Building aflplusplus..." | ||
cd aflpp | ||
make distrib | ||
sudo make install | ||
cd .. | ||
fi | ||
|
||
|
||
echo "Building the wafl interface..." | ||
|
||
mkdir -p $CURRENT_DIR/wafl-temp | ||
CPP_OUT_DIR=$CURRENT_DIR/wafl-temp/cpp-out | ||
mkdir -p $CPP_OUT_DIR | ||
|
||
g++ -o $CPP_OUT_DIR/prepare_wasm_input.out ./fuzzing-client-afl/prepare_wasm_input.cpp ./fuzzing-client-afl/utils.cpp | ||
g++ -o $CPP_OUT_DIR/getFileSize.out ./fuzzing-client-afl/getFileSize.cpp ./fuzzing-client-afl/utils.cpp | ||
g++ -o $CPP_OUT_DIR/wait_for_server.out ./fuzzing-client-afl/wait_for_server.cpp ./fuzzing-client-afl/utils.cpp ./fuzzing-client-afl/socket_client.cpp | ||
g++ -o $CPP_OUT_DIR/run_client.out ./fuzzing-client-afl/run_client.cpp ./fuzzing-client-afl/socket_client.cpp ./fuzzing-client-afl/utils.cpp | ||
g++ -o $CPP_OUT_DIR/interface.out ./fuzzing-client-afl/interface.cpp ./fuzzing-client-afl/socket_client.cpp ./fuzzing-client-afl/utils.cpp | ||
|
||
echo "DONE !" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# TODO: Put this file back into the SWAM repo | ||
|
||
# TODO: Put this into entrypoint_afl.sh as well as soon as the server infers the signature itself. | ||
# So that this script can be run by itself as | ||
# well (same commands as wafl.sh) | ||
if [[ $ENV_PREPARED != "True" ]]; then | ||
echo "Preparing environment!" | ||
source ../prepare_env.sh $@ | ||
fi | ||
|
||
# Get wasm/wat from $WASM_DIR directory | ||
echo "WASM_OR_WAT_FILE: $WASM_OR_WAT_FILE" | ||
|
||
# Parse WASM_ARG_TYPES_CSV: "Int64,Int32" to "--argType Int64 --argType Int32" | ||
ALL_ARG_TYPES="" | ||
IFS=',' read -r -a WASM_ARG_TYPES_ARRAY <<<"$WASM_ARG_TYPES_CSV" | ||
for element in "${WASM_ARG_TYPES_ARRAY[@]}"; do | ||
ALL_ARG_TYPES="$ALL_ARG_TYPES --argType $element" | ||
done | ||
echo "ALL_ARG_TYPES: $ALL_ARG_TYPES" | ||
|
||
if [[ $WASM_OR_WAT_FILE == *.wat ]]; then WAT_ARG="--wat"; fi | ||
if [[ $WASI == "True" ]]; then WASI_ARG="--wasi"; fi | ||
if [[ $WASI_FILTER == "True" ]]; then WASI_ARG="$WASI_ARG -r"; fi | ||
|
||
cd $SRC_SWAM_DIR | ||
|
||
LOGGING_ARG="1> $LOGS_DIR/swam.std.txt 2> $LOGS_DIR/swam.err.txt &" | ||
|
||
echo "$SWAM_CMD run_server $WASM_OR_WAT_FILE --main $TARGET_FUNCTION $WAT_ARG $WASI_ARG $ALL_ARG_TYPES $LOGGING_ARG" | ||
exec $SWAM_CMD run_server $WASM_OR_WAT_FILE --main $TARGET_FUNCTION $WAT_ARG $WASI_ARG $ALL_ARG_TYPES 1> $LOGS_DIR/swam.std.txt 2> $LOGS_DIR/swam.err.txt |
Oops, something went wrong.