Dogan Can Bakir 163bc22281
add headless options flag (#3951)
* add headless options flag

* disable some tests for windows

* disable interactsh tests on darwin

* disable network/hex.yaml on windows

* make DisableOn func
2023-07-28 21:20:57 +05:30

49 lines
1.3 KiB
Go

package main
import (
"github.com/projectdiscovery/nuclei/v2/pkg/testutils"
)
var fileTestcases = []TestCaseInfo{
{Path: "file/matcher-with-or.yaml", TestCase: &fileWithOrMatcher{}},
{Path: "file/matcher-with-and.yaml", TestCase: &fileWithAndMatcher{}},
{Path: "file/matcher-with-nested-and.yaml", TestCase: &fileWithAndMatcher{}},
{Path: "file/extract.yaml", TestCase: &fileWithExtractor{}},
}
type fileWithOrMatcher struct{}
// Execute executes a test case and returns an error if occurred
func (h *fileWithOrMatcher) Execute(filePath string) error {
results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "file/data/", debug)
if err != nil {
return err
}
return expectResultsCount(results, 1)
}
type fileWithAndMatcher struct{}
// Execute executes a test case and returns an error if occurred
func (h *fileWithAndMatcher) Execute(filePath string) error {
results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "file/data/", debug)
if err != nil {
return err
}
return expectResultsCount(results, 1)
}
type fileWithExtractor struct{}
// Execute executes a test case and returns an error if occurred
func (h *fileWithExtractor) Execute(filePath string) error {
results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "file/data/", debug)
if err != nil {
return err
}
return expectResultsCount(results, 1)
}