mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 22:35:27 +00:00
* use parsed options while signing * update project layout to v3 * fix .gitignore * remove example template * misc updates * bump tlsx version * hide template sig warning with env * js: retain value while using log * fix nil pointer derefernce * misc doc update --------- Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
39 lines
968 B
Go
39 lines
968 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/testutils"
|
|
)
|
|
|
|
type customConfigDirTest struct{}
|
|
|
|
var customConfigDirTestCases = []TestCaseInfo{
|
|
{Path: "protocols/dns/cname-fingerprint.yaml", TestCase: &customConfigDirTest{}},
|
|
}
|
|
|
|
// Execute executes a test case and returns an error if occurred
|
|
func (h *customConfigDirTest) Execute(filePath string) error {
|
|
customTempDirectory, err := os.MkdirTemp("", "")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer os.RemoveAll(customTempDirectory)
|
|
results, err := testutils.RunNucleiBareArgsAndGetResults(debug, []string{"NUCLEI_CONFIG_DIR=" + customTempDirectory}, "-t", filePath, "-u", "8x8exch02.8x8.com")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if len(results) == 0 {
|
|
return nil
|
|
}
|
|
files, err := os.ReadDir(customTempDirectory)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
var fileNames []string
|
|
for _, file := range files {
|
|
fileNames = append(fileNames, file.Name())
|
|
}
|
|
return expectResultsCount(fileNames, 4)
|
|
}
|