Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/integration_tests/debug.sh
2061 views
1
#!/bin/bash
2
3
if [ $1 = "-h" ]; then
4
echo "Help for ./debug.sh"
5
printf "\n1. To run all integration tests of 'x' protocol:\n"
6
printf " \$ ./debug.sh http\n\n"
7
printf "2. To run all integration tests of 'x' protocol that contains 'y' in template name:\n"
8
printf " \$ ./debug.sh http self\n\n"
9
printf "3. To run all integration tests of 'x' protocol that contains 'y' in template name and pass extra args to nuclei:\n"
10
printf " \$ ./debug.sh http self -svd -debug-req\n\n"
11
printf "nuclei binary is created every time script is run but integration-test binary is not"
12
exit 0
13
fi
14
15
# Stop execution if race condition is found
16
export GORACE="halt_on_error=1"
17
18
echo "::group::Build nuclei"
19
rm nuclei 2>/dev/null
20
cd ../cmd/nuclei
21
go build -race .
22
mv nuclei ../../integration_tests/nuclei
23
echo -e "::endgroup::\n"
24
cd ../../integration_tests
25
cmdstring=""
26
27
if [ -n "$1" ]; then
28
cmdstring+=" -protocol $1 "
29
fi
30
31
if [ -n "$2" ]; then
32
cmdstring+=" -template $2 "
33
fi
34
35
# Parse any extra args that are directly passed to nuclei
36
if [ -n $debugArgs ]; then
37
export DebugExtraArgs="${@:3}"
38
fi
39
40
echo "$DebugExtraArgs"
41
42
echo -e "::group::Run Integration Test\n"
43
./integration-test $cmdstring
44
45
if [ $? -eq 0 ]
46
then
47
echo -e "::endgroup::\n"
48
exit 0
49
else
50
exit 1
51
fi
52
53