Path: blob/dev/cmd/integration-test/template-dir.go
2070 views
package main12import (3"os"45"github.com/projectdiscovery/nuclei/v3/pkg/testutils"6"github.com/projectdiscovery/utils/errkit"7)89var templatesDirTestCases = []TestCaseInfo{10{Path: "protocols/dns/cname-fingerprint.yaml", TestCase: &templateDirWithTargetTest{}},11}1213type templateDirWithTargetTest struct{}1415// Execute executes a test case and returns an error if occurred16func (h *templateDirWithTargetTest) Execute(filePath string) error {17tempdir, err := os.MkdirTemp("", "nuclei-update-dir-*")18if err != nil {19return errkit.Wrap(err, "failed to create temp dir")20}21defer func() {22_ = os.RemoveAll(tempdir)23}()2425results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "8x8exch02.8x8.com", debug, "-ud", tempdir)26if err != nil {27return err28}2930return expectResultsCount(results, 1)31}323334