Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/cmd/integration-test/template-dir.go
2070 views
1
package main
2
3
import (
4
"os"
5
6
"github.com/projectdiscovery/nuclei/v3/pkg/testutils"
7
"github.com/projectdiscovery/utils/errkit"
8
)
9
10
var templatesDirTestCases = []TestCaseInfo{
11
{Path: "protocols/dns/cname-fingerprint.yaml", TestCase: &templateDirWithTargetTest{}},
12
}
13
14
type templateDirWithTargetTest struct{}
15
16
// Execute executes a test case and returns an error if occurred
17
func (h *templateDirWithTargetTest) Execute(filePath string) error {
18
tempdir, err := os.MkdirTemp("", "nuclei-update-dir-*")
19
if err != nil {
20
return errkit.Wrap(err, "failed to create temp dir")
21
}
22
defer func() {
23
_ = os.RemoveAll(tempdir)
24
}()
25
26
results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "8x8exch02.8x8.com", debug, "-ud", tempdir)
27
if err != nil {
28
return err
29
}
30
31
return expectResultsCount(results, 1)
32
}
33
34