2023-01-24 16:34:52 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-02-01 11:53:28 +00:00
|
|
|
if [ $1 = "-h" ]; then
|
|
|
|
echo "Help for ./debug.sh"
|
|
|
|
printf "\n1. To run all integration tests of 'x' protocol:\n"
|
|
|
|
printf " \$ ./debug.sh http\n\n"
|
|
|
|
printf "2. To run all integration tests of 'x' protocol that contains 'y' in template name:\n"
|
|
|
|
printf " \$ ./debug.sh http self\n\n"
|
|
|
|
printf "3. To run all integration tests of 'x' protocol that contains 'y' in template name and pass extra args to nuclei:\n"
|
|
|
|
printf " \$ ./debug.sh http self -svd -debug-req\n\n"
|
|
|
|
printf "nuclei binary is created everytime script is run but integration-test binary is not"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2023-02-06 10:48:30 +00:00
|
|
|
# Stop execution if race condition is found
|
|
|
|
export GORACE="halt_on_error=1"
|
2023-02-01 11:53:28 +00:00
|
|
|
|
2023-01-24 16:34:52 +00:00
|
|
|
echo "::group::Build nuclei"
|
|
|
|
rm nuclei 2>/dev/null
|
|
|
|
cd ../v2/cmd/nuclei
|
2023-02-06 10:48:30 +00:00
|
|
|
go build -race .
|
2023-01-24 16:34:52 +00:00
|
|
|
mv nuclei ../../../integration_tests/nuclei
|
2023-02-01 11:53:28 +00:00
|
|
|
echo -e "::endgroup::\n"
|
2023-01-24 16:34:52 +00:00
|
|
|
cd ../../../integration_tests
|
2023-02-01 11:53:28 +00:00
|
|
|
cmdstring=""
|
|
|
|
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
cmdstring+=" -protocol $1 "
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$2" ]; then
|
|
|
|
cmdstring+=" -template $2 "
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Parse any extra args that are directly passed to nuclei
|
|
|
|
if [ -n $debugArgs ]; then
|
|
|
|
export DebugExtraArgs="${@:3}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "$DebugExtraArgs"
|
|
|
|
|
|
|
|
echo -e "::group::Run Integration Test\n"
|
|
|
|
./integration-test $cmdstring
|
2023-01-24 16:34:52 +00:00
|
|
|
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
2023-02-01 11:53:28 +00:00
|
|
|
echo -e "::endgroup::\n"
|
2023-01-24 16:34:52 +00:00
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|