mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 21:25:27 +00:00
* fix: remove undefined errorutil.ShowStackTrace * feat: add make lint support and integrate with test * refactor: migrate errorutil to errkit across codebase - Replace deprecated errorutil with modern errkit - Convert error declarations from var to func for better compatibility - Fix all SA1019 deprecation warnings - Maintain error chain support and stack traces * fix: improve DNS test reliability using Google DNS - Configure test to use Google DNS (8.8.8.8) for stability - Fix nil pointer issue in DNS client initialization - Keep production defaults unchanged * fixing logic * removing unwanted branches in makefile --------- Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
33 lines
826 B
Go
33 lines
826 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/testutils"
|
|
"github.com/projectdiscovery/utils/errkit"
|
|
)
|
|
|
|
var templatesDirTestCases = []TestCaseInfo{
|
|
{Path: "protocols/dns/cname-fingerprint.yaml", TestCase: &templateDirWithTargetTest{}},
|
|
}
|
|
|
|
type templateDirWithTargetTest struct{}
|
|
|
|
// Execute executes a test case and returns an error if occurred
|
|
func (h *templateDirWithTargetTest) Execute(filePath string) error {
|
|
tempdir, err := os.MkdirTemp("", "nuclei-update-dir-*")
|
|
if err != nil {
|
|
return errkit.Append(errkit.New("failed to create temp dir"), err)
|
|
}
|
|
defer func() {
|
|
_ = os.RemoveAll(tempdir)
|
|
}()
|
|
|
|
results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "8x8exch02.8x8.com", debug, "-ud", tempdir)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return expectResultsCount(results, 1)
|
|
}
|