Run template update once during functional and integration test

dev
Ice3man 2022-03-03 19:10:03 +05:30
parent 4ffbbc78ba
commit 4d6071c1e0
3 changed files with 12 additions and 0 deletions

View File

@ -6,12 +6,18 @@ cd ../v2/cmd/nuclei
go build
mv nuclei ../../../integration_tests/nuclei
echo "::endgroup::"
echo "::group::Build nuclei integration-test"
cd ../integration-test
go build
mv integration-test ../../../integration_tests/integration-test
cd ../../../integration_tests
echo "::endgroup::"
echo "::group::Installing nuclei templates"
./nuclei -update-templates
echo "::endgroup::"
./integration-test
if [ $? -eq 0 ]
then

View File

@ -15,6 +15,10 @@ echo "::group::Building Nuclei binary from current branch"
go build -o nuclei_dev$extension ../nuclei
echo "::endgroup::"
echo "::group::Installing nuclei templates"
./nuclei$extension -update-templates
echo "::endgroup::"
echo "::group::Building latest release of nuclei"
go build -o nuclei$extension -v github.com/projectdiscovery/nuclei/v2/cmd/nuclei
echo "::endgroup::"

View File

@ -45,6 +45,7 @@ func RunNucleiAndGetResults(isTemplate bool, template, url string, debug bool, e
func RunNucleiBareArgsAndGetResults(debug bool, extra ...string) ([]string, error) {
cmd := exec.Command("./nuclei")
cmd.Args = append(cmd.Args, extra...)
cmd.Args = append(cmd.Args, "-duc") // disable auto updates
if debug {
cmd.Args = append(cmd.Args, "-debug")
cmd.Stderr = os.Stderr
@ -74,6 +75,7 @@ var templateLoaded = regexp.MustCompile(`(?:Templates|Workflows) loaded[^:]*: (\
// RunNucleiBinaryAndGetLoadedTemplates returns a list of results for a template
func RunNucleiBinaryAndGetLoadedTemplates(nucleiBinary string, debug bool, args []string) (string, error) {
cmd := exec.Command(nucleiBinary, args...)
cmd.Args = append(cmd.Args, "-duc") // disable auto updates
if debug {
cmd.Args = append(cmd.Args, "-debug")
fmt.Println(cmd.String())